From 16af5ef490ff37407cc4241d7b8b8798d5b3a726 Mon Sep 17 00:00:00 2001 From: Teddytrombone Date: Tue, 24 Oct 2023 09:48:33 +0200 Subject: feat(typoscript) Added parser and queries for TypoScript (#5564) * Added configuration for TypoScript * Removed duplicated code; Applied folding suggestion * Applied suggestions * Update queries/typoscript/highlights.scm Co-authored-by: ObserverOfTime --------- Co-authored-by: ObserverOfTime --- lockfile.json | 3 +++ lua/nvim-treesitter/parsers.lua | 8 +++++++ queries/typoscript/folds.scm | 1 + queries/typoscript/highlights.scm | 46 +++++++++++++++++++++++++++++++++++++++ queries/typoscript/indents.scm | 5 +++++ queries/typoscript/injections.scm | 2 ++ 6 files changed, 65 insertions(+) create mode 100644 queries/typoscript/folds.scm create mode 100644 queries/typoscript/highlights.scm create mode 100644 queries/typoscript/indents.scm create mode 100644 queries/typoscript/injections.scm diff --git a/lockfile.json b/lockfile.json index a16b49b05..8d206fef4 100644 --- a/lockfile.json +++ b/lockfile.json @@ -638,6 +638,9 @@ "typescript": { "revision": "d847898fec3fe596798c9fda55cb8c05a799001a" }, + "typoscript": { + "revision": "43b221c0b76e77244efdaa9963e402a17c930fbc" + }, "ungrammar": { "revision": "debd26fed283d80456ebafa33a06957b0c52e451" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 3e4e39006..c9ba50b37 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1874,6 +1874,14 @@ list.typescript = { maintainers = { "@steelsojka" }, } +list.typoscript = { + install_info = { + url = "https://github.com/Teddytrombone/tree-sitter-typoscript", + files = { "src/parser.c" }, + }, + maintainers = { "@Teddytrombone" }, +} + list.ungrammar = { install_info = { url = "https://github.com/Philipp-M/tree-sitter-ungrammar", diff --git a/queries/typoscript/folds.scm b/queries/typoscript/folds.scm new file mode 100644 index 000000000..fd7d23999 --- /dev/null +++ b/queries/typoscript/folds.scm @@ -0,0 +1 @@ +(block) @fold diff --git a/queries/typoscript/highlights.scm b/queries/typoscript/highlights.scm new file mode 100644 index 000000000..9ce80c680 --- /dev/null +++ b/queries/typoscript/highlights.scm @@ -0,0 +1,46 @@ +(identifier) @field + +(constant) @constant + +(modifier_function) @function +(modifier_predefined) @function.builtin + +[ + (condition) + (condition_end) + (condition_else) +] @conditional + +(cobject) @type.builtin + +[ + "@import" + "INCLUDE_TYPOSCRIPT" +] @include + +[ + (comment) + (single_line_comment) +] @comment @spell + +[ + (string) + (multiline_value) +] @string + +[ + "=" + ">" + "<" + ":=" + "=<" + (condition_bool) +] @operator + +"," @punctuation.delimiter + +[ + "(" + ")" + (block_punctuation) + ] @punctuation.bracket diff --git a/queries/typoscript/indents.scm b/queries/typoscript/indents.scm new file mode 100644 index 000000000..f3d15b720 --- /dev/null +++ b/queries/typoscript/indents.scm @@ -0,0 +1,5 @@ +(block) @indent.begin + +"}" @indent.branch @indent.end + +(comment) @indent.ignore diff --git a/queries/typoscript/injections.scm b/queries/typoscript/injections.scm new file mode 100644 index 000000000..6adae45a2 --- /dev/null +++ b/queries/typoscript/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) -- cgit v1.2.3-70-g09d2