mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
Add window/showMessage / logMessage stubs so gopls fully starts.
This commit is contained in:
parent
305a059f58
commit
3b90317060
@ -123,6 +123,8 @@ pub fn generate_transaction_from_edits(
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum Notification {
|
||||
PublishDiagnostics(lsp::PublishDiagnosticsParams),
|
||||
ShowMessage(lsp::ShowMessageParams),
|
||||
LogMessage(lsp::LogMessageParams),
|
||||
}
|
||||
|
||||
impl Notification {
|
||||
@ -138,6 +140,19 @@ pub fn parse(method: &str, params: jsonrpc::Params) -> 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),
|
||||
}
|
||||
}
|
||||
|
@ -152,6 +152,7 @@ pub async fn handle_language_server_message(&mut self, call: helix_lsp::Call) {
|
||||
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 @@ pub async fn handle_language_server_message(&mut self, call: helix_lsp::Call) {
|
||||
self.render();
|
||||
}
|
||||
}
|
||||
Notification::ShowMessage(params) => {
|
||||
log::warn!("unhandled window/showMessage: {:?}", params);
|
||||
}
|
||||
Notification::LogMessage(params) => {
|
||||
log::warn!("unhandled window/logMessage: {:?}", params);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
@ -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]]
|
||||
|
Loading…
Reference in New Issue
Block a user