diff options
author | Blaž Hrastnik | 2021-04-15 08:34:38 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-04-15 08:34:38 +0000 |
commit | 3b90317060d92de803befbbfc5ffc2929e85a9c0 (patch) | |
tree | b678cf99d6ea2b60eda14af986c86b4586a98d55 | |
parent | 305a059f583ba0de3217506d4f89fc462de98cc0 (diff) |
Add window/showMessage / logMessage stubs so gopls fully starts.
-rw-r--r-- | helix-lsp/src/lib.rs | 15 | ||||
-rw-r--r-- | helix-term/src/application.rs | 7 | ||||
-rw-r--r-- | languages.toml | 2 |
3 files changed, 23 insertions, 1 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index dd925c14..6dcc6605 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -123,6 +123,8 @@ pub mod util { #[derive(Debug, PartialEq, Clone)] pub enum Notification { PublishDiagnostics(lsp::PublishDiagnosticsParams), + ShowMessage(lsp::ShowMessageParams), + LogMessage(lsp::LogMessageParams), } impl Notification { @@ -138,6 +140,19 @@ impl Notification { // TODO: need to loop over diagnostics and distinguish them by URI Notification::PublishDiagnostics(params) } + + lsp::notification::ShowMessage::METHOD => { + let params: lsp::ShowMessageParams = + params.parse().expect("Failed to parse ShowMessage params"); + + Notification::ShowMessage(params) + } + lsp::notification::LogMessage::METHOD => { + let params: lsp::LogMessageParams = + params.parse().expect("Failed to parse ShowMessage params"); + + Notification::LogMessage(params) + } _ => unimplemented!("unhandled notification: {}", method), } } diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index b3ddbe15..8849ee81 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -152,6 +152,7 @@ impl Application { match call { Call::Notification(helix_lsp::jsonrpc::Notification { method, params, .. }) => { let notification = Notification::parse(&method, params); + // TODO: parse should return Result/Option match notification { Notification::PublishDiagnostics(params) => { let path = Some(params.uri.to_file_path().unwrap()); @@ -213,6 +214,12 @@ impl Application { self.render(); } } + Notification::ShowMessage(params) => { + log::warn!("unhandled window/showMessage: {:?}", params); + } + Notification::LogMessage(params) => { + log::warn!("unhandled window/logMessage: {:?}", params); + } _ => unreachable!(), } } diff --git a/languages.toml b/languages.toml index 37e8ec36..ed6417ee 100644 --- a/languages.toml +++ b/languages.toml @@ -52,7 +52,7 @@ file-types = ["go"] roots = ["Gopkg.toml", "go.mod"] language-server = { command = "gopls" } -# TODO: gopls needs utf-8 offsets +# TODO: gopls needs utf-8 offsets? indent = { tab-width = 2, unit = " " } [[language]] |