aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2023-01-21 07:39:15 -0500
committerGitHub <noreply@github.com>2023-01-21 14:39:15 +0200
commit08e1adae538083cf541c201a49fe7602bf308d65 (patch)
tree5080773eb8993cb95908c4bc8e9af0be6a34be20
parentdocs: fix comment alignment (diff)
downloadnvim-treesitter-08e1adae538083cf541c201a49fe7602bf308d65.tar
nvim-treesitter-08e1adae538083cf541c201a49fe7602bf308d65.tar.gz
nvim-treesitter-08e1adae538083cf541c201a49fe7602bf308d65.tar.bz2
nvim-treesitter-08e1adae538083cf541c201a49fe7602bf308d65.tar.lz
nvim-treesitter-08e1adae538083cf541c201a49fe7602bf308d65.tar.xz
nvim-treesitter-08e1adae538083cf541c201a49fe7602bf308d65.tar.zst
nvim-treesitter-08e1adae538083cf541c201a49fe7602bf308d65.zip
feat: add thrift (#4185)
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua9
-rw-r--r--queries/thrift/highlights.scm144
4 files changed, 157 insertions, 0 deletions
diff --git a/README.md b/README.md
index 268e83a00..e8c3f64bc 100644
--- a/README.md
+++ b/README.md
@@ -299,6 +299,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) (maintained by @RaafatTurki)
- [x] [teal](https://github.com/euclidianAce/tree-sitter-teal) (maintained by @euclidianAce)
- [x] [terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann)
+- [x] [thrift](https://github.com/duskmoon314/tree-sitter-thrift) (maintained by @amaanq, @duskmoon314)
- [x] [tiger](https://github.com/ambroisie/tree-sitter-tiger) (maintained by @ambroisie)
- [x] [tlaplus](https://github.com/tlaplus-community/tree-sitter-tlaplus) (maintained by @ahelwer, @susliko)
- [x] [todotxt](https://github.com/arnarg/tree-sitter-todotxt.git) (experimental, maintained by @arnarg)
diff --git a/lockfile.json b/lockfile.json
index 0771add48..9ab60cc11 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -386,6 +386,9 @@
"terraform": {
"revision": "0ff887f2a60a147452d52db060de6b42f42f1441"
},
+ "thrift": {
+ "revision": "b49105758e3375f7f20781ba617493c1aac7d3c9"
+ },
"tiger": {
"revision": "a233ebe360a73a92c50978e5c4e9e471bc59ff42"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 5a9c9f0a7..91a48b96f 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1244,6 +1244,15 @@ list.v = {
maintainers = { "@kkharji" },
}
+list.thrift = {
+ install_info = {
+ url = "https://github.com/duskmoon314/tree-sitter-thrift",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@amaanq", "@duskmoon314" },
+ experimental = true,
+}
+
list.tiger = {
install_info = {
url = "https://github.com/ambroisie/tree-sitter-tiger",
diff --git a/queries/thrift/highlights.scm b/queries/thrift/highlights.scm
new file mode 100644
index 000000000..f585ec08a
--- /dev/null
+++ b/queries/thrift/highlights.scm
@@ -0,0 +1,144 @@
+; Namespace
+
+(namespace) @namespace
+
+; Includes
+
+[
+ "include"
+ "cpp_include"
+] @include
+
+(include_path) @string
+
+; Types
+
+(primitive_type) @type.builtin
+
+[
+ "list"
+ "map"
+ "set"
+] @type.builtin
+
+; Function
+
+(function) @function
+
+; Fields
+
+(field) @field
+
+; Parameters
+
+(parameter) @parameter
+
+; Variables
+
+(identifier) @variable
+
+; Operators
+
+[
+ "="
+ "+"
+ "-"
+ "&"
+] @operator
+
+; Exceptions
+
+[
+ (exception)
+ (throws)
+] @exception
+
+; Keywords
+
+[
+ "const"
+ "cpp_include"
+ "enum"
+ "exception"
+ "extends"
+ "include"
+ "namespace"
+ "oneway"
+ "optional"
+ "required"
+ "senum"
+ "service"
+ "struct"
+ "throws"
+ "typedef"
+ "union"
+ "void"
+] @keyword
+
+; Deprecated
+[
+ "async"
+ "byte"
+ "cocoa_prefix"
+ "cpp_namespace"
+ "csharp_namespace"
+ "delphi_namespace"
+ "java_package"
+ "perl_package"
+ "php_namespace"
+ "py_module"
+ "ruby_namespace"
+ "smalltalk_category"
+ "smalltalk_prefix"
+ "xsd_all"
+ "xsd_attrs"
+ "xsd_namespace"
+ "xsd_nillable"
+ "xsd_optional"
+] @keyword
+
+(namespace_scope) @keyword
+
+; Literals
+
+(string_literal) @string
+
+(number) @number
+
+(double) @float
+
+(boolean) @boolean
+
+(typedef_definition) @type.definition
+
+[
+ "const"
+] @type.qualifier
+
+[
+ "*"
+] @punctuation.special
+
+; Misc
+
+(field_modifier) @attribute
+
+["{" "}"] @punctuation.bracket
+
+["(" ")"] @punctuation.bracket
+
+["[" "]"] @punctuation.bracket
+
+[
+ ";"
+ ","
+ (list_separator)
+] @punctuation.delimiter
+
+; Errors
+
+(invalid) @error
+
+; Comments
+
+(comment) @comment @spell