mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-11-28 12:42:09 +03:00
syntax: Add go & rust locals, improve tree-sitter error message
This commit is contained in:
parent
2bef245b7a
commit
4ac29434cb
@ -144,8 +144,12 @@ impl LanguageConfiguration {
|
||||
&highlights_query,
|
||||
&injections_query,
|
||||
&locals_query,
|
||||
)
|
||||
.unwrap(); // TODO: no unwrap
|
||||
);
|
||||
|
||||
let config = match config {
|
||||
Ok(config) => config,
|
||||
Err(err) => panic!("{}", err),
|
||||
}; // TODO: avoid panic
|
||||
config.configure(scopes);
|
||||
Some(Arc::new(config))
|
||||
}
|
||||
|
@ -21,14 +21,14 @@
|
||||
(const_spec
|
||||
name: (identifier) @constant)
|
||||
|
||||
(parameter_declaration (identifier) @variable.parameter)
|
||||
(variadic_parameter_declaration (identifier) @variable.parameter)
|
||||
|
||||
(type_identifier) @type
|
||||
(field_identifier) @property
|
||||
(identifier) @variable
|
||||
(package_identifier) @variable
|
||||
|
||||
(parameter_declaration (identifier) @variable.parameter)
|
||||
(variadic_parameter_declaration (identifier) @variable.parameter)
|
||||
|
||||
|
||||
; Operators
|
||||
|
||||
|
30
runtime/queries/go/locals.scm
Normal file
30
runtime/queries/go/locals.scm
Normal file
@ -0,0 +1,30 @@
|
||||
; Scopes
|
||||
|
||||
(block) @local.scope
|
||||
|
||||
; Definitions
|
||||
|
||||
(parameter_declaration (identifier) @local.definition)
|
||||
(variadic_parameter_declaration (identifier) @local.definition)
|
||||
|
||||
(short_var_declaration
|
||||
left: (expression_list
|
||||
(identifier) @local.definition))
|
||||
|
||||
(var_spec
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(for_statement
|
||||
(range_clause
|
||||
left: (expression_list
|
||||
(identifier) @local.definition)))
|
||||
|
||||
(const_declaration
|
||||
(const_spec
|
||||
name: (identifier) @local.definition))
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @local.reference
|
||||
(field_identifier) @local.reference
|
||||
|
17
runtime/queries/rust/locals.scm
Normal file
17
runtime/queries/rust/locals.scm
Normal file
@ -0,0 +1,17 @@
|
||||
; Scopes
|
||||
|
||||
(block) @local.scope
|
||||
|
||||
; Definitions
|
||||
|
||||
(parameter
|
||||
(identifier) @local.definition)
|
||||
|
||||
(let_declaration
|
||||
pattern: (identifier) @local.definition)
|
||||
|
||||
(closure_parameters (identifier)) @local.definition
|
||||
|
||||
; References
|
||||
(identifier) @local.reference
|
||||
|
@ -9,7 +9,7 @@ special = "honey"
|
||||
property = "white"
|
||||
variable = "lavender"
|
||||
# variable = "almond" # TODO: metavariables only
|
||||
"variable.parameter" = "lavender"
|
||||
"variable.parameter" = { fg = "lavender", modifiers = ["underlined"] }
|
||||
"variable.builtin" = "mint"
|
||||
type = "white"
|
||||
"type.builtin" = "white" # TODO: distinguish?
|
||||
|
Loading…
Reference in New Issue
Block a user