-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
A-completionautocompletionautocompletionA-macromacro expansionmacro expansionC-ArchitectureBig architectural things which we need to figure up-front (or suggestions for rewrites :0) )Big architectural things which we need to figure up-front (or suggestions for rewrites :0) )C-featureCategory: feature requestCategory: feature requestE-hardS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right nowfunA technically challenging issue with high impactA technically challenging issue with high impact
Description
When typing inside a macro we should consider all downmapped positions of the ident we are currently typing out instead of just the first one, that way we get more completions that might make sense.
Example given the following macro:
macro_rules! tuple_to_record_closure {
($ident:ident { $( $field:ident ),+ $(,)? }) => {
|($( $field ),+)| $ident { $( $field ),+ }
};
}
struct Foo { foo: () }
fn main() {
tuple_to_record_closure! {
Foo {
f$0
}
}
}
Typing at the given position should offer the completion of the foo
field as the ident is downmapped to a field position as its second usage, currently we only consider the parameter position though.
This also has the potential to create a lot of duplicate completions which have to be filtered out, as well as making completions in macros potentially very slow if we were to stupidly repeat completions for each downmapped token, so this probably requires some architecture changes if we want to pursue this.
cc #11059
Metadata
Metadata
Assignees
Labels
A-completionautocompletionautocompletionA-macromacro expansionmacro expansionC-ArchitectureBig architectural things which we need to figure up-front (or suggestions for rewrites :0) )Big architectural things which we need to figure up-front (or suggestions for rewrites :0) )C-featureCategory: feature requestCategory: feature requestE-hardS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right nowfunA technically challenging issue with high impactA technically challenging issue with high impact