@@ -18,15 +18,13 @@ pub enum Mode {
19pub struct Document {
19pub struct Document {
20 pub state: State, // rope + selection
20 pub state: State, // rope + selection
21− /// File path on disk.
22 path: Option<PathBuf>,
21 path: Option<PathBuf>,
24 /// Current editing mode.
23 /// Current editing mode.
25 pub mode: Mode,
24 pub mode: Mode,
26 pub restore_cursor: bool,
25 pub restore_cursor: bool,
28− /// Tree-sitter AST tree
29− pub syntax: Option<Syntax>,
27+ syntax: Option<Syntax>,
30 // /// Corresponding language scope name. Usually `source.<lang>`.
28 // /// Corresponding language scope name. Usually `source.<lang>`.
31 pub(crate) language: Option<Arc<LanguageConfiguration>>,
29 pub(crate) language: Option<Arc<LanguageConfiguration>>,
@@ -36,7 +34,6 @@ pub struct Document {
36 old_state: Option<State>,
34 old_state: Option<State>,
37 /// Undo tree.
35 /// Undo tree.
38 history: History,
36 history: History,
39− /// Current document version, incremented at each change.
40 version: i32, // should be usize?
37 version: i32, // should be usize?
42 pub diagnostics: Vec<Diagnostic>,
39 pub diagnostics: Vec<Diagnostic>,
@@ -284,6 +281,7 @@ impl Document {
286 #[inline]
283 #[inline]
284+ /// Current document version, incremented at each change.
287 pub fn version(&self) -> i32 {
285 pub fn version(&self) -> i32 {
288 self.version
286 self.version
@@ -292,7 +290,13 @@ impl Document {
292 self.language_server.as_deref()
290 self.language_server.as_deref()
293+ /// Tree-sitter AST tree
294+ pub fn syntax(&self) -> Option<&Syntax> {
295+ self.syntax.as_ref()
295 #[inline]
298 #[inline]
299+ /// File path on disk.
296 pub fn path(&self) -> Option<&PathBuf> {
300 pub fn path(&self) -> Option<&PathBuf> {
297 self.path.as_ref()
301 self.path.as_ref()