diff --git a/packages/language-clojure/grammars/ts/highlights.scm b/packages/language-clojure/grammars/ts/highlights.scm index 07bc0a2e1..d031cdda0 100644 --- a/packages/language-clojure/grammars/ts/highlights.scm +++ b/packages/language-clojure/grammars/ts/highlights.scm @@ -95,7 +95,7 @@ (list_lit "(" @punctuation.section.expression.begin (#is-not? test.descendantOfNodeWithData "clojure.dismissTag") . - (sym_lit) @keyword.control (#match? @keyword.control "^def(on[^\s]*|test|macro|n|n-|)$") + (sym_lit) @keyword.control (#match? @keyword.control "^def(on[^\s]*|test|macro|n|n-|protocol|record|struct|)$") . (sym_lit) @meta.definition.global @entity.global ")" @punctuation.section.expression.end) diff --git a/packages/language-clojure/grammars/ts/tags.scm b/packages/language-clojure/grammars/ts/tags.scm index 5506b5c8c..f5f7e60bc 100644 --- a/packages/language-clojure/grammars/ts/tags.scm +++ b/packages/language-clojure/grammars/ts/tags.scm @@ -1,7 +1,47 @@ (list_lit "(" (#is-not? test.descendantOfNodeWithData "clojure.dismissTag") . - (sym_lit) @keyword.control (#match? @keyword.control "^def(on[^\s]*|test|macro|n|n-|)$") + (sym_lit) @keyword.control (#match? @keyword.control "defmacro") . - (sym_lit) @definition.function - ")") + (sym_lit) @name + ")") @definition.constructor + +(list_lit + "(" (#is-not? test.descendantOfNodeWithData "clojure.dismissTag") + . + (sym_lit) @keyword.control (#match? @keyword.control "def(protocol|struct|record)") + . + (sym_lit) @name + ")") @definition.struct + +(list_lit + "(" (#is-not? test.descendantOfNodeWithData "clojure.dismissTag") + . + (sym_lit) @keyword.control (#match? @keyword.control "^def(on[^\s]*|test|macro|n|n-)$") + . + (sym_lit) @name + ")") @definition.function + +(list_lit + "(" (#is-not? test.descendantOfNodeWithData "clojure.dismissTag") + . + (sym_lit) @keyword.control (#match? @keyword.control "^def(on[^\s]*|test|macro|n|n-)$") + . + (sym_lit) @name + ")") @definition.variable + +(list_lit + "(" @punctuation.section.expression.begin (#is-not? test.descendantOfNodeWithData "clojure.dismissTag") + . + (sym_lit) @keyword.control (#match? @keyword.control "/def.") + . + (sym_lit) @name + ")") @definition.function + +(list_lit + "(" @punctuation.section.expression.begin (#is-not? test.descendantOfNodeWithData "clojure.dismissTag") + . + (sym_lit) @keyword.control (#match? @keyword.control "/def") + . + (sym_lit) @name + ")") @definition.variable diff --git a/packages/language-clojure/spec/fixtures/tokens.clj b/packages/language-clojure/spec/fixtures/tokens.clj index 34ad56d7f..f49c3e5a3 100644 --- a/packages/language-clojure/spec/fixtures/tokens.clj +++ b/packages/language-clojure/spec/fixtures/tokens.clj @@ -38,6 +38,15 @@ ; ^ keyword.control ; ^ entity.global +(defprotocol FooBar + ; ^ keyword.control + ; ^ entity.global + (-eq [this other])) + +(defrecord Lol [a b]) + ; ^ keyword.control + ; ^ entity.global + (def a "A STRING") ; <- keyword.control ; ^ entity.global