mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 18:00:07 -04:00
feat: add fusion grammar and highlights
This commit is contained in:
parent
fbbcfa7b6c
commit
91b15aa39b
7 changed files with 235 additions and 0 deletions
|
|
@ -172,6 +172,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||||
- [x] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD)
|
- [x] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD)
|
||||||
- [x] [fish](https://github.com/ram02z/tree-sitter-fish) (maintained by @ram02z)
|
- [x] [fish](https://github.com/ram02z/tree-sitter-fish) (maintained by @ram02z)
|
||||||
- [ ] [fortran](https://github.com/stadelmanma/tree-sitter-fortran)
|
- [ ] [fortran](https://github.com/stadelmanma/tree-sitter-fortran)
|
||||||
|
- [ ] [neos fusion](https://gitlab.com/jirgn/tree-sitter-fusion)(experimental, maintained by @jirgn)
|
||||||
- [x] [Godot (gdscript)](https://github.com/PrestonKnopp/tree-sitter-gdscript) (maintained by @Shatur95)
|
- [x] [Godot (gdscript)](https://github.com/PrestonKnopp/tree-sitter-gdscript) (maintained by @Shatur95)
|
||||||
- [x] [Glimmer and Ember](https://github.com/alexlafroscia/tree-sitter-glimmer) (maintained by @alexlafroscia)
|
- [x] [Glimmer and Ember](https://github.com/alexlafroscia/tree-sitter-glimmer) (maintained by @alexlafroscia)
|
||||||
- [x] [glsl](https://github.com/theHamsta/tree-sitter-glsl) (maintained by @theHamsta)
|
- [x] [glsl](https://github.com/theHamsta/tree-sitter-glsl) (maintained by @theHamsta)
|
||||||
|
|
|
||||||
1
ftdetect/fusion.vim
Normal file
1
ftdetect/fusion.vim
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
autocmd BufRead,BufNewFile *.fusion setfiletype fusion
|
||||||
|
|
@ -131,6 +131,14 @@ list.rust = {
|
||||||
maintainers = { "@vigoux" },
|
maintainers = { "@vigoux" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.fusion = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://gitlab.com/jirgn/tree-sitter-fusion",
|
||||||
|
files = { "src/parser.c"},
|
||||||
|
},
|
||||||
|
maintainers = { "@jirgn" },
|
||||||
|
}
|
||||||
|
|
||||||
list.ledger = {
|
list.ledger = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/cbarrete/tree-sitter-ledger",
|
url = "https://github.com/cbarrete/tree-sitter-ledger",
|
||||||
|
|
|
||||||
87
queries/fusion/highlights.scm
Normal file
87
queries/fusion/highlights.scm
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
; identifiers eel
|
||||||
|
|
||||||
|
(eel_object_path
|
||||||
|
(eel_path_identifier) @variable)
|
||||||
|
|
||||||
|
(eel_object_pair
|
||||||
|
key: (eel_property_name) @property)
|
||||||
|
|
||||||
|
(eel_method_name) @function
|
||||||
|
|
||||||
|
(eel_parameter) @variable
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; identifiers fusion
|
||||||
|
; -----------
|
||||||
|
|
||||||
|
(path_part) @property
|
||||||
|
(meta_property) @attribute
|
||||||
|
(prototype_signature
|
||||||
|
"prototype" @keyword
|
||||||
|
|
||||||
|
)
|
||||||
|
(include_statement
|
||||||
|
"include" @include
|
||||||
|
":" @punctation.delimiter
|
||||||
|
(source_file) @uri
|
||||||
|
)
|
||||||
|
|
||||||
|
(namespace_declaration
|
||||||
|
"namespace" @keyword
|
||||||
|
(alias_namespace) @namespace)
|
||||||
|
|
||||||
|
(identifier_type
|
||||||
|
name: (type_name) @type)
|
||||||
|
|
||||||
|
; tokens
|
||||||
|
; ------
|
||||||
|
|
||||||
|
[
|
||||||
|
(identifier_package)
|
||||||
|
(alias_namespace)
|
||||||
|
] @namespace
|
||||||
|
|
||||||
|
[
|
||||||
|
"="
|
||||||
|
"<"
|
||||||
|
"&&"
|
||||||
|
"and"
|
||||||
|
"||"
|
||||||
|
"or"
|
||||||
|
"*"
|
||||||
|
"/"
|
||||||
|
"%"
|
||||||
|
"+"
|
||||||
|
"-"
|
||||||
|
"!"
|
||||||
|
"not"
|
||||||
|
(deletion)
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
(string) @string
|
||||||
|
(number) @number
|
||||||
|
(boolean) @boolean
|
||||||
|
(null) @constant.builtin
|
||||||
|
|
||||||
|
|
||||||
|
; punctation
|
||||||
|
; ----------
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
":"
|
||||||
|
"."
|
||||||
|
"?"
|
||||||
|
] @punctation.delimiter
|
||||||
|
|
||||||
3
queries/fusion/locals.scm
Normal file
3
queries/fusion/locals.scm
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
(eel_arrow_function) @local.scope
|
||||||
|
|
||||||
|
(eel_parameter) @local.definition
|
||||||
61
tests/query/highlights/fusion/basic.fusion
Normal file
61
tests/query/highlights/fusion/basic.fusion
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
include: SomeFile.fusion
|
||||||
|
//<- include
|
||||||
|
// ^punctation.delimiter
|
||||||
|
// ^uri
|
||||||
|
|
||||||
|
namespace ns = Neos.Fusion.Space
|
||||||
|
//<- keyword
|
||||||
|
// ^namespace
|
||||||
|
// ^operator
|
||||||
|
// ^namespace
|
||||||
|
|
||||||
|
prototype(MyType) < prototype(ns:SuperType) {
|
||||||
|
//<-keyword
|
||||||
|
// ^punctation.bracket
|
||||||
|
// ^type
|
||||||
|
// ^punctation.bracket
|
||||||
|
// ^operator
|
||||||
|
// ^namespace
|
||||||
|
// ^type
|
||||||
|
|
||||||
|
deleteProp >
|
||||||
|
// ^operator
|
||||||
|
|
||||||
|
string = 'value'
|
||||||
|
//<- property
|
||||||
|
// ^operator
|
||||||
|
// ^string
|
||||||
|
|
||||||
|
number = 10.2
|
||||||
|
// ^number
|
||||||
|
|
||||||
|
null = null
|
||||||
|
// ^constant.builtin
|
||||||
|
|
||||||
|
boolean = true
|
||||||
|
// ^boolean
|
||||||
|
|
||||||
|
property.inner = "value"
|
||||||
|
//<- property
|
||||||
|
// ^property
|
||||||
|
|
||||||
|
property.@meta = "value"
|
||||||
|
//<- property
|
||||||
|
// ^attribute
|
||||||
|
|
||||||
|
property.type = SomeType
|
||||||
|
//<- property
|
||||||
|
// ^type
|
||||||
|
|
||||||
|
property.aliasedType = ns:SomeType
|
||||||
|
//<- property
|
||||||
|
// ^namespace
|
||||||
|
// ^type
|
||||||
|
|
||||||
|
property.fullQualifiedType = SomeNamespace:SomeType
|
||||||
|
//<- property
|
||||||
|
// ^namespace
|
||||||
|
// ^type
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
74
tests/query/highlights/fusion/expressions.fusion
Normal file
74
tests/query/highlights/fusion/expressions.fusion
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
string = ${'foo'}
|
||||||
|
// ^string
|
||||||
|
|
||||||
|
string = ${'foo \'bar\' baz'}
|
||||||
|
// ^string
|
||||||
|
|
||||||
|
string = ${"foo"}
|
||||||
|
// ^string
|
||||||
|
|
||||||
|
string = ${"foo ${test}"}
|
||||||
|
// ^string
|
||||||
|
|
||||||
|
boolean = ${true}
|
||||||
|
// ^boolean
|
||||||
|
|
||||||
|
number = ${1}
|
||||||
|
// ^number
|
||||||
|
|
||||||
|
number = ${1.2}
|
||||||
|
// ^number
|
||||||
|
|
||||||
|
propertyPath = ${property.path}
|
||||||
|
// ^variable
|
||||||
|
// ^variable
|
||||||
|
|
||||||
|
array = ${[]}
|
||||||
|
// ^punctation.bracket
|
||||||
|
|
||||||
|
array = ${[true, 'string', 1, [true]]}
|
||||||
|
// ^punctation.bracket
|
||||||
|
// ^boolean
|
||||||
|
// ^string
|
||||||
|
// ^number
|
||||||
|
// ^punctation.bracket
|
||||||
|
// ^boolean
|
||||||
|
|
||||||
|
object = ${{}}
|
||||||
|
// ^punctation.bracket
|
||||||
|
|
||||||
|
object = ${{first: 'value', second: true, third: [], fourth: object.path }}
|
||||||
|
// ^property
|
||||||
|
// ^string
|
||||||
|
// ^property
|
||||||
|
// ^boolean
|
||||||
|
// ^property
|
||||||
|
// ^punctation.bracket
|
||||||
|
// ^property
|
||||||
|
// ^variable
|
||||||
|
|
||||||
|
result = ${methodCall()}
|
||||||
|
// ^function
|
||||||
|
|
||||||
|
result = ${Some.methodCall(param, param)}
|
||||||
|
// ^function
|
||||||
|
// ^variable
|
||||||
|
// ^variable
|
||||||
|
|
||||||
|
arrowFunction = ${map(foo, (bar, buz) => bar * buz)}
|
||||||
|
// ^function
|
||||||
|
// ^variable
|
||||||
|
// ^variable
|
||||||
|
|
||||||
|
logic = ${!foo && !(bar || baz) and not 'string'}
|
||||||
|
// ^operator
|
||||||
|
// ^operator
|
||||||
|
// ^operator
|
||||||
|
// ^operator
|
||||||
|
// ^operator
|
||||||
|
|
||||||
|
ternary = ${ check ? true : false}
|
||||||
|
// ^punctation.delimiter
|
||||||
|
// ^punctation.delimiter
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue