syntax: Add go & rust locals, improve tree-sitter error message

pull/724/head
Blaž Hrastnik 3 years ago
parent 2bef245b7a
commit 4ac29434cb

@ -144,8 +144,12 @@ impl LanguageConfiguration {
&highlights_query, &highlights_query,
&injections_query, &injections_query,
&locals_query, &locals_query,
) );
.unwrap(); // TODO: no unwrap
let config = match config {
Ok(config) => config,
Err(err) => panic!("{}", err),
}; // TODO: avoid panic
config.configure(scopes); config.configure(scopes);
Some(Arc::new(config)) Some(Arc::new(config))
} }

@ -21,14 +21,14 @@
(const_spec (const_spec
name: (identifier) @constant) name: (identifier) @constant)
(parameter_declaration (identifier) @variable.parameter)
(variadic_parameter_declaration (identifier) @variable.parameter)
(type_identifier) @type (type_identifier) @type
(field_identifier) @property (field_identifier) @property
(identifier) @variable (identifier) @variable
(package_identifier) @variable (package_identifier) @variable
(parameter_declaration (identifier) @variable.parameter)
(variadic_parameter_declaration (identifier) @variable.parameter)
; Operators ; Operators

@ -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

@ -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" property = "white"
variable = "lavender" variable = "lavender"
# variable = "almond" # TODO: metavariables only # variable = "almond" # TODO: metavariables only
"variable.parameter" = "lavender" "variable.parameter" = { fg = "lavender", modifiers = ["underlined"] }
"variable.builtin" = "mint" "variable.builtin" = "mint"
type = "white" type = "white"
"type.builtin" = "white" # TODO: distinguish? "type.builtin" = "white" # TODO: distinguish?

Loading…
Cancel
Save