on master help sign in
Add window/showMessage / logMessage stubs so gopls fully starts.
3b90317Blaž Hrastnik
helix-lsp/src/lib.rs+15
@@ -123,6 +123,8 @@ pub mod util {
123#[derive(Debug, PartialEq, Clone)]
123#[derive(Debug, PartialEq, Clone)]
124pub enum Notification {
124pub enum Notification {
125 PublishDiagnostics(lsp::PublishDiagnosticsParams),
125 PublishDiagnostics(lsp::PublishDiagnosticsParams),
126+ ShowMessage(lsp::ShowMessageParams),
127+ LogMessage(lsp::LogMessageParams),
126}
128}
127
129
128impl Notification {
130impl Notification {
@@ -138,6 +140,19 @@ impl Notification {
138 // TODO: need to loop over diagnostics and distinguish them by URI
140 // TODO: need to loop over diagnostics and distinguish them by URI
139 Notification::PublishDiagnostics(params)
141 Notification::PublishDiagnostics(params)
140 }
142 }
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+ }
141 _ => unimplemented!("unhandled notification: {}", method),
156 _ => unimplemented!("unhandled notification: {}", method),
142 }
157 }
143 }
158 }
helix-term/src/application.rs+7
@@ -152,6 +152,7 @@ impl Application {
152 match call {
152 match call {
153 Call::Notification(helix_lsp::jsonrpc::Notification { method, params, .. }) => {
153 Call::Notification(helix_lsp::jsonrpc::Notification { method, params, .. }) => {
154 let notification = Notification::parse(&method, params);
154 let notification = Notification::parse(&method, params);
155+ // TODO: parse should return Result/Option
155 match notification {
156 match notification {
156 Notification::PublishDiagnostics(params) => {
157 Notification::PublishDiagnostics(params) => {
157 let path = Some(params.uri.to_file_path().unwrap());
158 let path = Some(params.uri.to_file_path().unwrap());
@@ -213,6 +214,12 @@ impl Application {
213 self.render();
214 self.render();
214 }
215 }
215 }
216 }
217+ Notification::ShowMessage(params) => {
218+ log::warn!("unhandled window/showMessage: {:?}", params);
219+ }
220+ Notification::LogMessage(params) => {
221+ log::warn!("unhandled window/logMessage: {:?}", params);
222+ }
216 _ => unreachable!(),
223 _ => unreachable!(),
217 }
224 }
218 }
225 }
languages.toml+1−1
@@ -52,7 +52,7 @@ file-types = ["go"]
52roots = ["Gopkg.toml", "go.mod"]
52roots = ["Gopkg.toml", "go.mod"]
53
53
54language-server = { command = "gopls" }
54language-server = { command = "gopls" }
55−# TODO: gopls needs utf-8 offsets
55+# TODO: gopls needs utf-8 offsets?
56indent = { tab-width = 2, unit = " " }
56indent = { tab-width = 2, unit = " " }
57
57
58[[language]]
58[[language]]