Skip additional completions on any kind of overlap with primary edit

This commit is contained in:
Julia 2022-11-10 18:53:37 -05:00
parent 03115c8d71
commit 44c3cedc48

View file

@ -3476,12 +3476,12 @@ impl Project {
for (range, text) in edits { for (range, text) in edits {
let primary = &completion.old_range; let primary = &completion.old_range;
let within_primary = primary.start.cmp(&range.start, buffer).is_ge() let start_within = primary.start.cmp(&range.start, buffer).is_le()
&& primary.end.cmp(&range.end, buffer).is_le(); && primary.end.cmp(&range.start, buffer).is_ge();
let within_additional = range.start.cmp(&primary.start, buffer).is_ge() let end_within = range.start.cmp(&primary.end, buffer).is_le()
&& range.end.cmp(&primary.end, buffer).is_le(); && range.end.cmp(&primary.end, buffer).is_ge();
if !within_primary && !within_additional { if !start_within && !end_within {
buffer.edit([(range, text)], None, cx); buffer.edit([(range, text)], None, cx);
} }
} }