Skip to content

workspace.applyEdit might not await the edit #187396

@senyai

Description

@senyai

It's late evening, but still I think this is vscode issue and not mine.

  • VS Code Version: 1.80
  • OS Version: PopOS based on Ubuntu 22.04

Steps to Reproduce:

  1. Sorry, it's not easy to reproduce. Run a code like this:

     const edit = new WorkspaceEdit();
     edit.replace(
         modifiedUri,
         new Range(
             new Position(0, 0),
             modifiedDocument.lineAt(modifiedDocument.lineCount - 1).range.end
         ),
         result
     );
     await workspace.applyEdit(edit);
     await modifiedDocument.save();
    
  2. immediately after all this, call document.getText() and get the text in the process of modification.

It doesn't happen in 100% cases, but adding console.log('text') in between makes the text fine all the time. I think it worked in 1.79.2

Metadata

Metadata

Assignees

Labels

info-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions