aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Valdez <80359343+ValdezFOmar@users.noreply.github.com>2024-07-04 10:23:44 -0700
committerGitHub <noreply@github.com>2024-07-04 20:23:44 +0300
commit5d1646893a01397f2b4abea6ad546c4aa6c6efed (patch)
tree06ac242d395a6f203b2aa9afb679379c7937c27b
parentbot(lockfile): update c_sharp, erlang (diff)
downloadnvim-treesitter-5d1646893a01397f2b4abea6ad546c4aa6c6efed.tar
nvim-treesitter-5d1646893a01397f2b4abea6ad546c4aa6c6efed.tar.gz
nvim-treesitter-5d1646893a01397f2b4abea6ad546c4aa6c6efed.tar.bz2
nvim-treesitter-5d1646893a01397f2b4abea6ad546c4aa6c6efed.tar.lz
nvim-treesitter-5d1646893a01397f2b4abea6ad546c4aa6c6efed.tar.xz
nvim-treesitter-5d1646893a01397f2b4abea6ad546c4aa6c6efed.tar.zst
nvim-treesitter-5d1646893a01397f2b4abea6ad546c4aa6c6efed.zip
feat: editorconfig parser and queries
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-rw-r--r--queries/editorconfig/folds.scm1
-rw-r--r--queries/editorconfig/highlights.scm56
-rw-r--r--queries/editorconfig/injections.scm2
5 files changed, 70 insertions, 0 deletions
diff --git a/lockfile.json b/lockfile.json
index 87b8165f2..77f91f989 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -140,6 +140,9 @@
"ebnf": {
"revision": "8e635b0b723c620774dfb8abf382a7f531894b40"
},
+ "editorconfig": {
+ "revision": "aec8400b9554eae784125054ac4af7b767804844"
+ },
"eds": {
"revision": "0ad62cb635c2f4353359a88dec9e3a57bbf9f66d"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 5078a3e7d..14555c57a 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -469,6 +469,14 @@ list.ebnf = {
experimental = true,
}
+list.editorconfig = {
+ install_info = {
+ url = "https://github.com/ValdezFOmar/tree-sitter-editorconfig",
+ files = { "src/parser.c", "src/scanner.c" },
+ },
+ maintainers = { "@ValdezFOmar" },
+}
+
list.eds = {
install_info = {
url = "https://github.com/uyha/tree-sitter-eds",
diff --git a/queries/editorconfig/folds.scm b/queries/editorconfig/folds.scm
new file mode 100644
index 000000000..911798f5a
--- /dev/null
+++ b/queries/editorconfig/folds.scm
@@ -0,0 +1 @@
+(section) @fold
diff --git a/queries/editorconfig/highlights.scm b/queries/editorconfig/highlights.scm
new file mode 100644
index 000000000..fd69bc4c8
--- /dev/null
+++ b/queries/editorconfig/highlights.scm
@@ -0,0 +1,56 @@
+(comment) @comment @spell
+
+; consistency with toml and ini
+(section
+ (section_name) @type)
+
+(character_choice
+ (character) @constant)
+
+(character_range
+ start: (character) @constant
+ end: (character) @constant)
+
+[
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ ","
+ ".."
+ (path_separator)
+] @punctuation.delimiter
+
+[
+ "-"
+ "="
+ (negation)
+] @operator
+
+[
+ (wildcard_characters)
+ (wildcard_any_characters)
+ (wildcard_single_character)
+] @character.special
+
+(escaped_character) @string.escape
+
+(pair
+ key: (identifier) @property
+ value: (_) @string)
+
+(boolean) @boolean
+
+(integer) @number
+
+(unset) @constant.builtin
+
+[
+ (spelling_language)
+ (indent_style)
+ (end_of_line)
+ (charset)
+] @string.special
diff --git a/queries/editorconfig/injections.scm b/queries/editorconfig/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/queries/editorconfig/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))