From d1515671928d577481d7a77c5fef25b1f1b157fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 5 Apr 2022 16:06:13 +0900 Subject: [PATCH] it compiles! --- helix-view/src/commands/typed.rs | 2 ++ helix-view/src/compositor.rs | 1 + helix-view/src/keymap/default.rs | 18 +++++++++--------- helix-view/src/ui/editor.rs | 6 ++++++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/helix-view/src/commands/typed.rs b/helix-view/src/commands/typed.rs index 3e8a8c293..c5e78d97c 100644 --- a/helix-view/src/commands/typed.rs +++ b/helix-view/src/commands/typed.rs @@ -994,6 +994,7 @@ fn set_option( }; let config = serde_json::from_value(config).map_err(field_error)?; + #[cfg(feature = "tokio")] cx.editor .config_events .0 @@ -1121,6 +1122,7 @@ fn refresh_config( _args: &[Cow], _event: PromptEvent, ) -> anyhow::Result<()> { + #[cfg(feature = "tokio")] cx.editor.config_events.0.send(ConfigEvent::Refresh)?; Ok(()) } diff --git a/helix-view/src/compositor.rs b/helix-view/src/compositor.rs index e367e54e0..f3e6e093c 100644 --- a/helix-view/src/compositor.rs +++ b/helix-view/src/compositor.rs @@ -190,6 +190,7 @@ impl Compositor { } } + #[cfg(feature = "term")] pub fn cursor(&self, area: Rect, editor: &Editor) -> (Option, CursorKind) { for layer in self.layers.iter().rev() { if let (Some(pos), kind) = layer.cursor(area, editor) { diff --git a/helix-view/src/keymap/default.rs b/helix-view/src/keymap/default.rs index a1037beb8..60bc5452d 100644 --- a/helix-view/src/keymap/default.rs +++ b/helix-view/src/keymap/default.rs @@ -43,10 +43,10 @@ pub fn default() -> HashMap { "h" => goto_line_start, "l" => goto_line_end, "s" => goto_first_nonwhitespace, - "d" => goto_definition, - "y" => goto_type_definition, - "r" => goto_reference, - "i" => goto_implementation, + // "d" => goto_definition, + // "y" => goto_type_definition, + // "r" => goto_reference, + // "i" => goto_implementation, "t" => goto_window_top, "c" => goto_window_center, "b" => goto_window_bottom, @@ -198,9 +198,9 @@ pub fn default() -> HashMap { "f" => file_picker, "F" => file_picker_in_current_directory, "b" => buffer_picker, - "s" => symbol_picker, - "S" => workspace_symbol_picker, - "a" => code_action, + // "s" => symbol_picker, + // "S" => workspace_symbol_picker, + // "a" => code_action, "'" => last_picker, "w" => { "Window" "C-w" | "w" => rotate_view, @@ -225,8 +225,8 @@ pub fn default() -> HashMap { "P" => paste_clipboard_before, "R" => replace_selections_with_clipboard, "/" => global_search, - "k" => hover, - "r" => rename_symbol, + // "k" => hover, + // "r" => rename_symbol, "?" => command_palette, }, "z" => { "View" diff --git a/helix-view/src/ui/editor.rs b/helix-view/src/ui/editor.rs index 2287a0649..0d4136b5d 100644 --- a/helix-view/src/ui/editor.rs +++ b/helix-view/src/ui/editor.rs @@ -55,6 +55,7 @@ impl EditorView { keymaps, on_next_key: None, last_insert: (commands::MappableCommand::normal_mode, Vec::new()), + #[cfg(feature = "term")] completion: None, spinners: ProgressSpinners::default(), } @@ -1189,6 +1190,7 @@ impl Component for EditorView { EventResult::Consumed(None) } Event::Key(mut key) => { + #[cfg(feature = "term")] cx.editor.reset_idle_timer(); canonicalize_key(&mut key); @@ -1206,6 +1208,7 @@ impl Component for EditorView { Mode::Insert => { // let completion swallow the event if necessary let mut consumed = false; + #[cfg(feature = "term")] if let Some(completion) = &mut self.completion { // use a fake context here let mut cx = Context { @@ -1226,6 +1229,7 @@ impl Component for EditorView { // if completion didn't take the event, we pass it onto commands if !consumed { + #[cfg(feature = "term")] if let Some(compl) = cx.editor.last_completion.take() { self.last_insert.1.push(InsertEvent::CompletionApply(compl)); } @@ -1236,6 +1240,7 @@ impl Component for EditorView { self.last_insert.1.push(InsertEvent::Key(key)); // lastly we recalculate completion + #[cfg(feature = "term")] if let Some(completion) = &mut self.completion { completion.update(&mut cx); if completion.is_empty() { @@ -1283,6 +1288,7 @@ impl Component for EditorView { }; self.last_insert.1.clear(); } + #[cfg(feature = "term")] (Mode::Insert, Mode::Normal) => { // if exiting insert mode, remove completion self.completion = None;