mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-13 17:00:09 -04:00
add qmljs (#3126)
This commit is contained in:
parent
d4f0c46e0f
commit
4b5966c81a
3 changed files with 143 additions and 1 deletions
|
|
@ -239,6 +239,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||||
- [x] [pug](https://github.com/zealot128/tree-sitter-pug) (maintained by @zealot128)
|
- [x] [pug](https://github.com/zealot128/tree-sitter-pug) (maintained by @zealot128)
|
||||||
- [x] [python](https://github.com/tree-sitter/tree-sitter-python) (maintained by @stsewd, @theHamsta)
|
- [x] [python](https://github.com/tree-sitter/tree-sitter-python) (maintained by @stsewd, @theHamsta)
|
||||||
- [x] [ql](https://github.com/tree-sitter/tree-sitter-ql) (maintained by @pwntester)
|
- [x] [ql](https://github.com/tree-sitter/tree-sitter-ql) (maintained by @pwntester)
|
||||||
|
- [x] [qmljs](https://github.com/yuja/tree-sitter-qmljs) (maintained by @yuja)
|
||||||
- [x] [Tree-sitter query language](https://github.com/nvim-treesitter/tree-sitter-query) (maintained by @steelsojka)
|
- [x] [Tree-sitter query language](https://github.com/nvim-treesitter/tree-sitter-query) (maintained by @steelsojka)
|
||||||
- [x] [r](https://github.com/r-lib/tree-sitter-r) (maintained by @jimhester)
|
- [x] [r](https://github.com/r-lib/tree-sitter-r) (maintained by @jimhester)
|
||||||
- [x] [rasi](https://github.com/Fymyte/tree-sitter-rasi) (maintained by @Fymyte)
|
- [x] [rasi](https://github.com/Fymyte/tree-sitter-rasi) (maintained by @Fymyte)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,15 @@ local list = setmetatable({}, {
|
||||||
filetype_to_parsername[parserconfig.filetype or parsername] = parsername
|
filetype_to_parsername[parserconfig.filetype or parsername] = parsername
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
list.qmljs = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/yuja/tree-sitter-qmljs",
|
||||||
|
branch = "master",
|
||||||
|
files = { "src/parser.c", "src/scanner.c" },
|
||||||
|
},
|
||||||
|
filetype = "qmljs",
|
||||||
|
maintainers = { "@yuja" },
|
||||||
|
}
|
||||||
list.scheme = {
|
list.scheme = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/6cdh/tree-sitter-scheme",
|
url = "https://github.com/6cdh/tree-sitter-scheme",
|
||||||
|
|
|
||||||
133
queries/qmljs/highlights.scm
Normal file
133
queries/qmljs/highlights.scm
Normal file
|
|
@ -0,0 +1,133 @@
|
||||||
|
; inherits: ecma
|
||||||
|
|
||||||
|
;;; Annotations
|
||||||
|
|
||||||
|
(ui_annotation
|
||||||
|
"@" @operator
|
||||||
|
type_name: [
|
||||||
|
(identifier) @attribute
|
||||||
|
(nested_identifier (identifier) @attribute)
|
||||||
|
])
|
||||||
|
|
||||||
|
;; type
|
||||||
|
(ui_property
|
||||||
|
type: (type_identifier) @type)
|
||||||
|
|
||||||
|
;;; Properties
|
||||||
|
|
||||||
|
(ui_object_definition_binding
|
||||||
|
name: [
|
||||||
|
(identifier) @property
|
||||||
|
(nested_identifier (identifier) @property)
|
||||||
|
])
|
||||||
|
|
||||||
|
(ui_binding
|
||||||
|
name: [
|
||||||
|
(identifier) @property
|
||||||
|
(nested_identifier (identifier) @property)
|
||||||
|
])
|
||||||
|
|
||||||
|
;; locals query appears not working unless id: <ref> isn't a parameter.
|
||||||
|
(ui_binding
|
||||||
|
name: (identifier) @property
|
||||||
|
(#eq? @property "id")
|
||||||
|
value: (expression_statement (identifier) @variable))
|
||||||
|
|
||||||
|
(ui_property
|
||||||
|
name: (identifier) @property)
|
||||||
|
|
||||||
|
(ui_required
|
||||||
|
name: (identifier) @property)
|
||||||
|
|
||||||
|
(ui_list_property_type
|
||||||
|
["<" ">"] @punctuation.bracket)
|
||||||
|
|
||||||
|
;;; Signals
|
||||||
|
|
||||||
|
(ui_signal
|
||||||
|
name: (identifier) @function)
|
||||||
|
|
||||||
|
(ui_signal_parameter
|
||||||
|
(identifier) @variable)
|
||||||
|
|
||||||
|
;;; ui_object_definition
|
||||||
|
(ui_object_definition
|
||||||
|
type_name: (identifier) @type)
|
||||||
|
(ui_object_definition
|
||||||
|
type_name: (nested_identifier) @type)
|
||||||
|
|
||||||
|
|
||||||
|
;;; js
|
||||||
|
|
||||||
|
; Properties
|
||||||
|
;-----------
|
||||||
|
|
||||||
|
(property_identifier) @property
|
||||||
|
|
||||||
|
; Literals
|
||||||
|
;---------
|
||||||
|
|
||||||
|
[
|
||||||
|
(true)
|
||||||
|
(false)
|
||||||
|
(null)
|
||||||
|
(undefined)
|
||||||
|
] @constant.builtin
|
||||||
|
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
[
|
||||||
|
(string)
|
||||||
|
(template_string)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
(regex) @string.special
|
||||||
|
(number) @number
|
||||||
|
|
||||||
|
; Tokens
|
||||||
|
;-------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; keywrod in qml
|
||||||
|
[
|
||||||
|
"required"
|
||||||
|
"property"
|
||||||
|
"signal"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
; from typescript
|
||||||
|
|
||||||
|
(type_identifier) @type
|
||||||
|
(predefined_type) @type.builtin
|
||||||
|
|
||||||
|
((identifier) @type
|
||||||
|
(#match? @type "^[A-Z]"))
|
||||||
|
|
||||||
|
(type_arguments
|
||||||
|
"<" @punctuation.bracket
|
||||||
|
">" @punctuation.bracket)
|
||||||
|
|
||||||
|
; Variables
|
||||||
|
|
||||||
|
(required_parameter (identifier) @variable)
|
||||||
|
(optional_parameter (identifier) @variable)
|
||||||
|
|
||||||
|
; Keywords
|
||||||
|
|
||||||
|
[ "abstract"
|
||||||
|
"declare"
|
||||||
|
"enum"
|
||||||
|
"export"
|
||||||
|
"implements"
|
||||||
|
"interface"
|
||||||
|
"keyof"
|
||||||
|
"namespace"
|
||||||
|
"private"
|
||||||
|
"protected"
|
||||||
|
"public"
|
||||||
|
"type"
|
||||||
|
"readonly"
|
||||||
|
"override"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue