Currently, I am testing out the CompletionItemProvider feature for my project. I have implemented two separate CompletionItemProviders. One is set to trigger when any alphabet letter is typed and the other triggers when the user enters a single quote character (').
However, my aim is to restrict a specific completion provider to only appear when the user activates IntelliSense by pressing CTRL+SPACE inside double quotes. For example, when the user types ' here inside ', they should only see a particular set of completions as shown below. Is this achievable?
// will only activate when inside quotes
public areaCompletionProvider = <monaco.languages.CompletionItemProvider>{
triggerCharacters: ['\''],
provideCompletionItems: (model, position, token) => {
let current = this.store[this.store.length - 1];
if (!current) {
return [];
}
let uniqueContextVariables: string[] = Array.from(new Set(current.contextVariables.map(ctxVariable => ctxVariable.area)));
let areaCompletions = uniqueContextVariables.map(area => <monaco.languages.CompletionItem>{
label: area,
kind: monaco.languages.CompletionItemKind.Field,
});
return areaCompletions;
}
};