aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/state.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-10-20 04:58:34 +0000
committerBlaž Hrastnik2020-12-03 04:10:32 +0000
commitf9bfba4d96f80eb41beb91702558f6f165a0e70f (patch)
treee2e0296a01645cdcb7782a9bd8b4f1a55d3fbfd9 /helix-core/src/state.rs
parent64b5b23315f12125a2c5b2f810fe5ac285bdfa79 (diff)
Reroute LSP notification events into the main app event loop.
Diffstat (limited to 'helix-core/src/state.rs')
-rw-r--r--helix-core/src/state.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs
index 35e20aef..0f94f696 100644
--- a/helix-core/src/state.rs
+++ b/helix-core/src/state.rs
@@ -1,6 +1,6 @@
use crate::graphemes::{nth_next_grapheme_boundary, nth_prev_grapheme_boundary, RopeGraphemes};
use crate::syntax::LOADER;
-use crate::{ChangeSet, Position, Range, Rope, RopeSlice, Selection, Syntax};
+use crate::{ChangeSet, Diagnostic, Position, Range, Rope, RopeSlice, Selection, Syntax};
use anyhow::Error;
use std::path::PathBuf;
@@ -28,6 +28,8 @@ pub struct State {
/// Pending changes since last history commit.
pub changes: ChangeSet,
pub old_state: Option<(Rope, Selection)>,
+
+ pub diagnostics: Vec<Diagnostic>,
}
#[derive(Copy, Clone, PartialEq, Eq)]
@@ -58,12 +60,13 @@ impl State {
syntax: None,
changes,
old_state,
+ diagnostics: Vec::new(),
}
}
// TODO: passing scopes here is awkward
pub fn load(path: PathBuf, scopes: &[String]) -> Result<Self, Error> {
- use std::{env, fs::File, io::BufReader, path::PathBuf};
+ use std::{env, fs::File, io::BufReader};
let _current_dir = env::current_dir()?;
let doc = Rope::from_reader(BufReader::new(File::open(path.clone())?))?;
@@ -81,7 +84,8 @@ impl State {
state.syntax = Some(syntax);
};
- state.path = Some(path);
+ // canonicalize path to absolute value
+ state.path = Some(std::fs::canonicalize(path)?);
Ok(state)
}