aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands/typed.rs
diff options
context:
space:
mode:
authorPascal Kuthe2023-01-30 23:31:21 +0000
committerBlaž Hrastnik2023-03-29 03:57:30 +0000
commit2d10a429ebf7abe5af184b6227346377dc0523e8 (patch)
tree114b19f0031fc001d7798a31372675a94623262f /helix-term/src/commands/typed.rs
parentd59b80514e15d26f280a9b0dbd18afac08578638 (diff)
add workspace config and manual LSP root management
fixup documentation Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> fixup typo Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
Diffstat (limited to 'helix-term/src/commands/typed.rs')
-rw-r--r--helix-term/src/commands/typed.rs26
1 files changed, 25 insertions, 1 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 2c72686d..ca55151a 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -1371,13 +1371,16 @@ fn lsp_restart(
return Ok(());
}
+ let editor_config = cx.editor.config.load();
let (_view, doc) = current!(cx.editor);
let config = doc
.language_config()
.context("LSP not defined for the current document")?;
let scope = config.scope.clone();
- cx.editor.language_servers.restart(config, doc.path())?;
+ cx.editor
+ .language_servers
+ .restart(config, doc.path(), &editor_config.workspace_lsp_roots)?;
// This collect is needed because refresh_language_server would need to re-borrow editor.
let document_ids_to_refresh: Vec<DocumentId> = cx
@@ -1970,6 +1973,20 @@ fn open_config(
Ok(())
}
+fn open_workspace_config(
+ cx: &mut compositor::Context,
+ _args: &[Cow<str>],
+ event: PromptEvent,
+) -> anyhow::Result<()> {
+ if event != PromptEvent::Validate {
+ return Ok(());
+ }
+
+ cx.editor
+ .open(&helix_loader::workspace_config_file(), Action::Replace)?;
+ Ok(())
+}
+
fn open_log(
cx: &mut compositor::Context,
_args: &[Cow<str>],
@@ -2647,6 +2664,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
signature: CommandSignature::none(),
},
TypableCommand {
+ name: "config-open-workspace",
+ aliases: &[],
+ doc: "Open the workspace config.toml file.",
+ fun: open_workspace_config,
+ signature: CommandSignature::none(),
+ },
+ TypableCommand {
name: "log-open",
aliases: &[],
doc: "Open the helix log file.",