summaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/diagnostic.rs1
-rw-r--r--helix-core/src/lib.rs2
-rw-r--r--helix-core/src/state.rs10
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)
}