Closed Shane-XB-Qian closed 1 year ago
Are you sure your editor supports snippets as part of LSP?
yes. bashls had done the same.
-- shane.xb.qian
What editor version do u use? Maybe I can try to reproduce the bug (or maybe it's a feature 😄). Maybe there is already such issue filled for this editor? 🤔
yea, i tried to debug with following, but seems difficult to make it be right though i got the snip items if so.
diff --git a/server/src/completion.ts b/server/src/completion.ts
index 1c53179..eabfd22 100644
--- a/server/src/completion.ts
+++ b/server/src/completion.ts
@@ -73,15 +73,19 @@ export function initCompletionList(docs: Documentation, snippets: Snippets): voi
data: { type: DataEntryType.Documentation, jsonPath: `patterns.${key}` },
})),
)
predefinedCompletionListLight.push(
...Object.entries(snippets).map(([title, info]) => ({
- label: title,
+ label: info.prefix,
kind: CompletionItemKind.Snippet,
data: { type: DataEntryType.Snippet },
+
+ detail: info.description,
+ insertText: info.body.join('\n'),
+ insertTextFormat: InsertTextFormat.Snippet,
})),
)
}
export function getPredefinedCompletionItems(): AWKCompletionItem[] {
return predefinedCompletionListLight
1, seems somewhere did not set for snip compl item:
e.g: no
insertTextFormat
is 2 found.