rust/crates/ide-completion/src
Pascal Kuthe 2e465d18f2
generate correct completion edits for missing macro arguments
rust-analyzer used the token at the cursor after macro expansion
to decide whether to replace the token at the cursor before macro
expansion. In most cases these two are the same but in some cases these
can mismatch which can lead to incorrect replacements.

For example if an ident/expr macro argument is missing rust-analyzer
generates a "missing" identifier as a placeholder, there is only a
brace at the cursor. Therefore, rust-analyzer will incorrectly replace
the macro brace with the completion in that case leading to #14246.

Using the expanded token type was intentional. However, this doesn't
seem to ever be desirable (this is supported by the fact that there
were no tests that relied on this behavior) since the type of edit to
perform should always be determined by the token it's actually applied
to.
2023-03-04 02:05:09 +01:00
..
completions Diagnose unresolved field accesses 2023-03-03 20:43:10 +01:00
context Simplify 2023-02-15 13:38:42 +01:00
render generate correct completion edits for missing macro arguments 2023-03-04 02:05:09 +01:00
tests Make else autocompletion work in more places 2023-02-12 10:49:57 +01:00
completions.rs Inline all format arguments where possible 2022-12-24 14:36:10 -05:00
config.rs Format code 2023-01-19 18:33:47 -08:00
context.rs generate correct completion edits for missing macro arguments 2023-03-04 02:05:09 +01:00
item.rs Lower and handle trait aliases in HIR 2023-03-04 00:24:07 +09:00
lib.rs Simplify 2023-02-15 13:38:42 +01:00
render.rs Lower and handle trait aliases in HIR 2023-03-04 00:24:07 +09:00
snippet.rs Inline all format arguments where possible 2022-12-24 14:36:10 -05:00
tests.rs internal: Make CompletionItem more POD-like 2023-02-16 09:29:55 +01:00