I'm making a vscode extension which involves using vscode.languages.registerCompletionItemProvider
I have defined several trigger characters to activate the item providers in my json file (see code below), it works, when i press '?' for instance, I do have the list of items that I expect. However, it also activates with any letter of the alphabet. Would you now how to deactivate this behaviour?
context.subscriptions.push(vscode.languages.registerCompletionItemProvider (
{ language: 'json', scheme: 'file' },
{
provideCompletionItems(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, compContext: vscode.CompletionContext) {
const newItem = (text:string) => {
const item = new vscode.CompletionItem(text, vscode.CompletionItemKind.Text);
const trigger = document.lineAt(position).text.substring(position.character-1, position.character);
item.range = new vscode.Range(position, position);
return item;
};
return [
newItem('Riri'),
newItem('Fifi'),
newItem('Loulou')
];
},
'?',
','
));