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
- how to access the value of account statu...
- Redirect from clicking team invite link ...
Hi all! Pretty new to app development in general so this might be something more generic than appwrite, but I've found (after reading the docs for the Teams API...
- Hosting Issues with Static IP not domain...
I have a machine with Static Public IP. I want to host Appwrite Site on it but I tried it but it doesn't allow IP addresses in Domain names. What should I do h...