aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-10-21 04:47:20 +0000
committerBlaž Hrastnik2020-12-03 04:10:34 +0000
commitef5e5f9296d27d11ddfddf6d1c7daf93f9464ddb (patch)
tree9a9189b1f19a895e24b39dd9718baa8320979bc8 /helix-term
parent49254d7180c8b92be5426cab20914b0343c9282c (diff)
state.version tracking
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs33
1 files changed, 7 insertions, 26 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 5551e26f..a1a6b9ea 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -568,23 +568,12 @@ impl<'a> Application<'a> {
use helix_lsp::Notification;
match notification {
Some(Notification::PublishDiagnostics(params)) => {
- let view = self.editor.views.iter_mut().find(|view| {
- let path = view
- .state
- .path
- .as_ref()
- .map(|path| helix_lsp::Url::from_file_path(path).unwrap());
-
- eprintln!("{:?} {} {}", path, params.uri, params.diagnostics.len());
- // HAXX
- path == Some(params.uri.clone())
- });
-
- fn lsp_pos_to_pos(doc: &helix_core::RopeSlice, pos: helix_lsp::Position) -> usize {
- let line = doc.line_to_char(pos.line as usize);
- let line_start = doc.char_to_utf16_cu(line);
- doc.utf16_cu_to_char(pos.character as usize + line_start)
- }
+ let path = Some(params.uri.to_file_path().unwrap());
+ let view = self
+ .editor
+ .views
+ .iter_mut()
+ .find(|view| view.state.path == path);
if let Some(view) = view {
let doc = view.state.doc().slice(..);
@@ -592,18 +581,10 @@ impl<'a> Application<'a> {
.diagnostics
.into_iter()
.map(|diagnostic| {
+ use helix_lsp::util::lsp_pos_to_pos;
let start = lsp_pos_to_pos(&doc, diagnostic.range.start);
let end = lsp_pos_to_pos(&doc, diagnostic.range.end);
- // eprintln!(
- // "{:?}-{:?} {}-{} {}",
- // diagnostic.range.start,
- // diagnostic.range.end,
- // start,
- // end,
- // diagnostic.message
- // );
-
helix_core::Diagnostic {
range: (start, end),
line: diagnostic.range.start.line as usize,