Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-view/src/document.rs')
| -rw-r--r-- | helix-view/src/document.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 310f2715..dcdc8dc2 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -7,6 +7,7 @@ use helix_core::auto_pairs::AutoPairs; use helix_core::chars::char_is_word; use helix_core::doc_formatter::TextFormat; use helix_core::encoding::Encoding; +use helix_core::snippets::{ActiveSnippet, SnippetRenderCtx}; use helix_core::syntax::{Highlight, LanguageServerFeature}; use helix_core::text_annotations::{InlineAnnotation, Overlay}; use helix_lsp::util::lsp_pos_to_pos; @@ -135,6 +136,7 @@ pub struct Document { text: Rope, selections: HashMap<ViewId, Selection>, view_data: HashMap<ViewId, ViewData>, + pub active_snippet: Option<ActiveSnippet>, /// Inlay hints annotations for the document, by view. /// @@ -655,6 +657,7 @@ impl Document { Self { id: DocumentId::default(), + active_snippet: None, path: None, encoding, has_bom, @@ -2053,6 +2056,16 @@ impl Document { } } + pub fn snippet_ctx(&self) -> SnippetRenderCtx { + SnippetRenderCtx { + // TODO snippet variable resolution + resolve_var: Box::new(|_| None), + tab_width: self.tab_width(), + indent_style: self.indent_style, + line_ending: self.line_ending.as_str(), + } + } + pub fn text_format(&self, mut viewport_width: u16, theme: Option<&Theme>) -> TextFormat { let config = self.config.load(); let text_width = self |