Respect local.scope-inherits property in local variable queries

This commit is contained in:
Max Brunsfeld 2019-10-18 14:12:20 -07:00
parent 64c6cf4473
commit b73b31356d

View file

@ -732,11 +732,21 @@ where
// the scope stack.
if Some(capture.index) == layer.config.local_scope_capture_index {
definition_highlight = None;
layer.scope_stack.push(LocalScope {
let mut scope = LocalScope {
inherits: true,
range: range.clone(),
local_defs: Vec::new(),
});
};
for prop in layer.config.query.property_settings(pattern_index) {
match prop.key.as_ref() {
"local.scope-inherits" => {
scope.inherits =
prop.value.as_ref().map_or(true, |r| r.as_ref() == "true");
}
_ => {}
}
}
layer.scope_stack.push(scope);
}
// If the node represents a definition, add a new definition to the
// local scope at the top of the scope stack.