aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/css
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/css
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/css')
-rw-r--r--runtime/queries/css/folds.scm10
-rw-r--r--runtime/queries/css/highlights.scm109
-rw-r--r--runtime/queries/css/indents.scm11
-rw-r--r--runtime/queries/css/injections.scm2
4 files changed, 132 insertions, 0 deletions
diff --git a/runtime/queries/css/folds.scm b/runtime/queries/css/folds.scm
new file mode 100644
index 000000000..60d69a917
--- /dev/null
+++ b/runtime/queries/css/folds.scm
@@ -0,0 +1,10 @@
+[
+ ; top-level block statements from https://github.com/tree-sitter/tree-sitter-css/blob/master/grammar.js
+ ; note: (block) is not used due to unideal behavior when node before block node spans multiple lines
+ (rule_set)
+ (at_rule)
+ (supports_statement)
+ (media_statement)
+ (keyframe_block)
+ (import_statement)+
+] @fold
diff --git a/runtime/queries/css/highlights.scm b/runtime/queries/css/highlights.scm
new file mode 100644
index 000000000..49471fdb2
--- /dev/null
+++ b/runtime/queries/css/highlights.scm
@@ -0,0 +1,109 @@
+[
+ "@media"
+ "@charset"
+ "@namespace"
+ "@supports"
+ "@keyframes"
+ (at_keyword)
+] @keyword.directive
+
+"@import" @keyword.import
+
+[
+ (to)
+ (from)
+] @keyword
+
+(comment) @comment @spell
+
+(tag_name) @tag
+
+(class_name) @type
+
+(id_name) @constant
+
+[
+ (property_name)
+ (feature_name)
+] @property
+
+[
+ (nesting_selector)
+ (universal_selector)
+] @character.special
+
+(function_name) @function
+
+[
+ "~"
+ ">"
+ "+"
+ "-"
+ "*"
+ "/"
+ "="
+ "^="
+ "|="
+ "~="
+ "$="
+ "*="
+] @operator
+
+[
+ "and"
+ "or"
+ "not"
+ "only"
+] @keyword.operator
+
+(important) @keyword.modifier
+
+(attribute_selector
+ (plain_value) @string)
+
+(pseudo_element_selector
+ "::"
+ (tag_name) @attribute)
+
+(pseudo_class_selector
+ (class_name) @attribute)
+
+(attribute_name) @tag.attribute
+
+(namespace_name) @module
+
+(keyframes_name) @variable
+
+((property_name) @variable
+ (#lua-match? @variable "^[-][-]"))
+
+((plain_value) @variable
+ (#lua-match? @variable "^[-][-]"))
+
+[
+ (string_value)
+ (color_value)
+ (unit)
+] @string
+
+(integer_value) @number
+
+(float_value) @number.float
+
+[
+ "#"
+ ","
+ "."
+ ":"
+ "::"
+ ";"
+] @punctuation.delimiter
+
+[
+ "{"
+ ")"
+ "("
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
diff --git a/runtime/queries/css/indents.scm b/runtime/queries/css/indents.scm
new file mode 100644
index 000000000..75e4a63a9
--- /dev/null
+++ b/runtime/queries/css/indents.scm
@@ -0,0 +1,11 @@
+[
+ (block)
+ (declaration)
+] @indent.begin
+
+(block
+ "}" @indent.branch)
+
+"}" @indent.dedent
+
+(comment) @indent.ignore
diff --git a/runtime/queries/css/injections.scm b/runtime/queries/css/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/runtime/queries/css/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))