Remove redundant checks
This commit is contained in:
parent
58447dae60
commit
fb56f6a56b
2 changed files with 1 additions and 19 deletions
|
@ -18,7 +18,7 @@ use parking_lot::Mutex;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::sync::{
|
use std::sync::{
|
||||||
atomic::{self, AtomicBool, AtomicU64, Ordering},
|
atomic::{AtomicU64, Ordering},
|
||||||
Arc,
|
Arc,
|
||||||
};
|
};
|
||||||
use std::{collections::HashMap, path::PathBuf};
|
use std::{collections::HashMap, path::PathBuf};
|
||||||
|
@ -60,7 +60,6 @@ pub struct Client {
|
||||||
initialize_notify: Arc<Notify>,
|
initialize_notify: Arc<Notify>,
|
||||||
/// workspace folders added while the server is still initializing
|
/// workspace folders added while the server is still initializing
|
||||||
req_timeout: u64,
|
req_timeout: u64,
|
||||||
supports_publish_diagnostic: AtomicBool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
|
@ -148,17 +147,6 @@ impl Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_publish_diagnostic(&self, val: bool) {
|
|
||||||
self.supports_publish_diagnostic
|
|
||||||
.fetch_or(val, atomic::Ordering::Relaxed);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether the server supports Publish Diagnostic
|
|
||||||
pub fn publish_diagnostic(&self) -> bool {
|
|
||||||
self.supports_publish_diagnostic
|
|
||||||
.load(atomic::Ordering::Relaxed)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn add_workspace_folder(
|
fn add_workspace_folder(
|
||||||
&self,
|
&self,
|
||||||
root_uri: Option<lsp::Url>,
|
root_uri: Option<lsp::Url>,
|
||||||
|
@ -244,7 +232,6 @@ impl Client {
|
||||||
root_uri,
|
root_uri,
|
||||||
workspace_folders: Mutex::new(workspace_folders),
|
workspace_folders: Mutex::new(workspace_folders),
|
||||||
initialize_notify: initialize_notify.clone(),
|
initialize_notify: initialize_notify.clone(),
|
||||||
supports_publish_diagnostic: AtomicBool::new(false),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok((client, server_rx, initialize_notify))
|
Ok((client, server_rx, initialize_notify))
|
||||||
|
|
|
@ -1432,11 +1432,6 @@ pub fn pull_diagnostic_for_current_doc(editor: &Editor, jobs: &mut crate::job::J
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
// Specialization does not say whether it is possible to have both types of diagnostics.
|
|
||||||
// Assume we should prefer PublishDiagnostic if possible
|
|
||||||
if language_server.publish_diagnostic() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let future = language_server
|
let future = language_server
|
||||||
.text_document_diagnostic(doc.identifier(), doc.previous_diagnostic_id.clone());
|
.text_document_diagnostic(doc.identifier(), doc.previous_diagnostic_id.clone());
|
||||||
|
|
Loading…
Add table
Reference in a new issue