@@ -18,15 +18,13 @@ pub enum Mode {
1818
1919pub struct Document {
2020 pub state: State, // rope + selection
21− /// File path on disk.
2221 path: Option<PathBuf>,
2322
2423 /// Current editing mode.
2524 pub mode: Mode,
2625 pub restore_cursor: bool,
2726
28− /// Tree-sitter AST tree
29− pub syntax: Option<Syntax>,
27+ syntax: Option<Syntax>,
3028 // /// Corresponding language scope name. Usually `source.<lang>`.
3129 pub(crate) language: Option<Arc<LanguageConfiguration>>,
3230
@@ -36,7 +34,6 @@ pub struct Document {
3634 old_state: Option<State>,
3735 /// Undo tree.
3836 history: History,
39− /// Current document version, incremented at each change.
4037 version: i32, // should be usize?
4138
4239 pub diagnostics: Vec<Diagnostic>,
@@ -284,6 +281,7 @@ impl Document {
284281 }
285282
286283 #[inline]
284+ /// Current document version, incremented at each change.
287285 pub fn version(&self) -> i32 {
288286 self.version
289287 }
@@ -292,7 +290,13 @@ impl Document {
292290 self.language_server.as_deref()
293291 }
294292
293+ /// Tree-sitter AST tree
294+ pub fn syntax(&self) -> Option<&Syntax> {
295+ self.syntax.as_ref()
296+ }
297+
295298 #[inline]
299+ /// File path on disk.
296300 pub fn path(&self) -> Option<&PathBuf> {
297301 self.path.as_ref()
298302 }