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

Simple way to disable builtin method/prop highlighting #60

Open
simonratner opened this issue Sep 11, 2015 · 4 comments
Open

Simple way to disable builtin method/prop highlighting #60

simonratner opened this issue Sep 11, 2015 · 4 comments

Comments

@simonratner
Copy link

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:

pretty

(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 of javascriptGlobals, in another it is a javascriptBOMWindowProp, 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).

@simonratner
Copy link
Author

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

@othree
Copy link
Owner

othree commented Sep 11, 2015

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.

@simonratner
Copy link
Author

Awesome, for now I'll work around it.

@othree
Copy link
Owner

othree commented Mar 3, 2016

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.

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

2 participants