language_tools: Fix buffer search keeping focusing when pressing enter in vim mode (#26266)

Closes #25643 

Release Notes:

- Fixed buffer search keep focus when pressing enter in vim mode

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
CharlesChen0823 2025-03-19 12:25:29 +08:00 committed by GitHub
parent 15d2420031
commit 382f9f6151
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,8 +3,8 @@ use copilot::Copilot;
use editor::{actions::MoveToEnd, scroll::Autoscroll, Editor, EditorEvent}; use editor::{actions::MoveToEnd, scroll::Autoscroll, Editor, EditorEvent};
use futures::{channel::mpsc, StreamExt}; use futures::{channel::mpsc, StreamExt};
use gpui::{ use gpui::{
actions, div, App, Context, Corner, Entity, EventEmitter, FocusHandle, Focusable, IntoElement, actions, div, AnyView, App, Context, Corner, Entity, EventEmitter, FocusHandle, Focusable,
ParentElement, Render, Styled, Subscription, WeakEntity, Window, IntoElement, ParentElement, Render, Styled, Subscription, WeakEntity, Window,
}; };
use language::{language_settings::SoftWrap, LanguageServerId}; use language::{language_settings::SoftWrap, LanguageServerId};
use lsp::{ use lsp::{
@ -12,7 +12,7 @@ use lsp::{
SetTraceParams, TraceValue, SetTraceParams, TraceValue,
}; };
use project::{search::SearchQuery, Project, WorktreeId}; use project::{search::SearchQuery, Project, WorktreeId};
use std::{borrow::Cow, sync::Arc}; use std::{any::TypeId, borrow::Cow, sync::Arc};
use ui::{prelude::*, Button, Checkbox, ContextMenu, Label, PopoverMenu, ToggleState}; use ui::{prelude::*, Button, Checkbox, ContextMenu, Label, PopoverMenu, ToggleState};
use workspace::{ use workspace::{
item::{Item, ItemHandle}, item::{Item, ItemHandle},
@ -1071,6 +1071,21 @@ impl Item for LspLogView {
Some(Box::new(handle.clone())) Some(Box::new(handle.clone()))
} }
fn act_as_type<'a>(
&'a self,
type_id: TypeId,
self_handle: &'a Entity<Self>,
_: &'a App,
) -> Option<AnyView> {
if type_id == TypeId::of::<Self>() {
Some(self_handle.to_any())
} else if type_id == TypeId::of::<Editor>() {
Some(self.editor.to_any())
} else {
None
}
}
fn clone_on_split( fn clone_on_split(
&self, &self,
_workspace_id: Option<WorkspaceId>, _workspace_id: Option<WorkspaceId>,