Code cleanup

pull/6486/head
Jonatan Pettersson 3 months ago
parent 67eaf5cd55
commit ae5844af8c

@ -546,9 +546,9 @@ pub fn workspace_diagnostics_picker(cx: &mut Context) {
cx.push_layer(Box::new(overlaid(picker)));
}
pub struct CodeActionOrCommandItem {
pub lsp_item: lsp::CodeActionOrCommand,
pub language_server_id: LanguageServerId,
struct CodeActionOrCommandItem {
lsp_item: lsp::CodeActionOrCommand,
language_server_id: LanguageServerId,
}
impl ui::menu::Item for CodeActionOrCommandItem {
@ -842,7 +842,7 @@ pub fn code_actions_on_save(cx: &mut compositor::Context, doc_id: &DocumentId) {
}
}
pub fn apply_code_action(editor: &mut Editor, action: &CodeActionOrCommandItem) {
fn apply_code_action(editor: &mut Editor, action: &CodeActionOrCommandItem) {
let Some(language_server) = editor.language_server_by_id(action.language_server_id) else {
editor.set_error("Language Server disappeared");
return;

@ -12,7 +12,6 @@ use helix_core::{line_ending, shellwords::Shellwords};
use helix_view::document::{read_to_string, DEFAULT_LANGUAGE_NAME};
use helix_view::editor::{CloseError, ConfigEvent};
use serde_json::Value;
use ui::completers::{self, Completer};
#[derive(Clone)]

@ -9,6 +9,11 @@ use super::*;
// Give time to send textDocument/didOpen notification
const IDLE_TIMEOUT: std::time::Duration = std::time::Duration::from_millis(500);
// Gopls does not use native line endings so set default line ending
// to LF to avoid issues in Windows tests.
const DEFAULT_LINE_ENDING: helix_view::editor::LineEndingConfig =
helix_view::editor::LineEndingConfig::LF;
// Check that we have gopls available while also allowing
// for gopls to initialize
fn assert_gopls(app: &Application, path: &Path) {
@ -22,9 +27,6 @@ fn assert_gopls(app: &Application, path: &Path) {
if let Some(gopls) = ls {
if gopls.is_initialized() {
initialized = true;
// TODO: Make this deterministic
// Sleep to give time to send textDocument/didOpen notification
// std::thread::sleep(std::time::Duration::from_millis(IDLE_TIMEOUT));
break;
}
}
@ -74,7 +76,7 @@ async fn test_organize_imports_go() -> anyhow::Result<()> {
.with_config(Config {
editor: helix_view::editor::Config {
idle_timeout: IDLE_TIMEOUT,
default_line_ending: helix_view::editor::LineEndingConfig::LF,
default_line_ending: DEFAULT_LINE_ENDING,
..Default::default()
},
..Default::default()
@ -134,7 +136,7 @@ async fn test_organize_imports_go_write_all_quit() -> anyhow::Result<()> {
.with_config(Config {
editor: helix_view::editor::Config {
idle_timeout: IDLE_TIMEOUT,
default_line_ending: helix_view::editor::LineEndingConfig::LF,
default_line_ending: DEFAULT_LINE_ENDING,
..Default::default()
},
..Default::default()
@ -204,7 +206,7 @@ async fn test_invalid_code_action_go() -> anyhow::Result<()> {
.with_config(Config {
editor: helix_view::editor::Config {
idle_timeout: IDLE_TIMEOUT,
default_line_ending: helix_view::editor::LineEndingConfig::LF,
default_line_ending: DEFAULT_LINE_ENDING,
..Default::default()
},
..Default::default()

Loading…
Cancel
Save