diff options
author | Florian Diebold <[email protected]> | 2020-03-15 10:17:13 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-03-16 17:38:19 +0000 |
commit | c32529ddd0d66a219226dd63da2d4b1825375c0e (patch) | |
tree | 060bf75bcd43d2bd1ed9519bf1030ca7f24c7af0 | |
parent | 0f3a54dd4d439a6598526144c4ecccee9c5f1362 (diff) |
Get tests working
-rw-r--r-- | crates/ra_ide/src/completion/complete_dot.rs | 13 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 2 | ||||
-rw-r--r-- | crates/ra_mbe/src/mbe_expander.rs | 6 | ||||
-rw-r--r-- | crates/ra_mbe/src/syntax_bridge.rs | 1 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 4 |
5 files changed, 19 insertions, 7 deletions
diff --git a/crates/ra_ide/src/completion/complete_dot.rs b/crates/ra_ide/src/completion/complete_dot.rs index 22f5077f5..82ec16913 100644 --- a/crates/ra_ide/src/completion/complete_dot.rs +++ b/crates/ra_ide/src/completion/complete_dot.rs | |||
@@ -720,7 +720,18 @@ mod tests { | |||
720 | } | 720 | } |
721 | ", | 721 | ", |
722 | ), | 722 | ), |
723 | @r###"[]"### | 723 | @r###" |
724 | [ | ||
725 | CompletionItem { | ||
726 | label: "the_field", | ||
727 | source_range: [156; 156), | ||
728 | delete: [156; 156), | ||
729 | insert: "the_field", | ||
730 | kind: Field, | ||
731 | detail: "u32", | ||
732 | }, | ||
733 | ] | ||
734 | "### | ||
724 | ); | 735 | ); |
725 | } | 736 | } |
726 | 737 | ||
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 3646fb8dc..54589a2a8 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -135,7 +135,7 @@ impl<'a> CompletionContext<'a> { | |||
135 | ), | 135 | ), |
136 | ) { | 136 | ) { |
137 | let new_offset = hypothetical_expansion.1.text_range().start(); | 137 | let new_offset = hypothetical_expansion.1.text_range().start(); |
138 | if new_offset >= actual_expansion.text_range().end() { | 138 | if new_offset > actual_expansion.text_range().end() { |
139 | break; | 139 | break; |
140 | } | 140 | } |
141 | original_file = actual_expansion; | 141 | original_file = actual_expansion; |
diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs index b2faa86d2..c2a5702f0 100644 --- a/crates/ra_mbe/src/mbe_expander.rs +++ b/crates/ra_mbe/src/mbe_expander.rs | |||
@@ -11,6 +11,7 @@ use rustc_hash::FxHashMap; | |||
11 | use crate::{ExpandError, ExpandResult}; | 11 | use crate::{ExpandError, ExpandResult}; |
12 | 12 | ||
13 | pub(crate) fn expand(rules: &crate::MacroRules, input: &tt::Subtree) -> ExpandResult<tt::Subtree> { | 13 | pub(crate) fn expand(rules: &crate::MacroRules, input: &tt::Subtree) -> ExpandResult<tt::Subtree> { |
14 | eprintln!("expanding input: {:?}", input); | ||
14 | let (mut result, mut unmatched_tokens, mut unmatched_patterns, mut err) = ( | 15 | let (mut result, mut unmatched_tokens, mut unmatched_patterns, mut err) = ( |
15 | tt::Subtree::default(), | 16 | tt::Subtree::default(), |
16 | usize::max_value(), | 17 | usize::max_value(), |
@@ -39,9 +40,8 @@ fn expand_rule( | |||
39 | rule: &crate::Rule, | 40 | rule: &crate::Rule, |
40 | input: &tt::Subtree, | 41 | input: &tt::Subtree, |
41 | ) -> ExpandResult<(tt::Subtree, usize, usize)> { | 42 | ) -> ExpandResult<(tt::Subtree, usize, usize)> { |
42 | dbg!(&rule.lhs); | 43 | let (match_result, bindings_err) = matcher::match_(&rule.lhs, input); |
43 | let (match_result, bindings_err) = dbg!(matcher::match_(&rule.lhs, input)); | 44 | let (res, transcribe_err) = transcriber::transcribe(&rule.rhs, &match_result.bindings); |
44 | let (res, transcribe_err) = dbg!(transcriber::transcribe(&rule.rhs, &match_result.bindings)); | ||
45 | ( | 45 | ( |
46 | (res, match_result.unmatched_tokens, match_result.unmatched_patterns), | 46 | (res, match_result.unmatched_tokens, match_result.unmatched_patterns), |
47 | bindings_err.or(transcribe_err), | 47 | bindings_err.or(transcribe_err), |
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index fcb73fbc7..8aa3b906b 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs | |||
@@ -73,6 +73,7 @@ pub fn token_tree_to_syntax_node( | |||
73 | tt: &tt::Subtree, | 73 | tt: &tt::Subtree, |
74 | fragment_kind: FragmentKind, | 74 | fragment_kind: FragmentKind, |
75 | ) -> Result<(Parse<SyntaxNode>, TokenMap), ExpandError> { | 75 | ) -> Result<(Parse<SyntaxNode>, TokenMap), ExpandError> { |
76 | eprintln!("token_tree_to_syntax_node {:?} as {:?}", tt, fragment_kind); | ||
76 | let tmp; | 77 | let tmp; |
77 | let tokens = match tt { | 78 | let tokens = match tt { |
78 | tt::Subtree { delimiter: None, token_trees } => token_trees.as_slice(), | 79 | tt::Subtree { delimiter: None, token_trees } => token_trees.as_slice(), |
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index b77b683b5..2fc6ce1e1 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -565,10 +565,10 @@ fn meta_var_expr(p: &mut Parser) -> CompletedMarker { | |||
565 | it | 565 | it |
566 | } | 566 | } |
567 | _ => { | 567 | _ => { |
568 | while !p.at(R_DOLLAR) { | 568 | while !p.at(EOF) && !p.at(R_DOLLAR) { |
569 | p.bump_any() | 569 | p.bump_any() |
570 | } | 570 | } |
571 | p.bump(R_DOLLAR); | 571 | p.eat(R_DOLLAR); |
572 | m.complete(p, ERROR) | 572 | m.complete(p, ERROR) |
573 | } | 573 | } |
574 | } | 574 | } |