Hello guys i'm havint my snippets on my appwrite database i wish to build my extension to use them i'm having an issue
TypeScript
const htmlConsoleCompletionProvider = vscode.languages.registerCompletionItemProvider(
"html",
{
provideCompletionItems: async function (document: vscode.TextDocument, position: vscode.Position): Promise<any> {
const activeEditor = vscode.window.activeTextEditor;
if (!activeEditor) return new vscode.CompletionList([], true);
const { text } = activeEditor.document.lineAt(activeEditor.selection.active.line);
try {
const matchingSnippets = (await callToAPIAndRetrieve(text)) as any[];
const completionItems = matchingSnippets.map((snippet: any) => {
return {
label: snippet.label,
kind: vscode.CompletionItemKind.Snippet,
documentation: snippet.description,
insertText: new vscode.SnippetString(snippet.value),
};
});
return new vscode.CompletionList(completionItems, true);
} catch (error) {
console.error("Error retrieving snippets:", error);
return new vscode.CompletionList([], true);
}
},
},
""
);
Everythink works fine if the html file is empty but if i'm inside a html tag like <span></span> or inside of
TypeScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
</html>
It doesn't do anybody knows why ?
TL;DR
Issue with vscode provideCompletionItems when the HTML file is not empty. Developers are encountering problems with snippets retrieval within html tags.
Solution: Check the text context within the HTML tag for snippet retrieval, as the issue might arise from there.Recommended threads
- THE COLUMNS STUCK ON PROCESSING HOW DO I...
I HAVE SELF HOSTED THE APPWRITE ON VPS
- Impossible to create project via CLI?
Is it possible to create a new project via the appwrite CLI ? I need to create a few projects for something I'm working on and because i don't want to do it man...
- Understanding S3 setup with appwrite
Hey, i'm planning to change the storage from local to S3, tho i have some questions to see before starting the migration. 1. Does all the `/storage/<storage_ty...