Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression: all import statements are highlighted with red. #204

Open
aslushnikov opened this issue Oct 20, 2023 · 5 comments
Open

regression: all import statements are highlighted with red. #204

aslushnikov opened this issue Oct 20, 2023 · 5 comments

Comments

@aslushnikov
Copy link

I bisected this down to this commit: 169f678

Repro:

  • install tip-of-tree typescript-vim
  • open a simple typescript file:
import fs from 'fs';
import path from 'path';

This is what it looks like on master:

image

This is what it looks like with 31ede5a:

image
@laoshaw
Copy link

laoshaw commented Feb 3, 2024

same issue here, took me a while to realize it's typescript-vim causing this.

@laoshaw
Copy link

laoshaw commented Feb 3, 2024

the fix seems to be:
change "if version < 508" to "if version >= 508"
in syntax/typescript.vim

@leafgarland
Copy link
Owner

The suggested fix changes this syntax to use highlight link instead of highlight link default, which would be better done by removing the condition completely as we can assume everyone is on a newer version than vim v5.08.

But, as commit #169f78 says, syntax files that replace default syntax files usually use highlight link default all the time. So perhaps this isn't the right fix.

@leafgarland
Copy link
Owner

As an aside. Have you tried the default typescript syntax that is now distributed with vim/nvim? It might work as well or better?

Also, if you are using neovim then you could use the treesitter syntax which is likely to be faster. I switched to treesitter highlighting some time ago.

When this syntax was first created (back before typescript's 1.0 release) there were no other options but there are now.

@riturajborpujari
Copy link

The issue doesn't occur on my Mac setup

> vim --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 23 2024 22:19:02)
macOS version - arm64

For my Alpine desktop however, it does! Also checked on ubuntu containers! Same issue
switched to HerringtonDarkholme/yats.vim and it solved the issue.

@laoshaw Checkout these lines on /usr/share/vim/vim90/syntax/typescript.vim

" This is the same syntax that is in yats.vim, but:
 12 " - flattened into one file
 13 " - HiLink commands changed to "hi def link"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants