aboutsummaryrefslogtreecommitdiffstats
path: root/queries/kconfig
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2023-08-31 05:28:16 -0400
committerAmaan Qureshi <amaanq12@gmail.com>2023-08-31 14:19:23 -0400
commitf8c2825220bff70919b527ee68fe44e7b1dae4b2 (patch)
tree648776d3a0d9a8ca036acaf6f2f7a60dcdb45877 /queries/kconfig
parentfix(ecma_injections): limit function names to alphanumeric characters only (diff)
downloadnvim-treesitter-f8c2825220bff70919b527ee68fe44e7b1dae4b2.tar
nvim-treesitter-f8c2825220bff70919b527ee68fe44e7b1dae4b2.tar.gz
nvim-treesitter-f8c2825220bff70919b527ee68fe44e7b1dae4b2.tar.bz2
nvim-treesitter-f8c2825220bff70919b527ee68fe44e7b1dae4b2.tar.lz
nvim-treesitter-f8c2825220bff70919b527ee68fe44e7b1dae4b2.tar.xz
nvim-treesitter-f8c2825220bff70919b527ee68fe44e7b1dae4b2.tar.zst
nvim-treesitter-f8c2825220bff70919b527ee68fe44e7b1dae4b2.zip
feat: add Kconfig
Diffstat (limited to 'queries/kconfig')
-rw-r--r--queries/kconfig/folds.scm9
-rw-r--r--queries/kconfig/highlights.scm81
-rw-r--r--queries/kconfig/indents.scm11
-rw-r--r--queries/kconfig/injections.scm2
-rw-r--r--queries/kconfig/locals.scm17
5 files changed, 120 insertions, 0 deletions
diff --git a/queries/kconfig/folds.scm b/queries/kconfig/folds.scm
new file mode 100644
index 000000000..980667dfc
--- /dev/null
+++ b/queries/kconfig/folds.scm
@@ -0,0 +1,9 @@
+[
+ (config)
+ (menuconfig)
+ (choice)
+ (comment_entry)
+ (menu)
+ (if)
+ (help_text)
+] @fold
diff --git a/queries/kconfig/highlights.scm b/queries/kconfig/highlights.scm
new file mode 100644
index 000000000..c18c69f69
--- /dev/null
+++ b/queries/kconfig/highlights.scm
@@ -0,0 +1,81 @@
+"source" @include
+
+[
+ "mainmenu"
+ "config"
+ "menuconfig"
+ "choice"
+ "endchoice"
+ "comment"
+ "menu"
+ "endmenu"
+ "prompt"
+ "default"
+ "range"
+ "help"
+ (optional)
+ (modules)
+] @keyword
+
+[
+ "if"
+ "endif"
+ "depends on"
+ "select"
+ "imply"
+ "visible if"
+] @conditional
+
+[
+ "def_bool"
+ "def_tristate"
+] @keyword.function
+
+[
+ "||"
+ "&&"
+ "="
+ "!="
+ "<"
+ ">"
+ "<="
+ ">="
+ "!"
+] @operator
+
+[
+ "bool"
+ "tristate"
+ "int"
+ "hex"
+ "string"
+] @type.builtin
+
+[ "(" ")" ] @punctuation.bracket
+
+(macro_variable ["$(" ")"] @punctuation.special)
+
+(symbol) @variable
+
+[
+ (prompt)
+ (macro_content)
+ (text)
+] @string
+
+(config name: (symbol) @constant)
+(menuconfig name: (symbol) @constant)
+(choice name: (symbol) @constant)
+
+((symbol) @constant
+ (#lua-match? @constant "[A-Z0-9]+"))
+
+(mainmenu name: (prompt) @text.title)
+(comment_entry name: (prompt) @text.title)
+(menu name: (prompt) @text.title)
+
+(source (prompt) @text.uri @string.special)
+
+(comment) @comment
+
+(ERROR) @error
diff --git a/queries/kconfig/indents.scm b/queries/kconfig/indents.scm
new file mode 100644
index 000000000..77f02e1f6
--- /dev/null
+++ b/queries/kconfig/indents.scm
@@ -0,0 +1,11 @@
+(help_text (text) @indent.auto)
+
+[
+ (config)
+ (menuconfig)
+ (choice)
+ (comment_entry)
+ (menu)
+ (if)
+ (help_text)
+] @indent.begin
diff --git a/queries/kconfig/injections.scm b/queries/kconfig/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/queries/kconfig/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/queries/kconfig/locals.scm b/queries/kconfig/locals.scm
new file mode 100644
index 000000000..3727cd94f
--- /dev/null
+++ b/queries/kconfig/locals.scm
@@ -0,0 +1,17 @@
+[
+ (symbol)
+ (prompt)
+] @reference
+
+[
+ (config)
+ (menuconfig)
+ (choice)
+ (comment_entry)
+ (menu)
+ (if)
+] @scope
+
+(type_definition (prompt) @definition.var)
+(type_definition (input_prompt (prompt) @definition.var))
+(type_definition_default (expression (prompt) @definition.var))