mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-26 03:13:29 +04:00
Remove unused function
This commit is contained in:
parent
fb56f6a56b
commit
8084a2c746
@ -25,7 +25,7 @@
|
|||||||
use std::{
|
use std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
cell::Cell,
|
cell::Cell,
|
||||||
collections::{btree_map::Entry, BTreeMap, HashMap, HashSet},
|
collections::{BTreeMap, HashMap, HashSet},
|
||||||
fs,
|
fs,
|
||||||
io::{self, stdin},
|
io::{self, stdin},
|
||||||
num::NonZeroUsize,
|
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))
|
.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
|
/// Returns all supported diagnostics for the document
|
||||||
pub fn doc_diagnostics<'a>(
|
pub fn doc_diagnostics<'a>(
|
||||||
language_servers: &'a helix_lsp::Registry,
|
language_servers: &'a helix_lsp::Registry,
|
||||||
|
Loading…
Reference in New Issue
Block a user