Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/application.rs')
| -rw-r--r-- | helix-term/src/application.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index c4e0bc3e..6c628669 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -1218,9 +1218,17 @@ impl Application { // If `Uri` gets another variant other than `Path` this may not be valid. let path = uri.as_path().expect("URIs are valid paths"); - let action = match take_focus { - Some(true) => helix_view::editor::Action::Replace, - _ => helix_view::editor::Action::VerticalSplit, + // Determine the focus strategy based on the current UI state and LSP request: + // 1. If there is no pop-up overlay, jump directly (Replace). + // 2. If there is a pop-up overlay, unless the LSP forces take_focus, only load in the background (Load) to prevent interruption of input. + // Note: We assume layer_count() == 1 means only the EditorView is present (no popups/overlays). + let action = if self.compositor.layer_count() == 1 { + helix_view::editor::Action::Replace + } else { + match take_focus { + Some(true) => helix_view::editor::Action::Replace, + _ => helix_view::editor::Action::Load, + } }; let doc_id = match self.editor.open(path, action) { |