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

typescript override logic broken in Neovim master #184

Open
jwhitley opened this issue Oct 23, 2020 · 4 comments
Open

typescript override logic broken in Neovim master #184

jwhitley opened this issue Oct 23, 2020 · 4 comments

Comments

@jwhitley
Copy link

Unfortunately the vim syntax override logic appears to have recently broken relative to neovim master circa neovim/neovim@2786d96.

With this plugin loaded (confirmed via starting neovim with -V20vimlog and searching the results) typescriptReserved is now linking to neovim's (terrible) default of Error instead of the (sensible) default of Keyword used by typescript-vim. I haven't sussed out exactly why, since some digging suggests that neovim's had that bad default for some time. I do note that neovim's typescript defs were recently updated via cherry pick without having pulled in the associated patches. It's not clear whether that's the cause of the behavior change, or just a red herring.

Filing this to some extent as an FYI. After some digging, it's not yet clear to me where the best place to solve the override issue lies – e.g. with neovim itself, or here in typescript-vim.

As an immediate workaround, I've just manually slammed hi link typescriptReserved Keyword into my .vimrc to staunch the eye-bleeding.

@s0ber
Copy link

s0ber commented Jul 17, 2021

[email protected] has been released a few days ago and it has keywords highlighting broken as well. Thank you for the fix!

@s0ber
Copy link

s0ber commented Jul 17, 2021

I've figured out a bit more inconsistencies and to me the issue occur when I open the tsx file first. When opening a regular ts files — syntax highlighting is fine, even when I open tsx files next. But if I open tsx file first in a vim session — it has the highlighting issues and next ts files are broken as well.

Also I've found a couple of more syntax rules that got broken:

" fix typescript syntax in [email protected]
hi link typescriptReserved Keyword
hi link typescriptParens Operator
hi link typescriptNull Type

@jwhitley
Copy link
Author

Thanks! Seems like it's (past) time to file an issue against neovim. I'm guessing that I never did this myself, or I probably would have linked it to this issue. I did a couple of quick searches and didn't find a matching open issue. They can help track down the root cause, e.g. is this just inherited from upstream Vim patches (and so they'd pop the bug or a PR up another level), or is it something that broke just in nvim.

@binyomen
Copy link
Contributor

binyomen commented Mar 7, 2022

So I did some more research to try and figure out what's going on here.

Neither vim nor neovim seem to actually define typescriptReserved by default. They set its highlighting to Error, but I'm not 100% sure why it's present at all since it has no actual syntax associated with it. It is defined in what I think might be the origin of vim's typescript syntax, but I haven't spent the time to figure out exactly what for.

Either way, this plugin seems to be what's actually mapping typescriptReserved to language keywords. Without this plugin installed, for example, an import has the highlight group typescriptImport. It only gets the highlight group typescriptReserved after installing this plugin.

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

3 participants