aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp
diff options
context:
space:
mode:
Diffstat (limited to 'helix-lsp')
-rw-r--r--helix-lsp/src/client.rs21
-rw-r--r--helix-lsp/src/lib.rs7
2 files changed, 28 insertions, 0 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs
index 362498cb..1ce5158b 100644
--- a/helix-lsp/src/client.rs
+++ b/helix-lsp/src/client.rs
@@ -113,6 +113,10 @@ impl Client {
self.offset_encoding
}
+ pub fn config(&self) -> Option<&Value> {
+ self.config.as_ref()
+ }
+
/// Execute a RPC request on the language server.
async fn request<R: lsp::request::Request>(&self, params: R::Params) -> Result<R::Result>
where
@@ -246,6 +250,13 @@ impl Client {
root_uri: root,
initialization_options: self.config.clone(),
capabilities: lsp::ClientCapabilities {
+ workspace: Some(lsp::WorkspaceClientCapabilities {
+ configuration: Some(true),
+ did_change_configuration: Some(lsp::DynamicRegistrationClientCapabilities {
+ dynamic_registration: Some(false),
+ }),
+ ..Default::default()
+ }),
text_document: Some(lsp::TextDocumentClientCapabilities {
completion: Some(lsp::CompletionClientCapabilities {
completion_item: Some(lsp::CompletionItemCapability {
@@ -331,6 +342,16 @@ impl Client {
}
// -------------------------------------------------------------------------------------------
+ // Workspace
+ // -------------------------------------------------------------------------------------------
+
+ pub fn did_change_configuration(&self, settings: Value) -> impl Future<Output = Result<()>> {
+ self.notify::<lsp::notification::DidChangeConfiguration>(
+ lsp::DidChangeConfigurationParams { settings },
+ )
+ }
+
+ // -------------------------------------------------------------------------------------------
// Text document
// -------------------------------------------------------------------------------------------
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index 109546d0..389dfb4d 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -191,6 +191,7 @@ pub mod util {
pub enum MethodCall {
WorkDoneProgressCreate(lsp::WorkDoneProgressCreateParams),
ApplyWorkspaceEdit(lsp::ApplyWorkspaceEditParams),
+ WorkspaceConfiguration(lsp::ConfigurationParams),
}
impl MethodCall {
@@ -209,6 +210,12 @@ impl MethodCall {
.expect("Failed to parse ApplyWorkspaceEdit params");
Self::ApplyWorkspaceEdit(params)
}
+ lsp::request::WorkspaceConfiguration::METHOD => {
+ let params: lsp::ConfigurationParams = params
+ .parse()
+ .expect("Failed to parse WorkspaceConfiguration params");
+ Self::WorkspaceConfiguration(params)
+ }
_ => {
log::warn!("unhandled lsp request: {}", method);
return None;