diff options
author | Blaž Hrastnik | 2020-10-20 04:58:34 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-12-03 04:10:32 +0000 |
commit | f9bfba4d96f80eb41beb91702558f6f165a0e70f (patch) | |
tree | e2e0296a01645cdcb7782a9bd8b4f1a55d3fbfd9 /helix-core/src | |
parent | 64b5b23315f12125a2c5b2f810fe5ac285bdfa79 (diff) |
Reroute LSP notification events into the main app event loop.
Diffstat (limited to 'helix-core/src')
-rw-r--r-- | helix-core/src/diagnostic.rs | 1 | ||||
-rw-r--r-- | helix-core/src/lib.rs | 2 | ||||
-rw-r--r-- | helix-core/src/state.rs | 10 |
3 files changed, 10 insertions, 3 deletions
diff --git a/helix-core/src/diagnostic.rs b/helix-core/src/diagnostic.rs new file mode 100644 index 00000000..aee648aa --- /dev/null +++ b/helix-core/src/diagnostic.rs @@ -0,0 +1 @@ +pub struct Diagnostic {} diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index 62d23a10..8458c36f 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -1,4 +1,5 @@ #![allow(unused)] +mod diagnostic; pub mod graphemes; mod history; pub mod indent; @@ -22,6 +23,7 @@ pub use selection::Range; pub use selection::Selection; pub use syntax::Syntax; +pub use diagnostic::Diagnostic; pub use history::History; pub use state::State; 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) } |