rust-analyzer/crates/ide-completion/src/render
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
..
const_.rs Remove non-needed clones 2022-12-23 02:20:03 -05:00
function.rs Inline all format arguments where possible 2022-12-24 14:36:10 -05:00
literal.rs Trigger call info for more completions of signature having things 2023-02-14 17:05:07 +01:00
macro_.rs generate correct completion edits for missing macro arguments 2023-03-04 02:05:09 +01:00
pattern.rs pass snippet_cap to format_literal_label, return early if None 2022-12-20 11:27:19 -05:00
type_alias.rs Remove non-needed clones 2022-12-23 02:20:03 -05:00
union_literal.rs Trigger call info for more completions of signature having things 2023-02-14 17:05:07 +01:00
variant.rs return immediately from render_record_lit if snippet_cap is None 2023-01-04 12:55:05 -05:00