Open simonratner opened 9 years ago
Perhaps a more flexible approach is to avoid linking these highlight groups directly in the syntax files, but instead cluster them into a small number of categories that are easy to link in syntax/javascript.vim
or override in .vimrc
? Ideally, I would like to have:
javascriptBuiltinGlobal
: top-level objects and functions, e.g. Map, Promise, parseInt.javascriptBuiltinStatic
: static properties/methods of the above, e.g. Symbol.iterator, Object.create, Number.EPSILON, restricted to follow the relevant global as they do now.javascriptBuiltinProp
: instance properties and methods of the above, e.g. Array.push, Object.toString.Then specific implementation syntax files could add their own things to these (for node.js, require
goes into javascriptBuiltinGlobal
and require.resolve
into javascriptBuiltinStatic
).
Personally, I could then comment out all syntax/yajs/*
includes that are not relevant to me (I'll keep es6 and node.js, for example) and also do something like this in my own environment:
hi link javascriptBuiltinGlobal Structure
hi link javascriptBuiltinStatic Identifier
hi link javascriptBuiltinProp Normal
I am going to refactor this part. But not very soon.(will be very busy until end of year).
Some info for you. https://github.com/othree/webidl-to-vim-syntax will be the base. Not sure how it will be included now.
Awesome, for now I'll work around it.
Since the performance issue on neovim. The webidl.vim will not come in as default. So this will then be implement later.
But my idea is beside your suggestion.
Give an option to not include syntax/yajs/*
.
I think will have a little better performance.
I prefer not to highlight all the known methods and props of built-in objects. Many of them are too generic and conflict with unrelated code, creating pretty things like this:
(Not to mention that sometimes a keyword is highlighted differently based on context, as you can see with
parent
: in one case it is part ofjavascriptGlobals
, in another it is ajavascriptBOMWindowProp
, but really it should not be highlighted at all).I haven't found a setting to disable them. I could comment out all the
/syntax/yajs/*
includes, but that also removes useful things like the global functions themselves (I would like to keep Map, but not Map.get).