editor: Fix edit range for linked edits on do completion (#29650)
Closes #29544 Fixes an issue where accepting an HTML completion would correctly edit the start tag but incorrectly update the end tag due to incorrect linked edit ranges. I want to handle multi cursor case (as it barely works now), but seems like this should go first. As, it might need whole `do_completions` overhaul. Todo: - [x] Tests for completion aceept on linked edits Before: https://github.com/user-attachments/assets/917f8d2a-4a0f-46e8-a004-675fde55fe3d After: https://github.com/user-attachments/assets/84b760b6-a5b9-45c4-85d8-b5dccf97775f Release Notes: - Fixes an issue where accepting an HTML completion would correctly edit the start tag but incorrectly update the end tag.
This commit is contained in:
parent
e4e455ae6b
commit
e697cf9747
2 changed files with 144 additions and 3 deletions
|
@ -5005,11 +5005,11 @@ impl Editor {
|
|||
range
|
||||
};
|
||||
|
||||
ranges.push(range);
|
||||
ranges.push(range.clone());
|
||||
|
||||
if !self.linked_edit_ranges.is_empty() {
|
||||
let start_anchor = snapshot.anchor_before(selection.head());
|
||||
let end_anchor = snapshot.anchor_after(selection.tail());
|
||||
let start_anchor = snapshot.anchor_before(range.start);
|
||||
let end_anchor = snapshot.anchor_after(range.end);
|
||||
if let Some(ranges) = self
|
||||
.linked_editing_ranges_for(start_anchor.text_anchor..end_anchor.text_anchor, cx)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue