elisp-tree-sitter icon indicating copy to clipboard operation
elisp-tree-sitter copied to clipboard

ruby: identifiers mis-highlighted as "function.method"

Open muirdm opened this issue 5 years ago • 3 comments

The below ruby code:

foo = 123

Gives foo a face of tree-sitter-hl-face:function.method which isn't correct (it should be variable or similar). I poked around a bit and my guess would be the ((identifier) @function.method (#is-not? local)) highlight rule is matching too much suggesting the locals stuff isn't working (?).

I'm guessing it is an issue here vs tree-sitter-ruby, but I'm really not sure.

muirdm avatar Dec 06 '20 23:12 muirdm

Yeah, .is-not? predicate is not yet supported by emacs-tree-sitter. The highlighting queries for Ruby need to be rewritten to take that into account.

Currently, they are still just a copy of upstream's. Since I don't use Ruby myself, I would like some Ruby users to own and maintain the queries.

ubolonton avatar Dec 11 '20 12:12 ubolonton

To clarify, is it the lack of support for the .is-not? predicate or the lack of support for local as mentioned in #94?

Also, again to clarify, you are suggesting we could mitigate this lack of support by rewriting the highlighting rules to not rely on .is-not? and local?

jspawar avatar Jul 14 '21 18:07 jspawar

To clarify, is it the lack of support for the .is-not? predicate or the lack of support for local as mentioned in #94?

Both: additional predicates in general, and local information to support a particular type of predicate. The former is relatively straightforward. The latter is difficult to make efficient.

Also, again to clarify, you are suggesting we could mitigate this lack of support by rewriting the highlighting rules to not rely on .is-not? and local?

Yeah, until these are implemented.

ubolonton avatar Jul 24 '21 04:07 ubolonton