typescript-vim icon indicating copy to clipboard operation
typescript-vim copied to clipboard

typescript override logic broken in Neovim master

Open jwhitley opened this issue 3 years ago • 4 comments

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.

jwhitley avatar Oct 23 '20 22:10 jwhitley

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

s0ber avatar Jul 17 '21 16:07 s0ber

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

s0ber avatar Jul 17 '21 17:07 s0ber

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.

jwhitley avatar Jul 17 '21 17:07 jwhitley

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.

binyomen avatar Mar 07 '22 05:03 binyomen