feat: expand completion snippets and navigate placeholders

This commit is contained in:
2026-10-10 19:12:13 +02:00
parent b6059d5ed9
commit 232be6a032
12 changed files with 2194 additions and 49 deletions
+17
View File
@@ -113,6 +113,22 @@ pub struct CompletionEdit {
pub text: String,
}
/// Expanded snippet tabstops, in byte offsets relative to the primary edit text.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CompletionSnippet {
/// Positive tabstops in ascending order, followed by the final zero tabstop.
pub tabstops: Vec<SnippetTabstop>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SnippetTabstop {
pub index: u32,
/// Repeated occurrences of the same tabstop are edited together.
pub ranges: Vec<std::ops::Range<usize>>,
/// Enclosing numbered stops per occurrence, outermost first; parallel to ranges.
pub ancestors: Vec<Vec<u32>>,
}
/// Protocol-independent completion text and its atomic document edits.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CompletionItem {
@@ -121,6 +137,7 @@ pub struct CompletionItem {
/// Index of the primary replacement; other edits never determine caret placement.
pub primary_edit: usize,
pub edits: Vec<CompletionEdit>,
pub snippet: Option<CompletionSnippet>,
}
#[derive(Debug, Deserialize)]