workspace diagnostic refresh as request

pull/11315/head
Sofus Addington 3 months ago
parent 7b9efd85b5
commit daede03dc6

@ -566,6 +566,7 @@ pub enum MethodCall {
RegisterCapability(lsp::RegistrationParams), RegisterCapability(lsp::RegistrationParams),
UnregisterCapability(lsp::UnregistrationParams), UnregisterCapability(lsp::UnregistrationParams),
ShowDocument(lsp::ShowDocumentParams), ShowDocument(lsp::ShowDocumentParams),
WorkspaceDiagnosticRefresh,
} }
impl MethodCall { impl MethodCall {
@ -596,6 +597,7 @@ impl MethodCall {
let params: lsp::ShowDocumentParams = params.parse()?; let params: lsp::ShowDocumentParams = params.parse()?;
Self::ShowDocument(params) Self::ShowDocument(params)
} }
lsp::request::WorkspaceDiagnosticRefresh::METHOD => Self::WorkspaceDiagnosticRefresh,
_ => { _ => {
return Err(Error::Unhandled); return Err(Error::Unhandled);
} }
@ -614,7 +616,6 @@ pub enum Notification {
ShowMessage(lsp::ShowMessageParams), ShowMessage(lsp::ShowMessageParams),
LogMessage(lsp::LogMessageParams), LogMessage(lsp::LogMessageParams),
ProgressMessage(lsp::ProgressParams), ProgressMessage(lsp::ProgressParams),
WorkspaceDiagnosticRefresh,
} }
impl Notification { impl Notification {
@ -641,7 +642,6 @@ impl Notification {
let params: lsp::ProgressParams = params.parse()?; let params: lsp::ProgressParams = params.parse()?;
Self::ProgressMessage(params) Self::ProgressMessage(params)
} }
lsp::request::WorkspaceDiagnosticRefresh::METHOD => Self::WorkspaceDiagnosticRefresh,
_ => { _ => {
return Err(Error::Unhandled); return Err(Error::Unhandled);
} }

@ -703,15 +703,6 @@ impl Application {
}; };
match notification { match notification {
Notification::WorkspaceDiagnosticRefresh => {
for document in self.editor.documents() {
let langugage_server = language_server!();
handlers::diagnostics::pull_diagnostics_for_document(
document,
langugage_server,
);
}
}
Notification::Initialized => { Notification::Initialized => {
let language_server = language_server!(); let language_server = language_server!();
@ -744,7 +735,10 @@ impl Application {
language_id, language_id,
)); ));
helix_event::dispatch(helix_view::events::DocumentDidOpen { doc }); handlers::diagnostics::pull_diagnostics_for_document(
doc,
language_server,
);
} }
} }
Notification::PublishDiagnostics(params) => { Notification::PublishDiagnostics(params) => {
@ -1040,6 +1034,18 @@ impl Application {
let result = self.handle_show_document(params, offset_encoding); let result = self.handle_show_document(params, offset_encoding);
Ok(json!(result)) Ok(json!(result))
} }
Ok(MethodCall::WorkspaceDiagnosticRefresh) => {
log::warn!("Sofus refresh");
for document in self.editor.documents() {
let language_server = language_server!();
handlers::diagnostics::pull_diagnostics_for_document(
document,
language_server,
);
}
Ok(serde_json::Value::Null)
}
}; };
tokio::spawn(language_server!().reply(id, reply)); tokio::spawn(language_server!().reply(id, reply));

Loading…
Cancel
Save