diff options
author | pancake | 2022-05-28 19:46:10 +0000 |
---|---|---|
committer | GitHub | 2022-05-28 19:46:10 +0000 |
commit | 7706a4a0d8b67b943c31d0c5f7b00d357b5d838d (patch) | |
tree | 6187119a83bee752282c2a47f378c99a01f70d76 | |
parent | 7c107d0d3ac163139d9616cdbc4fb021cca6d20d (diff) |
Add Vlang tree-sitter in the languages.toml (#2526)
Co-authored-by: pancake <pancake@nopcode.org>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
-rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
-rw-r--r-- | languages.toml | 15 | ||||
-rw-r--r-- | runtime/queries/v/highlights.scm | 150 |
3 files changed, 166 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index e47ccbc4..c4e60245 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -89,6 +89,7 @@ | tsx | ✓ | | | `typescript-language-server` | | twig | ✓ | | | | | typescript | ✓ | | ✓ | `typescript-language-server` | +| v | ✓ | | | `vls` | | vala | ✓ | | | `vala-language-server` | | verilog | ✓ | ✓ | | `svlangserver` | | vue | ✓ | | | `vls` | diff --git a/languages.toml b/languages.toml index e2bf26bf..35c4b470 100644 --- a/languages.toml +++ b/languages.toml @@ -1382,6 +1382,21 @@ name = "scheme" source = { git = "https://github.com/6cdh/tree-sitter-scheme", rev = "27fb77db05f890c2823b4bd751c6420378df146b" } [[language]] +name = "v" +scope = "source.v" +file-types = ["v", "vv"] +shebangs = ["v run"] +roots = ["v.mod"] +language-server = { command = "vls", args = [] } +auto-format = true +comment-token = "//" +indent = { tab-width = 4, unit = "\t" } + +[[grammar]] +name = "v" +source = { git = "https://github.com/vlang/vls", subpath = "tree_sitter_v", rev = "3e8124ea4ab80aa08ec77f03df53f577902a0cdd" } + +[[language]] name = "verilog" scope = "source.verilog" file-types = ["v", "sv", "svh"] diff --git a/runtime/queries/v/highlights.scm b/runtime/queries/v/highlights.scm new file mode 100644 index 00000000..c71245dc --- /dev/null +++ b/runtime/queries/v/highlights.scm @@ -0,0 +1,150 @@ +(parameter_declaration + name: (identifier) @variable.parameter) +(function_declaration + name: (identifier) @function) +(function_declaration + receiver: (parameter_list) + name: (identifier) @function.method) + +(call_expression + function: (identifier) @function) +(call_expression + function: (selector_expression + field: (identifier) @function.method)) + +(field_identifier) @variable.other.member +(selector_expression + field: (identifier) @variable.other.member) + +(int_literal) @constant.numeric.integer +(interpreted_string_literal) @string +(rune_literal) @string +(escape_sequence) @constant.character.escape + +[ + (type_identifier) + (builtin_type) + (pointer_type) + (array_type) +] @type + +[ + (identifier) + (module_identifier) + (import_path) +] @variable + +[ + "as" + "asm" + "assert" + ;"atomic" + ;"break" + "const" + ;"continue" + "defer" + "else" + "enum" + "fn" + "for" + "$for" + "go" + "goto" + "if" + "$if" + "import" + "in" + "!in" + "interface" + "is" + "!is" + "lock" + "match" + "module" + "mut" + "or" + "pub" + "return" + "rlock" + "select" + ;"shared" + ;"static" + "struct" + "type" + ;"union" + "unsafe" +] @keyword + +[ + (true) + (false) +] @boolean + +[ + "." + "," + ":" + ";" +] @punctuation.delimiter + +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + +(array) @punctuation.bracket + +[ + "++" + "--" + + "+" + "-" + "*" + "/" + "%" + + "~" + "&" + "|" + "^" + + "!" + "&&" + "||" + "!=" + + "<<" + ">>" + + "<" + ">" + "<=" + ">=" + + "+=" + "-=" + "*=" + "/=" + "&=" + "|=" + "^=" + "<<=" + ">>=" + + "=" + ":=" + "==" + + "?" + "<-" + "$" + ".." + "..." +] @operator + +(comment) @comment
\ No newline at end of file |