Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--book/src/generated/lang-support.md2
-rw-r--r--languages.toml8
-rw-r--r--runtime/queries/common-lisp/highlights.scm100
-rw-r--r--runtime/queries/common-lisp/indents.scm1
-rw-r--r--runtime/queries/common-lisp/injections.scm3
-rw-r--r--runtime/queries/common-lisp/rainbows.scm11
-rw-r--r--runtime/queries/common-lisp/tags.scm2
-rw-r--r--runtime/queries/common-lisp/textobjects.scm7
8 files changed, 127 insertions, 7 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 7b0f21c1..768a9084 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -32,7 +32,7 @@
| cmake | ✓ | ✓ | ✓ | | | `neocmakelsp`, `cmake-language-server` |
| codeql | ✓ | ✓ | | | | `codeql` |
| comment | ✓ | | | | | |
-| common-lisp | ✓ | | ✓ | | ✓ | `cl-lsp` |
+| common-lisp | ✓ | ✓ | | ✓ | ✓ | `cl-lsp` |
| cpon | ✓ | | ✓ | | | |
| cpp | ✓ | ✓ | ✓ | ✓ | ✓ | `clangd` |
| cross-config | ✓ | ✓ | | | ✓ | `taplo`, `tombi` |
diff --git a/languages.toml b/languages.toml
index 3edcd301..05903c34 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1963,13 +1963,17 @@ grammar = "scheme"
[[language]]
name = "common-lisp"
-scope = "source.lisp"
+scope = "source.commonlisp"
file-types = ["lisp", "asd", "cl", "l", "lsp", "ny", "podsl", "ros", "sexp"]
shebangs = ["lisp", "sbcl", "ccl", "clisp", "ecl"]
comment-token = ";"
indent = { tab-width = 2, unit = " " }
language-servers = [ "cl-lsp" ]
-grammar = "scheme"
+grammar = "commonlisp"
+
+[[grammar]]
+name = "commonlisp"
+source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-commonlisp", rev = "32323509b3d9fe96607d151c2da2c9009eb13a2f" }
[language.auto-pairs]
'(' = ')'
diff --git a/runtime/queries/common-lisp/highlights.scm b/runtime/queries/common-lisp/highlights.scm
index e11eb788..d23c19ff 100644
--- a/runtime/queries/common-lisp/highlights.scm
+++ b/runtime/queries/common-lisp/highlights.scm
@@ -1 +1,99 @@
-; inherits: scheme
+(sym_lit) @variable
+
+[
+ (accumulation_verb)
+ "thereis"
+ "always"
+ "below"
+ "into"
+ "as"
+] @keyword
+
+"and" @keyword.operator
+
+[
+ "when"
+ "if"
+ "unless"
+ "else"
+] @keyword.control.conditional
+
+[
+ "for"
+ "loop"
+ "while"
+ "until"
+ "do"
+ "repeat"
+] @keyword.control.loop
+
+[
+ "in"
+ "across"
+ "being"
+ "from"
+
+ "finally"
+ "initially"
+
+ "with"
+] @keyword.control
+
+"return" @keyword.control.return
+
+(include_reader_macro) @keyword.directive
+
+(defun_keyword) @keyword.function
+
+(defun_header
+ function_name: (_) @function)
+
+(defun_header
+ lambda_list: (list_lit
+ (sym_lit) @variable.parameter))
+
+(defun_header
+ lambda_list: (list_lit
+ (list_lit
+ . (sym_lit) @variable.parameter)
+ . (_)))
+
+"=" @operator
+
+; quote
+(format_specifier) @operator
+
+(quoting_lit "'" @operator)
+(syn_quoting_lit "`" @operator)
+(unquoting_lit "," @operator)
+(unquote_splicing_lit ",@" @operator)
+
+(var_quoting_lit
+ marker: "#'" @operator)
+
+(list_lit
+ . (sym_lit) @operator
+ (#any-of? @operator "+" "*" "-" "=" "<" ">" "<=" ">=" "/="))
+
+(package_lit
+ package: (_) @namespace)
+"cl" @namespace
+
+(str_lit) @string
+
+(num_lit) @constant.numeric
+["#c" "#C"] @constant.numeric
+[
+ (array_dimension)
+ "#0A"
+ "#0a"
+] @constant.numeric
+
+(nil_lit) @constant.builtin
+(char_lit) @constant.character
+
+[(comment) (block_comment)] @comment
+(dis_expr) @comment
+
+["(" ")"] @punctuaton.bracket
+[":" "::" "."] @punctuation.special
diff --git a/runtime/queries/common-lisp/indents.scm b/runtime/queries/common-lisp/indents.scm
deleted file mode 100644
index e11eb788..00000000
--- a/runtime/queries/common-lisp/indents.scm
+++ /dev/null
@@ -1 +0,0 @@
-; inherits: scheme
diff --git a/runtime/queries/common-lisp/injections.scm b/runtime/queries/common-lisp/injections.scm
index e11eb788..ba6d1c7c 100644
--- a/runtime/queries/common-lisp/injections.scm
+++ b/runtime/queries/common-lisp/injections.scm
@@ -1 +1,2 @@
-; inherits: scheme
+([(comment) (block_comment)] @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/common-lisp/rainbows.scm b/runtime/queries/common-lisp/rainbows.scm
index e11eb788..14ad4296 100644
--- a/runtime/queries/common-lisp/rainbows.scm
+++ b/runtime/queries/common-lisp/rainbows.scm
@@ -1 +1,10 @@
-; inherits: scheme
+[
+ (list_lit)
+ (vec_lit)
+ (defun)
+ (loop_macro)
+ (complex_num_lit)
+] @rainbow.scope
+
+(vec_lit "#" @rainbow.bracket)
+["(" ")"] @rainbow.bracket
diff --git a/runtime/queries/common-lisp/tags.scm b/runtime/queries/common-lisp/tags.scm
new file mode 100644
index 00000000..06f36925
--- /dev/null
+++ b/runtime/queries/common-lisp/tags.scm
@@ -0,0 +1,2 @@
+(defun (defun_header
+ function_name: (_) @name)) @definition.function
diff --git a/runtime/queries/common-lisp/textobjects.scm b/runtime/queries/common-lisp/textobjects.scm
new file mode 100644
index 00000000..5cd88321
--- /dev/null
+++ b/runtime/queries/common-lisp/textobjects.scm
@@ -0,0 +1,7 @@
+[
+ (comment)
+ (block_comment)
+] @comment.inside
+
+(comment)+ @comment.around
+(block_comment) @comment.around