diff options
author | Gabriel Dinner-David | 2024-01-09 01:21:16 +0000 |
---|---|---|
committer | GitHub | 2024-01-09 01:21:16 +0000 |
commit | 84e24b33dcda16d1d64805f34dcc02d82d0de8f1 (patch) | |
tree | a7aaf60d67bc0a71d48aaae1d245ea329388a143 /helix-term/src/commands/lsp.rs | |
parent | 65d041288067f1d1bbcf659c8b73ae04d77afb02 (diff) |
make sure to sync views when applying edits to unfocused views (#9173)
Diffstat (limited to 'helix-term/src/commands/lsp.rs')
-rw-r--r-- | helix-term/src/commands/lsp.rs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 34ffa529..0096e6aa 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -896,7 +896,6 @@ pub fn apply_workspace_edit( } }; - let current_view_id = view!(editor).id; let doc_id = match editor.open(&path, Action::Load) { Ok(doc_id) => doc_id, Err(err) => { @@ -907,7 +906,7 @@ pub fn apply_workspace_edit( } }; - let doc = doc_mut!(editor, &doc_id); + let doc = doc!(editor, &doc_id); if let Some(version) = version { if version != doc.version() { let err = format!("outdated workspace edit for {path:?}"); @@ -918,18 +917,8 @@ pub fn apply_workspace_edit( } // Need to determine a view for apply/append_changes_to_history - let selections = doc.selections(); - let view_id = if selections.contains_key(¤t_view_id) { - // use current if possible - current_view_id - } else { - // Hack: we take the first available view_id - selections - .keys() - .next() - .copied() - .expect("No view_id available") - }; + let view_id = editor.get_synced_view_id(doc_id); + let doc = doc_mut!(editor, &doc_id); let transaction = helix_lsp::util::generate_transaction_from_edits( doc.text(), |