diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rs index 41d2ac046e..a11f8ae2cc 100644 --- a/crates/editor2/src/editor.rs +++ b/crates/editor2/src/editor.rs @@ -9097,9 +9097,6 @@ impl Editor { } pub fn handle_blur(&mut self, cx: &mut ViewContext) { - // todo!() - // let blurred_event = EditorBlurred(cx.handle()); - // cx.emit_global(blurred_event); self.blink_manager.update(cx, BlinkManager::disable); self.buffer .update(cx, |buffer, cx| buffer.remove_active_selections(cx)); @@ -9283,10 +9280,6 @@ pub enum EditorEvent { Closed, } -pub struct EditorFocused(pub View); -pub struct EditorBlurred(pub View); -pub struct EditorReleased(pub WeakView); - impl EventEmitter for Editor {} impl FocusableView for Editor { diff --git a/crates/vim2/src/command.rs b/crates/vim2/src/command.rs index dcfc2a9737..718d4097a4 100644 --- a/crates/vim2/src/command.rs +++ b/crates/vim2/src/command.rs @@ -22,7 +22,7 @@ pub struct GoToLine { impl_actions!(vim, [GoToLine]); -pub fn register(workspace: &mut Workspace, cx: &mut ViewContext) { +pub fn register(workspace: &mut Workspace, _: &mut ViewContext) { workspace.register_action(|_: &mut Workspace, action: &GoToLine, cx| { Vim::update(cx, |vim, cx| { vim.switch_mode(Mode::Normal, false, cx); diff --git a/crates/vim2/src/editor_events.rs b/crates/vim2/src/editor_events.rs index c16b3f16cf..a6c3378d47 100644 --- a/crates/vim2/src/editor_events.rs +++ b/crates/vim2/src/editor_events.rs @@ -1,7 +1,6 @@ use crate::Vim; -use editor::{Editor, EditorBlurred, EditorEvent, EditorFocused, EditorReleased}; +use editor::{Editor, EditorEvent}; use gpui::{AppContext, Entity, EntityId, View, ViewContext, WindowContext}; -use workspace::item::WeakItemHandle; pub fn init(cx: &mut AppContext) { cx.observe_new_views(|_, cx: &mut ViewContext| { @@ -17,14 +16,10 @@ pub fn init(cx: &mut AppContext) { cx.on_release(move |_, cx| released(id, cx)).detach(); }) .detach(); - // todo!() - // cx.subscribe_global(focused).detach(); - // cx.subscribe_global(blurred).detach(); - // cx.subscribe_global(released).detach(); } fn focused(editor: View, cx: &mut WindowContext) { - if let Some(previously_active_editor) = Vim::read(cx).active_editor.clone() { + if Vim::read(cx).active_editor.clone().is_some() { Vim::update(cx, |vim, cx| { vim.update_active_editor(cx, |previously_active_editor, cx| { vim.unhook_vim_settings(previously_active_editor, cx) diff --git a/crates/vim2/src/insert.rs b/crates/vim2/src/insert.rs index 2e5cdd1f3b..81aac70d02 100644 --- a/crates/vim2/src/insert.rs +++ b/crates/vim2/src/insert.rs @@ -6,7 +6,7 @@ use workspace::Workspace; actions!(vim, [NormalBefore]); -pub fn register(workspace: &mut Workspace, cx: &mut ViewContext) { +pub fn register(workspace: &mut Workspace, _: &mut ViewContext) { workspace.register_action(normal_before); } diff --git a/crates/vim2/src/mode_indicator.rs b/crates/vim2/src/mode_indicator.rs index ad644a383e..38f0bd6c96 100644 --- a/crates/vim2/src/mode_indicator.rs +++ b/crates/vim2/src/mode_indicator.rs @@ -1,4 +1,4 @@ -use gpui::{div, AnyElement, Div, Element, Entity, IntoElement, Render, Subscription, ViewContext}; +use gpui::{div, AnyElement, Element, IntoElement, Render, ViewContext}; use settings::{Settings, SettingsStore}; use workspace::{item::ItemHandle, ui::Label, StatusItemView}; @@ -51,7 +51,7 @@ impl ModeIndicator { impl Render for ModeIndicator { type Element = AnyElement; - fn render(&mut self, cx: &mut ViewContext) -> AnyElement { + fn render(&mut self, _: &mut ViewContext) -> AnyElement { let Some(mode) = self.mode.as_ref() else { return div().into_any(); }; diff --git a/crates/vim2/src/motion.rs b/crates/vim2/src/motion.rs index c7df0c3f2e..4e258bc283 100644 --- a/crates/vim2/src/motion.rs +++ b/crates/vim2/src/motion.rs @@ -4,7 +4,7 @@ use editor::{ movement::{self, find_boundary, find_preceding_boundary, FindRange, TextLayoutDetails}, Bias, CharKind, DisplayPoint, ToOffset, }; -use gpui::{actions, impl_actions, px, AppContext, ViewContext, WindowContext}; +use gpui::{actions, impl_actions, px, ViewContext, WindowContext}; use language::{Point, Selection, SelectionGoal}; use serde::Deserialize; use workspace::Workspace; @@ -139,7 +139,7 @@ actions!( ] ); -pub fn register(workspace: &mut Workspace, cx: &mut ViewContext) { +pub fn register(workspace: &mut Workspace, _: &mut ViewContext) { workspace.register_action(|_: &mut Workspace, _: &Left, cx: _| motion(Motion::Left, cx)); workspace .register_action(|_: &mut Workspace, _: &Backspace, cx: _| motion(Motion::Backspace, cx)); diff --git a/crates/vim2/src/normal.rs b/crates/vim2/src/normal.rs index 13204bb6a0..d717d651d8 100644 --- a/crates/vim2/src/normal.rs +++ b/crates/vim2/src/normal.rs @@ -53,7 +53,6 @@ actions!( ); pub(crate) fn register(workspace: &mut Workspace, cx: &mut ViewContext) { - dbg!("registering"); workspace.register_action(insert_after); workspace.register_action(insert_before); workspace.register_action(insert_first_non_whitespace); diff --git a/crates/vim2/src/normal/increment.rs b/crates/vim2/src/normal/increment.rs index 014eae4dae..8903e40573 100644 --- a/crates/vim2/src/normal/increment.rs +++ b/crates/vim2/src/normal/increment.rs @@ -1,7 +1,7 @@ use std::ops::Range; use editor::{scroll::autoscroll::Autoscroll, MultiBufferSnapshot, ToOffset, ToPoint}; -use gpui::{impl_actions, AppContext, ViewContext, WindowContext}; +use gpui::{impl_actions, ViewContext, WindowContext}; use language::{Bias, Point}; use serde::Deserialize; use workspace::Workspace; @@ -24,7 +24,7 @@ struct Decrement { impl_actions!(vim, [Increment, Decrement]); -pub fn register(workspace: &mut Workspace, cx: &mut ViewContext) { +pub fn register(workspace: &mut Workspace, _: &mut ViewContext) { workspace.register_action(|_: &mut Workspace, action: &Increment, cx| { Vim::update(cx, |vim, cx| { vim.record_current_action(cx); diff --git a/crates/vim2/src/normal/repeat.rs b/crates/vim2/src/normal/repeat.rs index ec1913e0ae..a5a43b8389 100644 --- a/crates/vim2/src/normal/repeat.rs +++ b/crates/vim2/src/normal/repeat.rs @@ -5,7 +5,7 @@ use crate::{ visual::visual_motion, Vim, }; -use gpui::{actions, Action, AppContext, ViewContext, WindowContext}; +use gpui::{actions, Action, ViewContext, WindowContext}; use workspace::Workspace; actions!(vim, [Repeat, EndRepeat]); diff --git a/crates/vim2/src/normal/scroll.rs b/crates/vim2/src/normal/scroll.rs index 79204d7595..fe5f3a9017 100644 --- a/crates/vim2/src/normal/scroll.rs +++ b/crates/vim2/src/normal/scroll.rs @@ -4,7 +4,7 @@ use editor::{ scroll::{scroll_amount::ScrollAmount, VERTICAL_SCROLL_MARGIN}, DisplayPoint, Editor, }; -use gpui::{actions, AppContext, ViewContext}; +use gpui::{actions, ViewContext}; use language::Bias; use workspace::Workspace; @@ -13,7 +13,7 @@ actions!( [LineUp, LineDown, ScrollUp, ScrollDown, PageUp, PageDown] ); -pub fn register(workspace: &mut Workspace, cx: &mut ViewContext) { +pub fn register(workspace: &mut Workspace, _: &mut ViewContext) { workspace.register_action(|_: &mut Workspace, _: &LineDown, cx| { scroll(cx, false, |c| ScrollAmount::Line(c.unwrap_or(1.))) }); diff --git a/crates/vim2/src/normal/search.rs b/crates/vim2/src/normal/search.rs index 2a7f82bf99..ef26d029a5 100644 --- a/crates/vim2/src/normal/search.rs +++ b/crates/vim2/src/normal/search.rs @@ -1,7 +1,7 @@ -use gpui::{actions, impl_actions, Action, AppContext, ViewContext}; +use gpui::{actions, impl_actions, ViewContext}; use search::{buffer_search, BufferSearchBar, SearchMode, SearchOptions}; use serde_derive::Deserialize; -use workspace::{searchable::Direction, Pane, Workspace}; +use workspace::{searchable::Direction, Workspace}; use crate::{motion::Motion, normal::move_cursor, state::SearchState, Vim}; @@ -50,7 +50,7 @@ impl_actions!( [FindCommand, ReplaceCommand, Search, MoveToPrev, MoveToNext] ); -pub(crate) fn register(workspace: &mut Workspace, cx: &mut ViewContext) { +pub(crate) fn register(workspace: &mut Workspace, _: &mut ViewContext) { workspace.register_action(move_to_next); workspace.register_action(move_to_prev); workspace.register_action(search); diff --git a/crates/vim2/src/object.rs b/crates/vim2/src/object.rs index a43210ebb6..d25dfb0831 100644 --- a/crates/vim2/src/object.rs +++ b/crates/vim2/src/object.rs @@ -6,7 +6,7 @@ use editor::{ movement::{self, FindRange}, Bias, CharKind, DisplayPoint, }; -use gpui::{actions, impl_actions, Action, AppContext, ViewContext, WindowContext}; +use gpui::{actions, impl_actions, ViewContext, WindowContext}; use language::Selection; use serde::Deserialize; use workspace::Workspace; @@ -51,7 +51,7 @@ actions!( ] ); -pub fn register(workspace: &mut Workspace, cx: &mut ViewContext) { +pub fn register(workspace: &mut Workspace, _: &mut ViewContext) { workspace.register_action( |_: &mut Workspace, &Word { ignore_punctuation }: &Word, cx: _| { object(Object::Word { ignore_punctuation }, cx) diff --git a/crates/vim2/src/vim.rs b/crates/vim2/src/vim.rs index 008eeaf20f..c70decf5c3 100644 --- a/crates/vim2/src/vim.rs +++ b/crates/vim2/src/vim.rs @@ -18,7 +18,7 @@ use command_palette::CommandPaletteInterceptor; use editor::{movement, Editor, EditorEvent, EditorMode}; use gpui::{ actions, impl_actions, Action, AppContext, EntityId, KeyContext, Subscription, View, - ViewContext, WeakModel, WeakView, WindowContext, + ViewContext, WeakView, WindowContext, }; use language::{CursorShape, Point, Selection, SelectionGoal}; pub use mode_indicator::ModeIndicator; @@ -116,7 +116,7 @@ fn register(workspace: &mut Workspace, cx: &mut ViewContext) { visual::register(workspace, cx); } -pub fn observe_keystrokes(cx: &mut WindowContext) { +pub fn observe_keystrokes(_: &mut WindowContext) { // todo!() // cx.observe_keystrokes(|_keystroke, result, handled_by, cx| { diff --git a/crates/vim2/src/visual.rs b/crates/vim2/src/visual.rs index c0b1e03677..791b26f78c 100644 --- a/crates/vim2/src/visual.rs +++ b/crates/vim2/src/visual.rs @@ -8,7 +8,7 @@ use editor::{ scroll::autoscroll::Autoscroll, Bias, DisplayPoint, Editor, }; -use gpui::{actions, AppContext, ViewContext, WindowContext}; +use gpui::{actions, ViewContext, WindowContext}; use language::{Selection, SelectionGoal}; use workspace::Workspace; @@ -34,7 +34,7 @@ actions!( ] ); -pub fn register(workspace: &mut Workspace, cx: &mut ViewContext) { +pub fn register(workspace: &mut Workspace, _: &mut ViewContext) { workspace.register_action(|_, _: &ToggleVisual, cx: &mut ViewContext| { toggle_mode(Mode::Visual, cx) });