HerringtonDarkholme / yats.vim

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

Object properties inconsistent highlighting #83

Closed cjnucette closed 6 years ago

cjnucette commented 6 years ago

Hi,

In the following piece of code the action argument is an object:

screenshot from 2018-09-22 10-25-13 As you can see it gets highlighted in a very inconsistent way. The highlighting groups I get are the following:

tomaskallup commented 6 years ago

Hi, sadly I think this is intended, but there probably should be a way to opt out. What's happening is that action.type here get's highlighted as typescriptDOMEventProp, which as you can see is a special property of DOMEvents. action.item is as you found typescriptFileListMethod, again a property of FileList. Lastly the action.index highlight is the correct one. Maybe there should be a documented way to disable these, or some configuration variable, as some people might like it.

I'll wait for @HerringtonDarkholme, to see what he thinks about this.

cjnucette commented 6 years ago

Thanks, that was fast!!! As I keep fixing my color theme, I'm finding that this is happening all over the place. I'm assuming that the fact that it is an object doesn't matter but the context in which is used. So far I found: Array.prototype.push is seen as:

hi<typescriptBOMNavigatorProp> trans<typescriptBOMNavigatorProp> lo<Statement>

but later in the same block of code Array.prototype.filter is seen as:

hi<typescriptArrayMethod> trans<typescriptArrayMethod> lo<typescriptArrayMethod>

both used on the same array.

tomaskallup commented 6 years ago

Well not even the context matters, it's just matching keywords like push etc. You can see all the keywords in here https://github.com/HerringtonDarkholme/yats.vim/tree/master/syntax/yats As far as I saw, they all link to Keyword so maybe we could create a new highlight to which they would link and that would then be a simple way to disable the highlight or perhaps a better solution would be to add a global option (maybe something like disable_platform_specific_highlight) to just completely disable loading of all those syntax files as that might also boost performance a little bit.

HerringtonDarkholme commented 6 years ago

Currently there is no way to disable platform specific highlight.

I think it is good idea to disable those highlights. yats is forked from yajs which contains these highlight by default. I wonder if users want these highlight.

HerringtonDarkholme commented 6 years ago

Fixed in f054d56

You can now set g:yats_host_keywords = 0 to turn it off.