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 {
let primary = &completion.old_range;
let within_primary = primary.start.cmp(&range.start, buffer).is_ge()
&& primary.end.cmp(&range.end, buffer).is_le();
let within_additional = range.start.cmp(&primary.start, buffer).is_ge()
&& range.end.cmp(&primary.end, buffer).is_le();
let start_within = primary.start.cmp(&range.start, buffer).is_le()
&& primary.end.cmp(&range.start, buffer).is_ge();
let end_within = range.start.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);
}
}