diff options
| author | jirgn <jirgnmssnr@googlemail.com> | 2021-12-23 17:18:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-23 11:18:15 -0500 |
| commit | 6b5b37cc3ee2468beef1289980102fc3c4e06e2c (patch) | |
| tree | c31e69ca7784f856c751c6215b97a0946b22439d | |
| parent | Update queries (diff) | |
| download | nvim-treesitter-6b5b37cc3ee2468beef1289980102fc3c4e06e2c.tar nvim-treesitter-6b5b37cc3ee2468beef1289980102fc3c4e06e2c.tar.gz nvim-treesitter-6b5b37cc3ee2468beef1289980102fc3c4e06e2c.tar.bz2 nvim-treesitter-6b5b37cc3ee2468beef1289980102fc3c4e06e2c.tar.lz nvim-treesitter-6b5b37cc3ee2468beef1289980102fc3c4e06e2c.tar.xz nvim-treesitter-6b5b37cc3ee2468beef1289980102fc3c4e06e2c.tar.zst nvim-treesitter-6b5b37cc3ee2468beef1289980102fc3c4e06e2c.zip | |
update fusion to version 1.1.1 (#2148)
* feat(fusion): update tests
* fix(fusion): update lockfile
* fix(fusion): update to (highlight breaking) version 1.1.0
* update grammer to introduce afx support
* update tests and queries
* fix: revert lockfile update of unrelated grammars
* fix: update to 1.1.1 and fix hightlights
* fix: use @tag.attribute capture to match specs
Co-authored-by: Jirgn <jirgn76@googlemail.com>
| -rw-r--r-- | lockfile.json | 2 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 2 | ||||
| -rw-r--r-- | queries/fusion/highlights.scm | 69 | ||||
| -rw-r--r-- | tests/query/highlights/fusion/afx.fusion | 17 | ||||
| -rw-r--r-- | tests/query/highlights/fusion/basic.fusion | 1 | ||||
| -rw-r--r-- | tests/query/highlights/fusion/expressions.fusion | 8 |
6 files changed, 73 insertions, 26 deletions
diff --git a/lockfile.json b/lockfile.json index 955fe2c60..60fc818c3 100644 --- a/lockfile.json +++ b/lockfile.json @@ -69,7 +69,7 @@ "revision": "f0f2f100952a353e64e26b0fa710b4c296d7af13" }, "fusion": { - "revision": "f588d2cba166de2dbf5e2b7f848e7a2e82b803ce" + "revision": "016ce4a7695ebad5eeebfbe07525a2ec0639d78d" }, "gdscript": { "revision": "eed1595d830407b49775aa33b871a9400e5a44e6" diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 304166ef8..f5274b2ef 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -135,7 +135,7 @@ list.rust = { list.fusion = { install_info = { url = "https://gitlab.com/jirgn/tree-sitter-fusion.git", - files = { "src/parser.c" }, + files = { "src/parser.c", "src/scanner.c" }, branch = "main", }, maintainers = { "@jirgn" }, diff --git a/queries/fusion/highlights.scm b/queries/fusion/highlights.scm index ba655c0b5..b12eadccd 100644 --- a/queries/fusion/highlights.scm +++ b/queries/fusion/highlights.scm @@ -1,8 +1,25 @@ (comment) @comment +(afx_comment) @comment + +; identifiers afx +(afx_opening_element + (afx_identifier) @tag) +(afx_closing_element + (afx_identifier) @tag) +(afx_element_self_closing + (afx_identifier) @tag) + +(afx_attribute + (afx_property_identifier) @tag.attribute) ; identifiers eel (eel_object_path + (eel_path_identifier) @variable.builtin + (#match? @variable.builtin "^(this|props)$") +) + +(eel_object_path (eel_path_identifier) @variable) (eel_object_pair @@ -12,7 +29,6 @@ (eel_parameter) @variable - ; identifiers fusion ; ----------- @@ -38,38 +54,47 @@ ; tokens ; ------ +(afx_opening_element + [ + "<" + ">" + ] @punctuation.bracket) + + (afx_closing_element + [ + "<" + ">" + "/" + ] @punctuation.bracket) + +(afx_element_self_closing + [ + "<" + "/>" + ] @punctuation.bracket) [ (package_name) (alias_namespace) ] @namespace -[ - "=" - "<" - "&&" - "and" - "||" - "or" - "*" - "/" - "%" - "+" - "-" - "!" - "not" - (deletion) -] @operator +(namespace_declaration "=" @operator) +(assignment "=" @operator) +(copy "<" @operator) +(deletion) @operator +(eel_binary_expression + operator: _ @operator) +(eel_not_expression + [ + "!" + "not" + ] @operator) (string) @string (number) @number (boolean) @boolean (null) @constant.builtin - -; punctuation -; ---------- - [ "(" ")" @@ -84,5 +109,3 @@ "." "?" ] @punctuation.delimiter - - diff --git a/tests/query/highlights/fusion/afx.fusion b/tests/query/highlights/fusion/afx.fusion new file mode 100644 index 000000000..4ccb8174f --- /dev/null +++ b/tests/query/highlights/fusion/afx.fusion @@ -0,0 +1,17 @@ +property = afx` + <!-- some comment --> +<!-- ^@comment --> + + <div attribute="value">text</div> +<!-- ^@tag --> +<!-- ^@tag.attribute --> +<!-- ^@string --> +<!-- ^@punctuation.bracket --> +<!-- ^@tag --> + + <Namespace:Type {...spread} some={(a) => true} /> +<!-- ^@tag --> +<!-- ^@variable --> +<!-- ^@variable --> +<!-- ^@boolean --> +` diff --git a/tests/query/highlights/fusion/basic.fusion b/tests/query/highlights/fusion/basic.fusion index d2ee5a5b9..e4c4d6afc 100644 --- a/tests/query/highlights/fusion/basic.fusion +++ b/tests/query/highlights/fusion/basic.fusion @@ -1,6 +1,5 @@ include: SomeFile.fusion //<- include -// ^punctuation.delimiter // ^text.uri namespace: ns = Neos.Fusion.Space diff --git a/tests/query/highlights/fusion/expressions.fusion b/tests/query/highlights/fusion/expressions.fusion index 6646eadac..a0b82b511 100644 --- a/tests/query/highlights/fusion/expressions.fusion +++ b/tests/query/highlights/fusion/expressions.fusion @@ -23,6 +23,14 @@ propertyPath = ${property.path} // ^variable // ^variable +thisorProps = ${this.path} +// ^variable.builtin +// ^variable + +thisorProps = ${props.path} +// ^variable.builtin +// ^variable + array = ${[]} // ^punctuation.bracket |
