Skip to content

SnippetString.appendChoice() with placeholder=0 inserts snippet marked into the editor #150745

Closed
@DanTup

Description

@DanTup

The following code:

const a = new vs.SnippetString();
a.appendChoice(["test", "test2"], 0);
await editor.insertSnippet(a, new vs.Range(new vs.Position(0, 0), new vs.Position(0, 0)));

Inserts raw snippet markup into the document:

Screenshot 2022-05-30 at 18 44 24

It's not very explicit in the docs/tooltips but I guess that the "final tabstop" does not support choices. If this is the case, it would be better if appendChoice throws if given an invalid value, or VS Code just does some default behaviour (like setting the tabstop, inserting the first choice, etc.) rather than inserting snippet markup into the document.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunitiessnippets

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions