summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs65
1 files changed, 29 insertions, 36 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 09b1ff61..ddf9e8d6 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -601,7 +601,7 @@ impl Application {
}
};
- match call {
+ let reply = match call {
MethodCall::WorkDoneProgressCreate(params) => {
self.lsp_progress.create(server_id, params.token);
@@ -613,16 +613,8 @@ impl Application {
if spinner.is_stopped() {
spinner.start();
}
- let language_server =
- match self.editor.language_servers.get_by_id(server_id) {
- Some(language_server) => language_server,
- None => {
- warn!("can't find language server with id `{}`", server_id);
- return;
- }
- };
- tokio::spawn(language_server.reply(id, Ok(serde_json::Value::Null)));
+ Ok(serde_json::Value::Null)
}
MethodCall::ApplyWorkspaceEdit(params) => {
apply_workspace_edit(
@@ -631,33 +623,19 @@ impl Application {
&params.edit,
);
+ Ok(json!(lsp::ApplyWorkspaceEditResponse {
+ applied: true,
+ failure_reason: None,
+ failed_change: None,
+ }))
+ }
+ MethodCall::WorkspaceFolders => {
let language_server =
- match self.editor.language_servers.get_by_id(server_id) {
- Some(language_server) => language_server,
- None => {
- warn!("can't find language server with id `{}`", server_id);
- return;
- }
- };
+ self.editor.language_servers.get_by_id(server_id).unwrap();
- tokio::spawn(language_server.reply(
- id,
- Ok(json!(lsp::ApplyWorkspaceEditResponse {
- applied: true,
- failure_reason: None,
- failed_change: None,
- })),
- ));
+ Ok(json!(language_server.workspace_folders()))
}
MethodCall::WorkspaceConfiguration(params) => {
- let language_server =
- match self.editor.language_servers.get_by_id(server_id) {
- Some(language_server) => language_server,
- None => {
- warn!("can't find language server with id `{}`", server_id);
- return;
- }
- };
let result: Vec<_> = params
.items
.iter()
@@ -668,7 +646,12 @@ impl Application {
let doc = self.editor.document_by_path(path)?;
doc.language_config()?.config.as_ref()?
}
- None => language_server.config()?,
+ None => self
+ .editor
+ .language_servers
+ .get_by_id(server_id)
+ .unwrap()
+ .config()?,
};
if let Some(section) = item.section.as_ref() {
for part in section.split('.') {
@@ -678,9 +661,19 @@ impl Application {
Some(config)
})
.collect();
- tokio::spawn(language_server.reply(id, Ok(json!(result))));
+ Ok(json!(result))
}
- }
+ };
+
+ let language_server = match self.editor.language_servers.get_by_id(server_id) {
+ Some(language_server) => language_server,
+ None => {
+ warn!("can't find language server with id `{}`", server_id);
+ return;
+ }
+ };
+
+ tokio::spawn(language_server.reply(id, reply));
}
Call::Invalid { id } => log::error!("LSP invalid method call id={:?}", id),
}