From 629cae1f0fd0c18b4b8b203299d8b15378c6b860 Mon Sep 17 00:00:00 2001 From: Willem-J-an <51120533+Willem-J-an@users.noreply.github.com> Date: Wed, 8 Nov 2023 10:11:19 +0100 Subject: [PATCH] feat(kusto): add kusto parser and highlights (#5632) * feat(kusto): add kusto parser and highlights * feat(kusto): improve highlights * Update queries/kusto/highlights.scm Co-authored-by: ObserverOfTime * chore(kusto): remove unneeded filetype --------- Co-authored-by: Willem Jan Noort Co-authored-by: ObserverOfTime --- lockfile.json | 3 ++ lua/nvim-treesitter/parsers.lua | 8 +++++ queries/kusto/highlights.scm | 52 +++++++++++++++++++++++++++++++++ queries/kusto/injections.scm | 2 ++ 4 files changed, 65 insertions(+) create mode 100644 queries/kusto/highlights.scm create mode 100644 queries/kusto/injections.scm diff --git a/lockfile.json b/lockfile.json index 718450e15..0f623b2a9 100644 --- a/lockfile.json +++ b/lockfile.json @@ -317,6 +317,9 @@ "kotlin": { "revision": "494fb7644a9d2bbe4c7a0c5db2ef94d2aad6b0d8" }, + "kusto": { + "revision": "8353a1296607d6ba33db7c7e312226e5fc83e8ce" + }, "lalrpop": { "revision": "06ae1b6c26e23c77c7fb86d51dddad62b42e66b0" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 17e59046a..9c4ac31f9 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -968,6 +968,14 @@ list.kotlin = { maintainers = { "@SalBakraa" }, } +list.kusto = { + install_info = { + url = "https://github.com/Willem-J-an/tree-sitter-kusto", + files = { "src/parser.c" }, + }, + maintainers = { "@Willem-J-an" }, +} + list.lalrpop = { install_info = { url = "https://github.com/traxys/tree-sitter-lalrpop", diff --git a/queries/kusto/highlights.scm b/queries/kusto/highlights.scm new file mode 100644 index 000000000..825f49b35 --- /dev/null +++ b/queries/kusto/highlights.scm @@ -0,0 +1,52 @@ +(identifier) @variable + +(let_keyword) @keyword + +(function_call + (identifier) @function.call) +[ + (type_cast_function) + (to_scalar_function) + (between_function) + (datatable_function) +] @function.call + +(typed_parameter + (identifier) @parameter) +(function_arguments (identifier) @parameter) + +[ + (binary_operator) + (compound_keywords) + (operator) + (range_operator) + (join_operator) + (sub_operator) + (to_operator) + (mv_apply_operator) + (sort_keyword) +] @keyword.operator + +(string) @string +(number) @number +(bool) @boolean +(null) @constant.builtin +(comment) @comment @spell + +(type) @type +(join_types) @type.qualifier + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "," + ":" + (pipe) +] @punctuation.delimiter diff --git a/queries/kusto/injections.scm b/queries/kusto/injections.scm new file mode 100644 index 000000000..321c90add --- /dev/null +++ b/queries/kusto/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment"))