diff options
| author | Noah <noah.bogart@hey.com> | 2023-08-27 03:25:43 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-27 10:25:43 +0300 |
| commit | e942c720acf44c5c19338ffd57185e9e0e027227 (patch) | |
| tree | 5478c0a7884eac7b1fd58b7ec1b82e0d8e28f1eb | |
| parent | Update parsers: bash, doxygen, wing (diff) | |
| download | nvim-treesitter-e942c720acf44c5c19338ffd57185e9e0e027227.tar nvim-treesitter-e942c720acf44c5c19338ffd57185e9e0e027227.tar.gz nvim-treesitter-e942c720acf44c5c19338ffd57185e9e0e027227.tar.bz2 nvim-treesitter-e942c720acf44c5c19338ffd57185e9e0e027227.tar.lz nvim-treesitter-e942c720acf44c5c19338ffd57185e9e0e027227.tar.xz nvim-treesitter-e942c720acf44c5c19338ffd57185e9e0e027227.tar.zst nvim-treesitter-e942c720acf44c5c19338ffd57185e9e0e027227.zip | |
fix(clojure): fix field highlighting (#5319)
| -rw-r--r-- | queries/clojure/highlights.scm | 11 | ||||
| -rw-r--r-- | tests/query/highlights/clojure/test.clj | 52 |
2 files changed, 60 insertions, 3 deletions
diff --git a/queries/clojure/highlights.scm b/queries/clojure/highlights.scm index 08ca49b86..2d3922adf 100644 --- a/queries/clojure/highlights.scm +++ b/queries/clojure/highlights.scm @@ -63,7 +63,7 @@ ; Constructor ((sym_lit) @constructor - (#lua-match? @constructor "^-\\>[^\\>].*")) + (#lua-match? @constructor "^-%>[^>].*")) ; Builtin dynamic variables ((sym_lit) @variable.builtin @@ -100,12 +100,17 @@ (#lua-match? @type "^[^/]+[.][^/]*$")) ; Interop +; (.instanceMember instance args*) +; (.instanceMember Classname args*) ((sym_lit) @method - (#lua-match? @method "^[.][^-]")) + (#lua-match? @method "^%.[^-]")) +; (.-instanceField instance) ((sym_lit) @field - (#lua-match? @field "^[.]-")) + (#lua-match? @field "^%.%-.*")) +; Classname/staticField ((sym_lit) @field (#lua-match? @field "^[%u].*/.+")) +; (Classname/staticMethod args*) (list_lit . (sym_lit) @method diff --git a/tests/query/highlights/clojure/test.clj b/tests/query/highlights/clojure/test.clj new file mode 100644 index 000000000..ab9e46d9a --- /dev/null +++ b/tests/query/highlights/clojure/test.clj @@ -0,0 +1,52 @@ +(ns test {:clj-kondo/ignore true}) +; <- punctuation.bracket +; ^ include +; ^ namespace + + ; asdf +;^^^^^^ comment + + #_ abc +;^^^^^^ comment + +(func obj) +;^^^^ function.call +; ^^^ variable + + #(+ % %1 %&) +;^ punctuation.special +; ^ function.call +; ^ ^^ ^^ variable.builtin + + & +;^ parameter + + ->abc +;^^^^^ constructor + + ->>abc +;^^^^^^ variable + + *1 *2 *3 *e +;^^ ^^ ^^ ^^ variable.builtin + +(.method) +;^^^^^^^ method + +(.-field) +;^^^^^^^ field + + Abc/method +;^^^^^^^^^^ field + +(Abc/method) +;^^^^^^^^^^ method + + Abc +;^^^ type + + abc. +;^^^^ type + + ^abc +;^ punctuation.special |
