Define a highlighting file for Clojure

This isn't provided upstream, and the parse tree doesn't have a lot of
information, but we can at least handle string literals and keywords.
pull/185/head
Wilfred Hughes 2022-03-22 21:07:39 +07:00
parent c9c3582871
commit 4647112e93
6 changed files with 17 additions and 2 deletions

@ -12,6 +12,8 @@ would be excluded from context.
Fixed an issue where lines containing only whitespace would be
highlighted in purple.
Improved Clojure syntax highlighting.
### Parsing
Added support for Dart.

@ -2,6 +2,7 @@
(defn example
[x]
"Does stuff."
(-> {:more (inc x)
:less (dec x)}
(assoc :twice (+ x x))))

@ -2,6 +2,7 @@
(defn example
[x]
"Does stuff."
(println "hello!")
{:more (inc x)
:less (dec x)})

@ -5,7 +5,7 @@ sample_files/change_outer_before.el sample_files/change_outer_after.el
1e144818ad54091b05e58e2c617add8f -
sample_files/clojure_before.clj sample_files/clojure_after.clj
8316bcd959ce706ac07011f6dc31c93a -
792e31e6c057b10d4a2e27932c20c33b -
sample_files/comments_before.rs sample_files/comments_after.rs
d899ce2b86f03851fa02823a1ff9aa3f -

@ -144,7 +144,11 @@ pub fn from_language(language: guess::Language) -> TreeSitterConfig {
delimiter_tokens: (vec![("{", "}"), ("(", ")"), ("[", "]")])
.into_iter()
.collect(),
highlight_query: ts::Query::new(language, "").unwrap(),
highlight_query: ts::Query::new(
language,
include_str!("../vendor/highlights/clojure.scm"),
)
.unwrap(),
}
}
CommonLisp => {

@ -0,0 +1,7 @@
;; Basic, limited highlighting for Clojure.
;; TODO: submit upstream.
(comment) @comment
(str_lit) @string
(kwd_lit) @constant