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

Function highlight ? #1

Open
kiuKisas opened this issue Aug 25, 2021 · 4 comments
Open

Function highlight ? #1

kiuKisas opened this issue Aug 25, 2021 · 4 comments
Labels
bikeshedding Opinionated discussion

Comments

@kiuKisas
Copy link

As we discuss here : rescript-lang/vim-rescript#49 (comment)

should we highlight functions ?

@nkrkv nkrkv transferred this issue from rescript-lang/nvim-treesitter-rescript Aug 25, 2021
@nkrkv nkrkv added the bikeshedding Opinionated discussion label Aug 26, 2021
@aspeddro
Copy link
Collaborator

@nkrkv i'm playing with the tree sitter, I added some highlights. I don't know the status of this project, but if you wish I can open a PR.

Demo:
image

@nkrkv
Copy link
Collaborator

nkrkv commented Nov 17, 2021

Thanks! I’ve read that the idea of Tree-sitter based highlighting is to color the same symbols using the same colors. So that if you see several pink words in random places, you know they refer to the same thing. From that point of view, highlighting function use and not highlighting its declaration is incorrect. And in a language like ReScript where all functions are lambdas the true way is hardly applicable at all.

I might be mistaken. Let’s leave the issue floating… If more people would like the call-only highlight… well, it would be worth doing so.

@aspeddro
Copy link
Collaborator

aspeddro commented Nov 17, 2021

Thanks for the answer. The declaration can be highlighted as @function, an example:

(let_binding
  (value_identifier) @function
  (function))

I don't know if this one covers everything

image

@kiuKisas
Copy link
Author

So, the missing case is when we have higher order function ? Seems good enough to me. Not sure if tree-sitter will/can detect that in the future, probably not :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bikeshedding Opinionated discussion
Projects
None yet
Development

No branches or pull requests

3 participants