mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-25 19:03:30 +04:00
Remove unused function
This commit is contained in:
parent
fb56f6a56b
commit
8084a2c746
@ -25,7 +25,7 @@
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
cell::Cell,
|
||||
collections::{btree_map::Entry, BTreeMap, HashMap, HashSet},
|
||||
collections::{BTreeMap, HashMap, HashSet},
|
||||
fs,
|
||||
io::{self, stdin},
|
||||
num::NonZeroUsize,
|
||||
@ -1934,31 +1934,6 @@ pub fn document_by_path_mut<P: AsRef<Path>>(&mut self, path: P) -> Option<&mut D
|
||||
.find(|doc| doc.path().map(|p| p == path.as_ref()).unwrap_or(false))
|
||||
}
|
||||
|
||||
pub fn add_diagnostics(
|
||||
&mut self,
|
||||
diagnostics: Vec<lsp::Diagnostic>,
|
||||
path: lsp::Url,
|
||||
server_id: LanguageServerId,
|
||||
) {
|
||||
let mut diagnostics = diagnostics.into_iter().map(|d| (d, server_id)).collect();
|
||||
let uri = helix_core::Uri::try_from(path).unwrap();
|
||||
match self.diagnostics.entry(uri) {
|
||||
Entry::Occupied(o) => {
|
||||
let current_diagnostics = o.into_mut();
|
||||
// there may entries of other language servers, which is why we can't overwrite the whole entry
|
||||
current_diagnostics.retain(|(_, lsp_id)| *lsp_id != server_id);
|
||||
current_diagnostics.append(&mut diagnostics);
|
||||
// Sort diagnostics first by severity and then by line numbers.
|
||||
// Note: The `lsp::DiagnosticSeverity` enum is already defined in decreasing order
|
||||
current_diagnostics.sort_unstable_by_key(|(d, _)| (d.severity, d.range.start));
|
||||
}
|
||||
Entry::Vacant(v) => {
|
||||
diagnostics.sort_unstable_by_key(|(d, _)| (d.severity, d.range.start));
|
||||
v.insert(diagnostics);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns all supported diagnostics for the document
|
||||
pub fn doc_diagnostics<'a>(
|
||||
language_servers: &'a helix_lsp::Registry,
|
||||
|
Loading…
Reference in New Issue
Block a user