Compare commits

..

No commits in common. "0e27fd91a744766e79b58fc64af6cd898dc7c941" and "2c17cea19ee8d2b93f48e619b59912b1e5dc0ca0" have entirely different histories.

3 changed files with 10 additions and 18 deletions

View File

@ -31,7 +31,6 @@ a,arguments
s,statement s,statement
d,declaration d,declaration
n,number n,number
b,block
\",string" | \",string" |
while IFS=, read -r cmd group ; do while IFS=, read -r cmd group ; do
echo "map -docstring '$group child' global tree-children '$cmd' ':tree-select-children $group<ret>'" echo "map -docstring '$group child' global tree-children '$cmd' ':tree-select-children $group<ret>'"

View File

@ -2,19 +2,8 @@
group.identifier = ["identifier", "scoped_identifier"] group.identifier = ["identifier", "scoped_identifier"]
group.declaration = ["const_item", "macro_invocation", "macro_definition", "empty_statement", "attribute_item", "inner_attribute_item", "mod_item", "foreign_mod_item", "struct_item", "union_item", "enum_item", "type_item", "function_item", "function_signature_item", "impl_item", "trait_item", "associated_type", "let_declaration", "use_declaration", "extern_crate_declaration", "static_item"] group.declaration = ["const_item", "macro_invocation", "macro_definition", "empty_statement", "attribute_item", "inner_attribute_item", "mod_item", "foreign_mod_item", "struct_item", "union_item", "enum_item", "type_item", "function_item", "function_signature_item", "impl_item", "trait_item", "associated_type", "let_declaration", "use_declaration", "extern_crate_declaration", "static_item"]
group.call = ["macro_invocation", "call_expression"] group.call = ["macro_invocation", "call_expression"]
group.arguments = ["arguments", "token_tree", "parameters"] group.arguments = ["arguments", "token_tree"]
group.statement = ["expression_statement", "let_declaration"] group.statement = ["expression_statement", "let_declaration"]
group.string = ["string_literal", "raw_string_literal"] group.string = ["string_literal", "raw_string_literal"]
group.number = ["integer_literal", "float_literal", "negative_literal"] group.number = ["integer_literal", "float_literal", "negative_literal"]
group.type = ["abstract_type", "reference_type", "metavariable", "pointer_type", "generic_type", "scoped_type_identifier", "tuple_type", "unit_type", "array_type", "function_type", "macro_invocation", "empty_type", "dynamic_type", "bounded_type", "primitive_type"] group.type = ["abstract_type", "reference_type", "metavariable", "pointer_type", "generic_type", "scoped_type_identifier", "tuple_type", "unit_type", "array_type", "function_type", "macro_invocation", "empty_type", "dynamic_type", "bounded_type", "primitive_type"]
[filetype.python]
group.identifier = ["identifier"]
group.declaration = ["function_definition", "class_definition"]
group.statement = ["expression_statement", "for_statement", "if_statement", "return_statement", "while_statement", "raise_statement", "try_statement", "assert_statement", "import_statement"]
group.call = ["call"]
group.arguments = ["arguments", "parameters"]
group.string = ["string"]
group.number = ["integer", "float"]
group.type = ["type", "generic_type"]

View File

@ -215,6 +215,9 @@ fn handle_request(config: &Config, request: &Request) -> String {
} }
fn select_nodes(node: &Node, kinds: &[String], new_ranges: &mut Vec<Range>) { fn select_nodes(node: &Node, kinds: &[String], new_ranges: &mut Vec<Range>) {
if kinds.iter().any(|kind| kind == node.kind()) {
new_ranges.push(node.range());
} else {
for child in tree::named_children(&node) { for child in tree::named_children(&node) {
if kinds.iter().any(|kind| kind == child.kind()) { if kinds.iter().any(|kind| kind == child.kind()) {
new_ranges.push(child.range()); new_ranges.push(child.range());
@ -223,6 +226,7 @@ fn select_nodes(node: &Node, kinds: &[String], new_ranges: &mut Vec<Range>) {
} }
} }
} }
}
fn traverse_up_to_node_which_matters<'a>( fn traverse_up_to_node_which_matters<'a>(
filetype_config: &FiletypeConfig, filetype_config: &FiletypeConfig,