From 907437d16bc2ea028af6d8d82368c9ad6af4649d Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 24 May 2022 18:49:26 +0200 Subject: [PATCH] Rename vlang to v and add highlights.scm --- languages.toml | 6 +- runtime/queries/v/highlights.scm | 147 +++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 runtime/queries/v/highlights.scm diff --git a/languages.toml b/languages.toml index 3ef0e997695a5..353c334d00a7e 100644 --- a/languages.toml +++ b/languages.toml @@ -1382,8 +1382,8 @@ name = "scheme" source = { git = "https://github.com/6cdh/tree-sitter-scheme", rev = "27fb77db05f890c2823b4bd751c6420378df146b" } [[language]] -name = "vlang" -scope = "source.vlang" +name = "v" +scope = "source.v" file-types = ["v", "vv"] shebangs = ["v run"] roots = [] @@ -1391,5 +1391,5 @@ comment-token = "//" indent = { tab-width = 2, unit = " " } [[grammar]] -name = "vlang" +name = "v" source = { git = "https://github.com/vlang/vls", subpath = "tree_sitter_v", rev = "3e8124ea4ab80aa08ec77f03df53f577902a0cdd" } diff --git a/runtime/queries/v/highlights.scm b/runtime/queries/v/highlights.scm new file mode 100644 index 0000000000000..dbd0162516114 --- /dev/null +++ b/runtime/queries/v/highlights.scm @@ -0,0 +1,147 @@ +(ERROR) @error +(comment) @comment + +(identifier) @variable +(module_identifier) @variable +(import_path) @variable + +(parameter_declaration + name: (identifier) @parameter) +(function_declaration + name: (identifier) @function) +(function_declaration + receiver: (parameter_list) + name: (identifier) @method) + +(call_expression + function: (identifier) @function) +(call_expression + function: (selector_expression + field: (identifier) @method)) + +(type_identifier) @type +(builtin_type) @type +(pointer_type) @type +(array_type) @type + +(field_identifier) @property +(selector_expression + field: (identifier) @property) + +(int_literal) @number +(interpreted_string_literal) @string +(rune_literal) @string +(escape_sequence) @string.escape + +[ + "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