Support workspace diagnostic refresh
This commit is contained in:
parent
760c5a8105
commit
afabbc9844
5 changed files with 20 additions and 3 deletions
|
@ -571,6 +571,9 @@ impl Client {
|
|||
did_rename: Some(true),
|
||||
..Default::default()
|
||||
}),
|
||||
diagnostic: Some(lsp::DiagnosticWorkspaceClientCapabilities {
|
||||
refresh_support: Some(true),
|
||||
}),
|
||||
..Default::default()
|
||||
}),
|
||||
text_document: Some(lsp::TextDocumentClientCapabilities {
|
||||
|
|
|
@ -10,6 +10,7 @@ pub use client::Client;
|
|||
pub use futures_executor::block_on;
|
||||
pub use helix_lsp_types as lsp;
|
||||
pub use jsonrpc::Call;
|
||||
use lsp::request::Request;
|
||||
pub use lsp::{Position, Url};
|
||||
|
||||
use futures_util::stream::select_all::SelectAll;
|
||||
|
@ -569,7 +570,6 @@ pub enum MethodCall {
|
|||
|
||||
impl MethodCall {
|
||||
pub fn parse(method: &str, params: jsonrpc::Params) -> Result<MethodCall> {
|
||||
use lsp::request::Request;
|
||||
let request = match method {
|
||||
lsp::request::WorkDoneProgressCreate::METHOD => {
|
||||
let params: lsp::WorkDoneProgressCreateParams = params.parse()?;
|
||||
|
@ -614,6 +614,7 @@ pub enum Notification {
|
|||
ShowMessage(lsp::ShowMessageParams),
|
||||
LogMessage(lsp::LogMessageParams),
|
||||
ProgressMessage(lsp::ProgressParams),
|
||||
WorkspaceDiagnosticRefresh,
|
||||
}
|
||||
|
||||
impl Notification {
|
||||
|
@ -640,6 +641,7 @@ impl Notification {
|
|||
let params: lsp::ProgressParams = params.parse()?;
|
||||
Self::ProgressMessage(params)
|
||||
}
|
||||
lsp::request::WorkspaceDiagnosticRefresh::METHOD => Self::WorkspaceDiagnosticRefresh,
|
||||
_ => {
|
||||
return Err(Error::Unhandled);
|
||||
}
|
||||
|
|
|
@ -703,6 +703,15 @@ impl Application {
|
|||
};
|
||||
|
||||
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 => {
|
||||
let language_server = language_server!();
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ pub use helix_view::handlers::Handlers;
|
|||
|
||||
mod auto_save;
|
||||
pub mod completion;
|
||||
mod diagnostics;
|
||||
pub mod diagnostics;
|
||||
mod signature_help;
|
||||
|
||||
pub fn setup(config: Arc<ArcSwap<Config>>) -> Handlers {
|
||||
|
|
|
@ -114,7 +114,10 @@ impl helix_event::AsyncHook for PullDiagnosticsHandler {
|
|||
}
|
||||
}
|
||||
|
||||
fn pull_diagnostics_for_document(doc: &helix_view::Document, language_server: &helix_lsp::Client) {
|
||||
pub fn pull_diagnostics_for_document(
|
||||
doc: &helix_view::Document,
|
||||
language_server: &helix_lsp::Client,
|
||||
) {
|
||||
let Some(future) = language_server
|
||||
.text_document_diagnostic(doc.identifier(), doc.previous_diagnostic_id.clone())
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue