A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/text.rs')
-rw-r--r--src/text.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/text.rs b/src/text.rs
index 8dec0ae..a2547b9 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -18,7 +18,7 @@ use itertools::Itertools;
use log::error;
use lsp_types::{
InlayHint, InlayHintLabel, Location, Position, SemanticToken,
- SemanticTokensLegend, TextEdit,
+ SemanticTokensLegend, SnippetTextEdit, TextEdit,
};
use ropey::{Rope, RopeSlice};
use tree_house::Language;
@@ -495,6 +495,19 @@ impl TextArea {
}
Ok(())
}
+ pub fn apply_snippet_tedit(
+ &mut self,
+ SnippetTextEdit { text_edit, insert_text_format, .. }: &SnippetTextEdit,
+ ) -> anyhow::Result<()> {
+ match insert_text_format {
+ Some(lsp_types::InsertTextFormat::SNIPPET) =>
+ self.apply_snippet(&text_edit).unwrap(),
+ _ => {
+ self.apply_adjusting(text_edit).unwrap();
+ }
+ }
+ Ok(())
+ }
pub fn apply_snippet(&mut self, x: &TextEdit) -> anyhow::Result<()> {
let begin = self
.l_position(x.range.start)