aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_expand/src/db.rs1
-rw-r--r--crates/ra_ide/src/completion/complete_scope.rs53
-rw-r--r--crates/ra_mbe/src/mbe_expander.rs1
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs1
4 files changed, 53 insertions, 3 deletions
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs
index ad4a0732e..f1918817e 100644
--- a/crates/ra_hir_expand/src/db.rs
+++ b/crates/ra_hir_expand/src/db.rs
@@ -206,7 +206,6 @@ fn macro_expand_with_arg(
206 }; 206 };
207 let (tt, err) = macro_rules.0.expand(db, lazy_id, &macro_arg.0); 207 let (tt, err) = macro_rules.0.expand(db, lazy_id, &macro_arg.0);
208 // Set a hard limit for the expanded tt 208 // Set a hard limit for the expanded tt
209 eprintln!("expansion size: {}", tt.count());
210 let count = tt.count(); 209 let count = tt.count();
211 if count > 65536 { 210 if count > 65536 {
212 return (None, Some(format!("Total tokens count exceed limit : count = {}", count))); 211 return (None, Some(format!("Total tokens count exceed limit : count = {}", count)));
diff --git a/crates/ra_ide/src/completion/complete_scope.rs b/crates/ra_ide/src/completion/complete_scope.rs
index 2733922f8..81d3cc1b6 100644
--- a/crates/ra_ide/src/completion/complete_scope.rs
+++ b/crates/ra_ide/src/completion/complete_scope.rs
@@ -906,6 +906,59 @@ mod tests {
906 } 906 }
907 907
908 #[test] 908 #[test]
909 fn completes_in_simple_macro_without_closing_parens() {
910 assert_debug_snapshot!(
911 do_reference_completion(
912 r"
913 macro_rules! m { ($e:expr) => { $e } }
914 fn quux(x: i32) {
915 let y = 92;
916 m!(x<|>
917 }
918 "
919 ),
920 @r###"
921 [
922 CompletionItem {
923 label: "m!",
924 source_range: [145; 146),
925 delete: [145; 146),
926 insert: "m!($0)",
927 kind: Macro,
928 detail: "macro_rules! m",
929 },
930 CompletionItem {
931 label: "quux(…)",
932 source_range: [145; 146),
933 delete: [145; 146),
934 insert: "quux(${1:x})$0",
935 kind: Function,
936 lookup: "quux",
937 detail: "fn quux(x: i32)",
938 trigger_call_info: true,
939 },
940 CompletionItem {
941 label: "x",
942 source_range: [145; 146),
943 delete: [145; 146),
944 insert: "x",
945 kind: Binding,
946 detail: "i32",
947 },
948 CompletionItem {
949 label: "y",
950 source_range: [145; 146),
951 delete: [145; 146),
952 insert: "y",
953 kind: Binding,
954 detail: "i32",
955 },
956 ]
957 "###
958 );
959 }
960
961 #[test]
909 fn completes_unresolved_uses() { 962 fn completes_unresolved_uses() {
910 assert_debug_snapshot!( 963 assert_debug_snapshot!(
911 do_reference_completion( 964 do_reference_completion(
diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs
index c2a5702f0..5fb8414b3 100644
--- a/crates/ra_mbe/src/mbe_expander.rs
+++ b/crates/ra_mbe/src/mbe_expander.rs
@@ -11,7 +11,6 @@ use rustc_hash::FxHashMap;
11use crate::{ExpandError, ExpandResult}; 11use crate::{ExpandError, ExpandResult};
12 12
13pub(crate) fn expand(rules: &crate::MacroRules, input: &tt::Subtree) -> ExpandResult<tt::Subtree> { 13pub(crate) fn expand(rules: &crate::MacroRules, input: &tt::Subtree) -> ExpandResult<tt::Subtree> {
14 eprintln!("expanding input: {:?}", input);
15 let (mut result, mut unmatched_tokens, mut unmatched_patterns, mut err) = ( 14 let (mut result, mut unmatched_tokens, mut unmatched_patterns, mut err) = (
16 tt::Subtree::default(), 15 tt::Subtree::default(),
17 usize::max_value(), 16 usize::max_value(),
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index 8aa3b906b..fcb73fbc7 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -73,7 +73,6 @@ 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);
77 let tmp; 76 let tmp;
78 let tokens = match tt { 77 let tokens = match tt {
79 tt::Subtree { delimiter: None, token_trees } => token_trees.as_slice(), 78 tt::Subtree { delimiter: None, token_trees } => token_trees.as_slice(),