on master help sign in
Add window/showMessage / logMessage stubs so gopls fully starts.
commit3b90317060d92de803befbbfc5ffc2929e85a9c0 authorBlaž Hrastnik <blaz@mxxn.io> dateThu 15 Apr 2021, 17:34 (6 years ago) parent305a059
3 files changed+23−1
helix-lsp/src/lib.rs+15 helix-term/src/application.rs+7 languages.toml+1−1
helix-lsp/src/lib.rs+15
@@ -123,6 +123,8 @@ pub mod util {
123123#[derive(Debug, PartialEq, Clone)]
124124pub enum Notification {
125125 PublishDiagnostics(lsp::PublishDiagnosticsParams),
126+ ShowMessage(lsp::ShowMessageParams),
127+ LogMessage(lsp::LogMessageParams),
126128}
127129
128130impl Notification {
@@ -138,6 +140,19 @@ impl Notification {
138140 // TODO: need to loop over diagnostics and distinguish them by URI
139141 Notification::PublishDiagnostics(params)
140142 }
143+
144+ lsp::notification::ShowMessage::METHOD => {
145+ let params: lsp::ShowMessageParams =
146+ params.parse().expect("Failed to parse ShowMessage params");
147+
148+ Notification::ShowMessage(params)
149+ }
150+ lsp::notification::LogMessage::METHOD => {
151+ let params: lsp::LogMessageParams =
152+ params.parse().expect("Failed to parse ShowMessage params");
153+
154+ Notification::LogMessage(params)
155+ }
141156 _ => unimplemented!("unhandled notification: {}", method),
142157 }
143158 }
helix-term/src/application.rs+7
@@ -152,6 +152,7 @@ impl Application {
152152 match call {
153153 Call::Notification(helix_lsp::jsonrpc::Notification { method, params, .. }) => {
154154 let notification = Notification::parse(&method, params);
155+ // TODO: parse should return Result/Option
155156 match notification {
156157 Notification::PublishDiagnostics(params) => {
157158 let path = Some(params.uri.to_file_path().unwrap());
@@ -213,6 +214,12 @@ impl Application {
213214 self.render();
214215 }
215216 }
217+ Notification::ShowMessage(params) => {
218+ log::warn!("unhandled window/showMessage: {:?}", params);
219+ }
220+ Notification::LogMessage(params) => {
221+ log::warn!("unhandled window/logMessage: {:?}", params);
222+ }
216223 _ => unreachable!(),
217224 }
218225 }
languages.toml+1−1
@@ -52,7 +52,7 @@ file-types = ["go"]
5252roots = ["Gopkg.toml", "go.mod"]
5353
5454language-server = { command = "gopls" }
55−# TODO: gopls needs utf-8 offsets
55+# TODO: gopls needs utf-8 offsets?
5656indent = { tab-width = 2, unit = " " }
5757
5858[[language]]