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 futures::{channel::mpsc, StreamExt};
use gpui::{
actions, div, App, Context, Corner, Entity, EventEmitter, FocusHandle, Focusable, IntoElement,
ParentElement, Render, Styled, Subscription, WeakEntity, Window,
actions, div, AnyView, App, Context, Corner, Entity, EventEmitter, FocusHandle, Focusable,
IntoElement, ParentElement, Render, Styled, Subscription, WeakEntity, Window,
};
use language::{language_settings::SoftWrap, LanguageServerId};
use lsp::{
@ -12,7 +12,7 @@ use lsp::{
SetTraceParams, TraceValue,
};
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 workspace::{
item::{Item, ItemHandle},
@ -1071,6 +1071,21 @@ impl Item for LspLogView {
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(
&self,
_workspace_id: Option<WorkspaceId>,