Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/items.rs')
-rw-r--r--crates/parser/src/grammar/items.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index 8ece5af527..0ac11371c5 100644
--- a/crates/parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
@@ -72,8 +72,19 @@ pub(super) fn item_or_macro(p: &mut Parser<'_>, stop_on_r_curly: bool, is_in_ext
// macro_rules! ()
// macro_rules! []
if paths::is_use_path_start(p) {
- macro_call(p, m);
- return;
+ paths::use_path(p);
+ // Do not create a MACRO_CALL node here if this isn't a macro call, this causes problems with completion.
+
+ // test_err path_item_without_excl
+ // foo
+ if p.at(T![!]) {
+ macro_call(p, m);
+ return;
+ } else {
+ m.complete(p, ERROR);
+ p.error("expected an item");
+ return;
+ }
}
m.abandon(p);
@@ -410,8 +421,7 @@ fn fn_(p: &mut Parser<'_>, m: Marker) {
}
fn macro_call(p: &mut Parser<'_>, m: Marker) {
- assert!(paths::is_use_path_start(p));
- paths::use_path(p);
+ assert!(p.at(T![!]));
match macro_call_after_excl(p) {
BlockLike::Block => (),
BlockLike::NotBlock => {