I am attempting to add Completion snippets to an extension I'm writing based on the completions sample ( https://github.com/microsoft/vscode-extension-samples/tree/main/completions-sample ). I would like to have it branch complete. In my extension, SET is a keyword that then has possible params. Each param then has further params.
Ex: SET FOO|BAR|BAS where SET FOO can be ON|OFF, SET BAR is 1|2|3, and SET BAS is RED|BLUE.
I've tried to do it with
const SetCompletion = new vscode.CompletionItem('SET');
SetCompletion.insertText = new vscode.SnippetString('SET ${1|FOO,BAR,BAS|};');
And then Follow on with
const SetFooCompletion = new vscode.CompletionItem('FOO');
SetFooCompletion.insertText = new vscode.SnippetString('FOO ${1|ON,OFF|};');
const SetBarCompletion = new vscode.CompletionItem('BAR');
SetBarCompletion.insertText = new vscode.SnippetString('BAR ${1|1,2,3|};');
const SetBasCompletion = new vscode.CompletionItem('BAS');
SetBasCompletion.insertText = new vscode.SnippetString('BAS ${1|RED,BLUE|};');
And this sort of works if I retrigger completion after the first item is inserted. I think there might be a better way. In my real world code, there are about 15 SET things that I can call on, and each one has different types of params. Some are ON|OFF, some are numbers, some strings. In the above snippets, SET BAR ON is invalid, since BAR is an integer and only FOO is ON|OFF so I don't want to provide all possible parameters to all SET statements. They should be specific to the SET command that resolves in the first completion.
Is this possible?
Edit: Fixed typos in sample code