From 64d07c1bd475c4945db8d7cd1fa1a61e467b079b Mon Sep 17 00:00:00 2001 From: darksv Date: Mon, 10 Sep 2018 20:14:09 +0200 Subject: Implement reparsing for remaining blocks --- crates/libsyntax2/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crates/libsyntax2/src/lib.rs') diff --git a/crates/libsyntax2/src/lib.rs b/crates/libsyntax2/src/lib.rs index d955c01e7..74e8e7338 100644 --- a/crates/libsyntax2/src/lib.rs +++ b/crates/libsyntax2/src/lib.rs @@ -144,6 +144,21 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax let res = match node.kind() { BLOCK => grammar::block, NAMED_FIELD_DEF_LIST => grammar::named_field_def_list, + NAMED_FIELD_LIST => grammar::named_field_list, + ENUM_VARIANT_LIST => grammar::enum_variant_list, + MATCH_ARM_LIST => grammar::match_arm_list, + USE_TREE_LIST => grammar::use_tree_list, + EXTERN_ITEM_LIST => grammar::extern_item_list, + TOKEN_TREE => grammar::token_tree, + ITEM_LIST => { + let parent = node.parent().unwrap(); + match parent.kind() { + IMPL_ITEM => grammar::impl_item_list, + TRAIT_DEF => grammar::trait_item_list, + MODULE => grammar::mod_item_list, + _ => return None, + } + }, _ => return None, }; Some(res) -- cgit v1.2.3 From d0cfeb4f1616e125ca3a941f2dcf5dfbb5f2b03f Mon Sep 17 00:00:00 2001 From: darksv Date: Mon, 10 Sep 2018 23:21:16 +0200 Subject: Do not reparse token tree when it is not delimited by braces --- crates/libsyntax2/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/libsyntax2/src/lib.rs') diff --git a/crates/libsyntax2/src/lib.rs b/crates/libsyntax2/src/lib.rs index 74e8e7338..fd58cb4fa 100644 --- a/crates/libsyntax2/src/lib.rs +++ b/crates/libsyntax2/src/lib.rs @@ -149,7 +149,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax MATCH_ARM_LIST => grammar::match_arm_list, USE_TREE_LIST => grammar::use_tree_list, EXTERN_ITEM_LIST => grammar::extern_item_list, - TOKEN_TREE => grammar::token_tree, + TOKEN_TREE if node.first_child().unwrap().kind() == L_CURLY => grammar::token_tree, ITEM_LIST => { let parent = node.parent().unwrap(); match parent.kind() { -- cgit v1.2.3