diff options
| author | Oliver Marshall <olivershawmarshall@gmail.com> | 2021-06-06 13:19:18 +0100 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-07-19 16:24:01 +0000 |
| commit | 2403f3a8de5b8837de2911e044fe789e55aba817 (patch) | |
| tree | 46613551fc558a890d093f7b0125a8d9d7dd8ba8 /queries/clojure | |
| parent | Revamp the symbol highlighting (diff) | |
| download | nvim-treesitter-2403f3a8de5b8837de2911e044fe789e55aba817.tar nvim-treesitter-2403f3a8de5b8837de2911e044fe789e55aba817.tar.gz nvim-treesitter-2403f3a8de5b8837de2911e044fe789e55aba817.tar.bz2 nvim-treesitter-2403f3a8de5b8837de2911e044fe789e55aba817.tar.lz nvim-treesitter-2403f3a8de5b8837de2911e044fe789e55aba817.tar.xz nvim-treesitter-2403f3a8de5b8837de2911e044fe789e55aba817.tar.zst nvim-treesitter-2403f3a8de5b8837de2911e044fe789e55aba817.zip | |
Add context based highlighting for def, defn & ns
Diffstat (limited to 'queries/clojure')
| -rw-r--r-- | queries/clojure/highlights.scm | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/queries/clojure/highlights.scm b/queries/clojure/highlights.scm index cb9b350e6..706c7a64a 100644 --- a/queries/clojure/highlights.scm +++ b/queries/clojure/highlights.scm @@ -260,9 +260,63 @@ "vreset!" "with-bindings*" "with-meta" "with-redefs-fn" "xml-seq" "zero?" "zipmap")) + + +;; >> Context based highlighting + +; def-likes +; Correctly highlight docstrings +(list_lit + . + (sym_lit) @a + (#match? @a "^def.*") + . + (sym_lit) + . + (str_lit)? @text + . + (_)) + +; Funciton definitions +(list_lit + . + (sym_lit) @a + (#any-of? @a "fn" "fn*" "defn" "defn-") + . + (sym_lit)? @function + . + (str_lit)? @text) +;; TODO: Fix parameter highlighting +;; I think there's a bug here in nvim-treesitter +;; TODO: Reproduce bug and file ticket + ;. + ;[(vec_lit + ; (sym_lit)* @parameter) + ; (list_lit + ; (vec_lit + ; (sym_lit)* @parameter))]) + +;[((list_lit +; (vec_lit +; (sym_lit) @parameter) +; (_) +; + +; ((vec_lit +; (sym_lit) @parameter) +; (_))) + + ; Meta punctuation ;; NOTE: When the above `Function definitions` query captures the ;; the @function it also captures the child meta_lit ;; We capture the meta_lit symbol (^) after so that the later ;; highlighting overrides the former "^" @punctuation.special + +;; namespaces +(list_lit + . + (sym_lit) @a + (#eq? @a "ns") + . + (sym_lit) @namespace) |
