HerringtonDarkholme / yats.vim

Yet Another TypeScript Syntax: The most advanced TypeScript Syntax Highlighting in Vim
Vim License
649 stars 68 forks source link

TSX highlighting is thrown off when `type` keyword is hit #257

Closed tremby closed 2 years ago

tremby commented 2 years ago
function whatever() {
  return <p>If I type this the syntax highlighting goes wrong</p>;
}

screen

AllTradesz commented 2 years ago

have you found any resolution for this? seems to also happen with *.ts files

actually, may have been (somewhat) fixed per #251

HerringtonDarkholme commented 2 years ago

I cannot reproduce it now

image
tremby commented 2 years ago

I am still seeing the problem, but I concede that I am not 100% certain I am correctly loading/using yats.

I am using vim-polyglot, and I have run its update script. I have looked at syntax/basic/keyword.vim and verified that it has the changes in https://github.com/HerringtonDarkholme/yats.vim/commit/4bf3879055847e675335f1c3050bd2dd11700c7e

I am not certain, however, that yats has been chosen by whatever magic vim-polyglot is performing.

If I run :syn I see as part of the copious output that typescriptDefaultImportName shows up, and this was introduced with the change. So I think it's running correctly?

Still, I open a new file test.ts and paste in the above code, and I still see it highlighting as in my screenshot above. I type :se ft? and I see filetype=typescript.

tremby commented 2 years ago

The examples in https://github.com/HerringtonDarkholme/yats.vim/issues/251 all seem to highlight correctly for me, fwiw...

HerringtonDarkholme commented 2 years ago

@tremby I would suggest using only yats as a minimal reproduction. Installing other plugins can break highlighting as well.

tremby commented 2 years ago

It looks like last time I commented I was accidentally testing with a file called test.ts, overlooking that my example code has TSX in it. But I get the broken syntax highlighting either way, with my regular plugin stack.

I renamed my .vim directory and made a new one with yats and nothing else. I'm getting no highlighting at all on *.tsx files. :se ft? gives me typescriptreact, and :syntax tells me No Syntax items defined for this buffer. Does yats not cover TSX?

tremby commented 2 years ago

I went back to my regular plugin stack and configuration and scrutinized it, and trimmed some fat. I'm not sure exactly which change made the difference, but this is now looking fine. Sorry for the noise.

(And I suppose I missed some important step when I set up the configuration with only yats active, which meant TSX didn't highlight? Not sure.)