diff options
| -rw-r--r-- | SUPPORTED_LANGUAGES.md | 1 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 26 | ||||
| -rw-r--r-- | runtime/queries/bpftrace/highlights.scm | 228 | ||||
| -rw-r--r-- | runtime/queries/bpftrace/injections.scm | 12 | ||||
| -rw-r--r-- | runtime/queries/html_tags/highlights.scm | 6 | ||||
| -rw-r--r-- | runtime/queries/kos/highlights.scm | 17 | ||||
| -rw-r--r-- | runtime/queries/usd/highlights.scm | 2 | ||||
| -rw-r--r-- | scripts/minimal_init.lua | 1 | ||||
| -rw-r--r-- | tests/query/highlights/kos/test.kos | 40 | ||||
| -rw-r--r-- | tests/query/highlights/usd/prims.usda | 2 |
10 files changed, 319 insertions, 16 deletions
diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 153483006..59be83a32 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -28,6 +28,7 @@ Language | Tier | Queries | Maintainer [bitbake](https://github.com/tree-sitter-grammars/tree-sitter-bitbake) | unstable | `HFIJL` | @amaanq [blade](https://github.com/EmranMR/tree-sitter-blade) | unstable | `HFIJ ` | @calebdw [bp](https://github.com/ambroisie/tree-sitter-bp)[^bp] | unstable | `HFIJL` | @ambroisie +[bpftrace](https://github.com/sgruszka/tree-sitter-bpftrace) | unstable | `H J ` | @sgruszka [brightscript](https://github.com/ajdelcimmuto/tree-sitter-brightscript) | unstable | `HFIJ ` | @ajdelcimmuto [c](https://github.com/tree-sitter/tree-sitter-c) | unstable | `HFIJL` | @amaanq [c3](https://github.com/c3lang/tree-sitter-c3) | unstable | `HFIJ ` | @cbuttner diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index b7037d245..1bee7e59b 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -93,7 +93,7 @@ return { }, beancount = { install_info = { - revision = '653cce316fbff8d212a2488ae13df648efb542a4', + revision = '23b21252da8b8cb0f03d1d1fc4c8f87d407e1cdf', url = 'https://github.com/polarmutex/tree-sitter-beancount', }, maintainers = { '@polarmutex' }, @@ -140,6 +140,14 @@ return { readme_note = 'Android Blueprint', tier = 2, }, + bpftrace = { + install_info = { + revision = 'dee4269b564fdf7071ee454e873767fd334f79ae', + url = 'https://github.com/sgruszka/tree-sitter-bpftrace', + }, + maintainers = { '@sgruszka' }, + tier = 2, + }, brightscript = { install_info = { revision = '253fdfaa23814cb46c2d5fc19049fa0f2f62c6da', @@ -158,7 +166,7 @@ return { }, c3 = { install_info = { - revision = '805f776dcfbfef5c9baf4270ec942b3e8dc7ff16', + revision = '2c04e7858d63497152d42f08d3067972618aeedc', url = 'https://github.com/c3lang/tree-sitter-c3', }, maintainers = { '@cbuttner' }, @@ -584,7 +592,7 @@ return { }, fortran = { install_info = { - revision = 'e0132896b8959c09dc20b56e4a1c5d25bc341697', + revision = '589151aab08fdd7404678330e8abacf9b78bb595', url = 'https://github.com/stadelmanma/tree-sitter-fortran', }, maintainers = { '@amaanq' }, @@ -692,7 +700,7 @@ return { }, gleam = { install_info = { - revision = '0c0c63a07998767b22f0d2655f903611eca6acd0', + revision = 'dd4e328c5fd5f158d47a22339d8ce0f8be918a0b', url = 'https://github.com/gleam-lang/tree-sitter-gleam', }, maintainers = { '@amaanq' }, @@ -1025,7 +1033,7 @@ return { }, inko = { install_info = { - revision = 'v0.4.0', + revision = 'v0.5.1', url = 'https://github.com/inko-lang/tree-sitter-inko', }, maintainers = { '@yorickpeterse' }, @@ -1189,7 +1197,7 @@ return { }, kos = { install_info = { - revision = '5f11d41b3150b0837e8b3964151ebb7fc4f367e9', + revision = '03b261c1a78b71c38cf4616497f253c4a4ce118b', url = 'https://github.com/kos-lang/tree-sitter-kos', }, maintainers = { '@cdragan' }, @@ -1286,7 +1294,7 @@ return { }, lua = { install_info = { - revision = 'e284fcec45ead0d477e326fccd2cd4a68a89dae4', + revision = 'de08dfd9640604763558530d2ce703cbe6a16bb6', url = 'https://github.com/tree-sitter-grammars/tree-sitter-lua', }, maintainers = { '@muniftanjim' }, @@ -1389,7 +1397,7 @@ return { mlir = { install_info = { generate = true, - revision = 'c7eec06be8a9ddae688e1b03fca2eed79e9801c4', + revision = '9edc9201736c5a471314b4e28c20d0f0b4642b6f', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -2131,7 +2139,7 @@ return { sql = { install_info = { branch = 'gh-pages', - revision = '2d5dcd16f9ee49cb5a6d99eabb00fd4ea298587f', + revision = '5129061608da71146c813e13c32a54f4b13645c8', url = 'https://github.com/derekstride/tree-sitter-sql', }, maintainers = { '@derekstride' }, diff --git a/runtime/queries/bpftrace/highlights.scm b/runtime/queries/bpftrace/highlights.scm new file mode 100644 index 000000000..30a489537 --- /dev/null +++ b/runtime/queries/bpftrace/highlights.scm @@ -0,0 +1,228 @@ +; Comments +[ + (line_comment) + (block_comment) +] @comment @spell + +; String and numeric literals +(string_literal) @string + +(escape_sequence) @string.escape + +(integer_literal) @number + +(boolean_literal) @boolean + +; Variables +(identifier) @variable + +(args_keyword) @variable.builtin + +((identifier) @variable.builtin + (#lua-match? @variable.builtin "^arg[0-9]+$")) + +(scratch_variable) @variable + +(map_variable) @variable + +(script_parameter) @variable.parameter + +; Macro +(macro_definition + (identifier) @function.macro) + +; Probes +; fentry/fexit, kprobe/kretprobe, rawtracepoint +(probe + provider: (_) @type.builtin + module: (wildcard_identifier) @module + function: (wildcard_identifier) @property) + +(probe + provider: (_) @type.builtin + function: (wildcard_identifier) @property) + +; uprobe/uretprobe +(probe + provider: (uprobe_uretprobe_provider) @type.builtin + binary: (file_identifier) @string.special.path + function: (identifier) @property) + +; tracepoint +(probe + provider: (_) @type.builtin + subsys: (wildcard_identifier) @module + event: (wildcard_identifier) @property) + +; software/hardware +(probe + provider: (_) @type.builtin + event: (identifier_with_dash) @property + count: (integer_literal) @number) + +(probe + provider: (_) @type.builtin + event: (identifier_with_dash) @property) + +; bench/test +(probe + provider: (bench_test_provider) @type.builtin + function: (identifier) @property) + +; profile/interval +(probe + provider: (profile_interval_provider) @type.builtin + unit: (time_unit) @string.special + count: (integer_literal) @property) + +(probe + provider: (profile_interval_provider) @type.builtin + count: (integer_literal) @number) + +; iter +(probe + provider: (iter_provider) @type.builtin + object: (identifier) @module + pin: (file_identifier) @property) + +(probe + provider: (iter_provider) @type.builtin + object: (identifier) @module) + +; ustd +(probe + provider: (ustd_provider) @type.builtin + binary: (file_identifier) @string.special.path + namespace: (identifier) @variable + function: (identifier) @property) + +(probe + provider: (ustd_provider) @type.builtin + binary: (file_identifier) @string.special.path + function: (identifier) @property) + +; watchpoint/asyncwatchpoint +(probe + provider: (watchpoint_provider) @type.builtin + address: (integer_literal) @number + length: (integer_literal) @number + mode: (watchpoint_mode) @property) + +; Types +(type_specifier) @type + +(integer_type) @type.builtin + +[ + "BEGIN" + "begin" + "END" + "end" +] @type.builtin + +; Keywords +(hashbang) @keyword.directive + +(return_statement) @keyword.return + +[ + "config" + "let" + "macro" + "offsetof" + "sizeof" +] @keyword + +[ + "if" + "else" +] @keyword.conditional + +[ + "for" + "unroll" + "while" + (break_statement) + (continue_statement) +] @keyword.repeat + +"import" @keyword.import + +(field_expression + field: (identifier) @property) + +(call_expression + function: (identifier) @function.call) + +; Punctuations +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "," + ";" + ":" + "." +] @punctuation.delimiter + +; Operators +[ + ; Field access + "->" + ; Range + ".." + ; Assignment + "=" + "<<=" + ">>=" + "+=" + "-=" + "*=" + "/=" + "%=" + "&=" + "|=" + "^=" + ; Update + "--" + "++" + ; Arithmetic + "%" + "+" + "-" + "*" + "/" + ; Relational + "<=" + "<" + ">=" + ">" + "==" + "!=" + ; Bitwise + "&" + "^" + "|" + "~" + "<<" + ">>" + ; Logical + "&&" + "||" + "!" +] @operator + +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(predicate + "/" @punctuation.delimiter) diff --git a/runtime/queries/bpftrace/injections.scm b/runtime/queries/bpftrace/injections.scm new file mode 100644 index 000000000..8907d9f84 --- /dev/null +++ b/runtime/queries/bpftrace/injections.scm @@ -0,0 +1,12 @@ +([ + (c_struct) + (c_preproc) + (c_preproc_block) +] @injection.content + (#set! injection.language "c")) + +([ + (line_comment) + (block_comment) +] @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/html_tags/highlights.scm b/runtime/queries/html_tags/highlights.scm index 9eaf813be..94a338aa7 100644 --- a/runtime/queries/html_tags/highlights.scm +++ b/runtime/queries/html_tags/highlights.scm @@ -1,9 +1,11 @@ -(tag_name) @tag +(tag_name) @tag @nospell ; (erroneous_end_tag_name) @error ; we do not lint syntax errors (comment) @comment @spell -(attribute_name) @tag.attribute +(attribute_name) @tag.attribute @nospell + +(attribute_value) @nospell ((attribute (quoted_attribute_value) @string) diff --git a/runtime/queries/kos/highlights.scm b/runtime/queries/kos/highlights.scm index 0942b2b89..07757d2e3 100644 --- a/runtime/queries/kos/highlights.scm +++ b/runtime/queries/kos/highlights.scm @@ -4,8 +4,13 @@ (number) @number +(float_number) @number.float + (identifier) @variable +(parameter + parameter: (identifier) @variable.parameter) + (property_identifier) @property [ @@ -57,8 +62,9 @@ "=>" ] @keyword.function +"_" @character.special + [ - "_" (line) "assert" ;"async" @@ -96,6 +102,15 @@ "}" ] @punctuation.bracket +(string_literal_begin + "\\(" @punctuation.special) + +(string_literal_continuation + "\\(" @punctuation.special) + +(formatted_string + ")" @punctuation.special) + [ ";" ":" diff --git a/runtime/queries/usd/highlights.scm b/runtime/queries/usd/highlights.scm index d6c2a3668..98a7ff95c 100644 --- a/runtime/queries/usd/highlights.scm +++ b/runtime/queries/usd/highlights.scm @@ -52,12 +52,14 @@ "]" "{" "}" + "[]" ] @punctuation.bracket [ ":" ";" "." + "," ] @punctuation.delimiter "=" @operator diff --git a/scripts/minimal_init.lua b/scripts/minimal_init.lua index 4a5e14f16..a90f56004 100644 --- a/scripts/minimal_init.lua +++ b/scripts/minimal_init.lua @@ -7,7 +7,6 @@ vim.cmd.runtime({ 'plugin/filetypes.lua', bang = true }) vim.filetype.add({ extension = { conf = 'hocon', - ncl = 'nickel', tig = 'tiger', w = 'wing', }, diff --git a/tests/query/highlights/kos/test.kos b/tests/query/highlights/kos/test.kos index 981fdb313..4e1b0ec6d 100644 --- a/tests/query/highlights/kos/test.kos +++ b/tests/query/highlights/kos/test.kos @@ -21,15 +21,15 @@ fun name(arg1, # ^ keyword.function # ^ function # ^ punctuation.bracket -# ^ variable +# ^ variable.parameter # ^ punctuation.delimiter arg2 = "default", -# ^ variable +# ^ variable.parameter # ^ operator # ^ string # ^ punctuation.delimiter arg3...) -# ^ variable +# ^ variable.parameter # ^ operator # ^ punctuation.bracket { @@ -147,3 +147,37 @@ name.name() # ^ function.method.call # ^ punctuation.bracket # ^ punctuation.bracket + +print("hello \(123 + var) world \(true)") +# <- function.call +# ^ punctuation.bracket +# ^ string +# ^ punctuation.special +# ^ number +# ^ operator +# ^ variable +# ^ punctuation.special +# ^ string +# ^ punctuation.special +# ^ boolean +# ^ punctuation.special +# ^ punctuation.bracket + +[] -> each((x,_,y) => x + y) +# <- punctuation.bracket +#^ punctuation.bracket +# ^ operator +# ^ function.call +# ^ punctuation.bracket +# ^ punctuation.bracket +# ^ variable.parameter +# ^ punctuation.delimiter +# ^ character.special +# ^ punctuation.delimiter +# ^ variable.parameter +# ^ punctuation.bracket +# ^ keyword.function +# ^ variable +# ^ operator +# ^ variable +# ^ punctuation.bracket diff --git a/tests/query/highlights/usd/prims.usda b/tests/query/highlights/usd/prims.usda index da9a5d6fe..dcb6c3b59 100644 --- a/tests/query/highlights/usd/prims.usda +++ b/tests/query/highlights/usd/prims.usda @@ -3,8 +3,10 @@ def Xform "cube" ( # <- @keyword asset[] payloadAssetDependencies = [@fizz.usd@, @buzz.usd@] # <- @type + # ^ @punctuation.bracket # ^ @keyword # ^ @string.special.url + # ^ @punctuation.delimiter # ^ @string.special.url } ) |
