Remove warnigns

This commit is contained in:
Conrad Irwin 2023-12-11 10:43:09 -07:00
parent af7c93b8d5
commit dd42adc4e5
14 changed files with 22 additions and 35 deletions

View file

@ -9097,9 +9097,6 @@ impl Editor {
} }
pub fn handle_blur(&mut self, cx: &mut ViewContext<Self>) { pub fn handle_blur(&mut self, cx: &mut ViewContext<Self>) {
// todo!()
// let blurred_event = EditorBlurred(cx.handle());
// cx.emit_global(blurred_event);
self.blink_manager.update(cx, BlinkManager::disable); self.blink_manager.update(cx, BlinkManager::disable);
self.buffer self.buffer
.update(cx, |buffer, cx| buffer.remove_active_selections(cx)); .update(cx, |buffer, cx| buffer.remove_active_selections(cx));
@ -9283,10 +9280,6 @@ pub enum EditorEvent {
Closed, Closed,
} }
pub struct EditorFocused(pub View<Editor>);
pub struct EditorBlurred(pub View<Editor>);
pub struct EditorReleased(pub WeakView<Editor>);
impl EventEmitter<EditorEvent> for Editor {} impl EventEmitter<EditorEvent> for Editor {}
impl FocusableView for Editor { impl FocusableView for Editor {

View file

@ -22,7 +22,7 @@ pub struct GoToLine {
impl_actions!(vim, [GoToLine]); impl_actions!(vim, [GoToLine]);
pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) { pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
workspace.register_action(|_: &mut Workspace, action: &GoToLine, cx| { workspace.register_action(|_: &mut Workspace, action: &GoToLine, cx| {
Vim::update(cx, |vim, cx| { Vim::update(cx, |vim, cx| {
vim.switch_mode(Mode::Normal, false, cx); vim.switch_mode(Mode::Normal, false, cx);

View file

@ -1,7 +1,6 @@
use crate::Vim; use crate::Vim;
use editor::{Editor, EditorBlurred, EditorEvent, EditorFocused, EditorReleased}; use editor::{Editor, EditorEvent};
use gpui::{AppContext, Entity, EntityId, View, ViewContext, WindowContext}; use gpui::{AppContext, Entity, EntityId, View, ViewContext, WindowContext};
use workspace::item::WeakItemHandle;
pub fn init(cx: &mut AppContext) { pub fn init(cx: &mut AppContext) {
cx.observe_new_views(|_, cx: &mut ViewContext<Editor>| { cx.observe_new_views(|_, cx: &mut ViewContext<Editor>| {
@ -17,14 +16,10 @@ pub fn init(cx: &mut AppContext) {
cx.on_release(move |_, cx| released(id, cx)).detach(); cx.on_release(move |_, cx| released(id, cx)).detach();
}) })
.detach(); .detach();
// todo!()
// cx.subscribe_global(focused).detach();
// cx.subscribe_global(blurred).detach();
// cx.subscribe_global(released).detach();
} }
fn focused(editor: View<Editor>, cx: &mut WindowContext) { fn focused(editor: View<Editor>, 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(cx, |vim, cx| {
vim.update_active_editor(cx, |previously_active_editor, cx| { vim.update_active_editor(cx, |previously_active_editor, cx| {
vim.unhook_vim_settings(previously_active_editor, cx) vim.unhook_vim_settings(previously_active_editor, cx)

View file

@ -6,7 +6,7 @@ use workspace::Workspace;
actions!(vim, [NormalBefore]); actions!(vim, [NormalBefore]);
pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) { pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
workspace.register_action(normal_before); workspace.register_action(normal_before);
} }

View file

@ -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 settings::{Settings, SettingsStore};
use workspace::{item::ItemHandle, ui::Label, StatusItemView}; use workspace::{item::ItemHandle, ui::Label, StatusItemView};
@ -51,7 +51,7 @@ impl ModeIndicator {
impl Render for ModeIndicator { impl Render for ModeIndicator {
type Element = AnyElement; type Element = AnyElement;
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement { fn render(&mut self, _: &mut ViewContext<Self>) -> AnyElement {
let Some(mode) = self.mode.as_ref() else { let Some(mode) = self.mode.as_ref() else {
return div().into_any(); return div().into_any();
}; };

View file

@ -4,7 +4,7 @@ use editor::{
movement::{self, find_boundary, find_preceding_boundary, FindRange, TextLayoutDetails}, movement::{self, find_boundary, find_preceding_boundary, FindRange, TextLayoutDetails},
Bias, CharKind, DisplayPoint, ToOffset, 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 language::{Point, Selection, SelectionGoal};
use serde::Deserialize; use serde::Deserialize;
use workspace::Workspace; use workspace::Workspace;
@ -139,7 +139,7 @@ actions!(
] ]
); );
pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) { pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
workspace.register_action(|_: &mut Workspace, _: &Left, cx: _| motion(Motion::Left, cx)); workspace.register_action(|_: &mut Workspace, _: &Left, cx: _| motion(Motion::Left, cx));
workspace workspace
.register_action(|_: &mut Workspace, _: &Backspace, cx: _| motion(Motion::Backspace, cx)); .register_action(|_: &mut Workspace, _: &Backspace, cx: _| motion(Motion::Backspace, cx));

View file

@ -53,7 +53,6 @@ actions!(
); );
pub(crate) fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) { pub(crate) fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
dbg!("registering");
workspace.register_action(insert_after); workspace.register_action(insert_after);
workspace.register_action(insert_before); workspace.register_action(insert_before);
workspace.register_action(insert_first_non_whitespace); workspace.register_action(insert_first_non_whitespace);

View file

@ -1,7 +1,7 @@
use std::ops::Range; use std::ops::Range;
use editor::{scroll::autoscroll::Autoscroll, MultiBufferSnapshot, ToOffset, ToPoint}; 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 language::{Bias, Point};
use serde::Deserialize; use serde::Deserialize;
use workspace::Workspace; use workspace::Workspace;
@ -24,7 +24,7 @@ struct Decrement {
impl_actions!(vim, [Increment, Decrement]); impl_actions!(vim, [Increment, Decrement]);
pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) { pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
workspace.register_action(|_: &mut Workspace, action: &Increment, cx| { workspace.register_action(|_: &mut Workspace, action: &Increment, cx| {
Vim::update(cx, |vim, cx| { Vim::update(cx, |vim, cx| {
vim.record_current_action(cx); vim.record_current_action(cx);

View file

@ -5,7 +5,7 @@ use crate::{
visual::visual_motion, visual::visual_motion,
Vim, Vim,
}; };
use gpui::{actions, Action, AppContext, ViewContext, WindowContext}; use gpui::{actions, Action, ViewContext, WindowContext};
use workspace::Workspace; use workspace::Workspace;
actions!(vim, [Repeat, EndRepeat]); actions!(vim, [Repeat, EndRepeat]);

View file

@ -4,7 +4,7 @@ use editor::{
scroll::{scroll_amount::ScrollAmount, VERTICAL_SCROLL_MARGIN}, scroll::{scroll_amount::ScrollAmount, VERTICAL_SCROLL_MARGIN},
DisplayPoint, Editor, DisplayPoint, Editor,
}; };
use gpui::{actions, AppContext, ViewContext}; use gpui::{actions, ViewContext};
use language::Bias; use language::Bias;
use workspace::Workspace; use workspace::Workspace;
@ -13,7 +13,7 @@ actions!(
[LineUp, LineDown, ScrollUp, ScrollDown, PageUp, PageDown] [LineUp, LineDown, ScrollUp, ScrollDown, PageUp, PageDown]
); );
pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) { pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
workspace.register_action(|_: &mut Workspace, _: &LineDown, cx| { workspace.register_action(|_: &mut Workspace, _: &LineDown, cx| {
scroll(cx, false, |c| ScrollAmount::Line(c.unwrap_or(1.))) scroll(cx, false, |c| ScrollAmount::Line(c.unwrap_or(1.)))
}); });

View file

@ -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 search::{buffer_search, BufferSearchBar, SearchMode, SearchOptions};
use serde_derive::Deserialize; 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}; use crate::{motion::Motion, normal::move_cursor, state::SearchState, Vim};
@ -50,7 +50,7 @@ impl_actions!(
[FindCommand, ReplaceCommand, Search, MoveToPrev, MoveToNext] [FindCommand, ReplaceCommand, Search, MoveToPrev, MoveToNext]
); );
pub(crate) fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) { pub(crate) fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
workspace.register_action(move_to_next); workspace.register_action(move_to_next);
workspace.register_action(move_to_prev); workspace.register_action(move_to_prev);
workspace.register_action(search); workspace.register_action(search);

View file

@ -6,7 +6,7 @@ use editor::{
movement::{self, FindRange}, movement::{self, FindRange},
Bias, CharKind, DisplayPoint, Bias, CharKind, DisplayPoint,
}; };
use gpui::{actions, impl_actions, Action, AppContext, ViewContext, WindowContext}; use gpui::{actions, impl_actions, ViewContext, WindowContext};
use language::Selection; use language::Selection;
use serde::Deserialize; use serde::Deserialize;
use workspace::Workspace; use workspace::Workspace;
@ -51,7 +51,7 @@ actions!(
] ]
); );
pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) { pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
workspace.register_action( workspace.register_action(
|_: &mut Workspace, &Word { ignore_punctuation }: &Word, cx: _| { |_: &mut Workspace, &Word { ignore_punctuation }: &Word, cx: _| {
object(Object::Word { ignore_punctuation }, cx) object(Object::Word { ignore_punctuation }, cx)

View file

@ -18,7 +18,7 @@ use command_palette::CommandPaletteInterceptor;
use editor::{movement, Editor, EditorEvent, EditorMode}; use editor::{movement, Editor, EditorEvent, EditorMode};
use gpui::{ use gpui::{
actions, impl_actions, Action, AppContext, EntityId, KeyContext, Subscription, View, actions, impl_actions, Action, AppContext, EntityId, KeyContext, Subscription, View,
ViewContext, WeakModel, WeakView, WindowContext, ViewContext, WeakView, WindowContext,
}; };
use language::{CursorShape, Point, Selection, SelectionGoal}; use language::{CursorShape, Point, Selection, SelectionGoal};
pub use mode_indicator::ModeIndicator; pub use mode_indicator::ModeIndicator;
@ -116,7 +116,7 @@ fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
visual::register(workspace, cx); visual::register(workspace, cx);
} }
pub fn observe_keystrokes(cx: &mut WindowContext) { pub fn observe_keystrokes(_: &mut WindowContext) {
// todo!() // todo!()
// cx.observe_keystrokes(|_keystroke, result, handled_by, cx| { // cx.observe_keystrokes(|_keystroke, result, handled_by, cx| {

View file

@ -8,7 +8,7 @@ use editor::{
scroll::autoscroll::Autoscroll, scroll::autoscroll::Autoscroll,
Bias, DisplayPoint, Editor, Bias, DisplayPoint, Editor,
}; };
use gpui::{actions, AppContext, ViewContext, WindowContext}; use gpui::{actions, ViewContext, WindowContext};
use language::{Selection, SelectionGoal}; use language::{Selection, SelectionGoal};
use workspace::Workspace; use workspace::Workspace;
@ -34,7 +34,7 @@ actions!(
] ]
); );
pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) { pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
workspace.register_action(|_, _: &ToggleVisual, cx: &mut ViewContext<Workspace>| { workspace.register_action(|_, _: &ToggleVisual, cx: &mut ViewContext<Workspace>| {
toggle_mode(Mode::Visual, cx) toggle_mode(Mode::Visual, cx)
}); });