—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.
test.ts
and open it in Vim`:const x = { onClickFunction: (event) => { const body = `${x}`; thisFunctionIsShownAsLiteralButItIsntOne(); };
The line thisFunctionIsShownAsLiteralButItIsntOne();
should be highlighted as a function but it is shown as a literal.
The error happens in nvim as well so I assume this is an bug in the style file of TypeScript.
With :set syntax=javascript
the highlighting is correct.
8.2.4106
Operating System: Arch Linux
Terminal: GNOME Terminal 3.42.2 for GNOME 41
Value of $TERM: xterm-256color
Shell: zsh 5.8.
1
No response
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.
I can't reproduce:
Try to reproduce without config:
$ vim --clean test.ts
If you can still reproduce, try again on master. 8.2.4106 is quite recent, but there probably has been an update of the runtime files since then.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.
Although, the syntax file changes the value of the 'iskeyword'
option. Instead, it should use the iskeyword
syntax variant:
diff --git a/runtime/syntax/typescriptcommon.vim b/runtime/syntax/typescriptcommon.vim index ef362fc72..aebdc4509 100644 --- a/runtime/syntax/typescriptcommon.vim +++ b/runtime/syntax/typescriptcommon.vim @@ -22,7 +22,7 @@ if main_syntax == 'typescript' || main_syntax == 'typescriptreact' " syntax cluster htmlJavaScript contains=TOP endif " For private field added from TypeScript 3.8 -setlocal iskeyword+=# +execute 'syntax iskeyword ' .. &l:iskeyword .. ',#' " lowest priority on least used feature syntax match typescriptLabel /[a-zA-Z_$]\k*:/he=e-1 contains=typescriptReserved nextgroup=@typescriptStatement skipwhite skipempty
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.
You are not using the syntax file from the distribution. Notice that "const body" has "body" highlighted, for me it isn't.
You must have extra highlighting set at least.
Try starting with "vim --clean".
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.
When using vim --clean
, the error goes away. I will try to figure out what causes it.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.
Is it working as intended that this changes syntax highlighting?
I don't know. At least it's documented at :help 'iskeyword'
:
This option also influences syntax highlighting, unless the syntax
uses |:syn-iskeyword|.
FWIW, I think a syntax plugin should not change any option which could be set in a filetype plugin.
This patch would probably fix the issue:
diff --git a/runtime/syntax/typescriptcommon.vim b/runtime/syntax/typescriptcommon.vim index ef362fc72..1cae4a443 100644 --- a/runtime/syntax/typescriptcommon.vim +++ b/runtime/syntax/typescriptcommon.vim @@ -15,14 +15,14 @@ endif " NOTE: this results in accurate highlighting, but can be slow. syntax sync fromstart -"Dollar sign is permitted anywhere in an identifier -setlocal iskeyword-=$
if main_syntax == 'typescript' || main_syntax == 'typescriptreact'
- setlocal iskeyword+=$ + " Dollar sign is permitted anywhere in an identifier + " # for private field added from TypeScript 3.8 + syntax iskeyword @,48-57,_,128-167,224-235,$,# " syntax cluster htmlJavaScript contains=TOP +else + syntax iskeyword @,48-57,_,128-167,224-235,# endif -" For private field added from TypeScript 3.8 -setlocal iskeyword+=# " lowest priority on least used feature syntax match typescriptLabel /[a-zA-Z_$]\k*:/he=e-1 contains=typescriptReserved nextgroup=@typescriptStatement skipwhite skipempty
Instead of adding characters to the current value of the buffer-local option 'iskeyword'
, it adds them to the the Vim default, and assign the result to the syntax-local option.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.
Ah, I wrongly copied the default value for Win32. We would need to test whether we are on a Windows system first. Otherwise, the default is:
@,48-57,_,192-255
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.
Here is a new try:
diff --git a/runtime/syntax/typescriptcommon.vim b/runtime/syntax/typescriptcommon.vim index ef362fc72..4a8c91cdc 100644 --- a/runtime/syntax/typescriptcommon.vim +++ b/runtime/syntax/typescriptcommon.vim @@ -15,14 +15,22 @@ endif " NOTE: this results in accurate highlighting, but can be slow. syntax sync fromstart
-"Dollar sign is permitted anywhere in an identifier -setlocal iskeyword-=$ if main_syntax == 'typescript' || main_syntax == 'typescriptreact' - setlocal iskeyword+=$ + " Dollar sign is permitted anywhere in an identifier + " # for private field added from TypeScript 3.8
+ if has('win32') + syntax iskeyword @,48-57,_,128-167,224-235,#,$ + else + syntax iskeyword @,48-57,_,192-255,#,$ + endif
" syntax cluster htmlJavaScript contains=TOP
+else
+ if has('win32') + syntax iskeyword @,48-57,_,128-167,224-235,# + else + syntax iskeyword @,48-57,_,192-255,# + endif
endif -" For private field added from TypeScript 3.8 -setlocal iskeyword+=# " lowest priority on least used feature syntax match typescriptLabel /[a-zA-Z_$]\k*:/he=e-1 contains=typescriptReserved nextgroup=@typescriptStatement skipwhite skipempty
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.
Please suggest changes to the Typescript syntax at
https:github.com/HerringtonDarkholme/yats.vim
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.
Closed #9772.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.