microsoft / microsoft/vscode

WorkspaceEdit.entries() and get() are missing SnippetTextEdits

Open
#325,978 1 comment 0 reactions 1 assignee Claimed by @alexdima View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

The following code adds three changes to a `WorkspaceEdit`, using a mix of `insert()` and `set()`:

```ts
const pos = new vs.Position(0, 0);
const range = new vs.Range(pos, pos);

const edit = new vs.WorkspaceEdit();
edit.insert(vs.Uri.parse("foo://foo"), pos, "ONE");
edit.set(vs.Uri.parse("foo://bar"), [[new vs.TextEdit(range, "TWO"), undefined]]);
edit.set(vs.Uri.parse("foo://baz"), [[new vs.SnippetTextEdit(range, new vs.SnippetString("THREE")), undefined]]);

for (const entry of edit.entries()) {
console.log(entry[0]);
}
```

When I loop over the entries and print them, only the first two changes are present:

Image

The one that's missing is the `SnippetTextEdit`. So it appears there's no way to inspect a `WorkspaceEdit` and see all of the changes it will make, if it might include snippets.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.