Skip to content

Editor resolver disposes editor to open in some cases #139355

@bpasero

Description

@bpasero

The editor resolver itself has logic to close an editor in case it is marked as singlePerResource via the closeExistingEditorsForResource method. Some editors, like file editor inputs, are shared across all resources. I.e. the same input is used for the same resource across all groups.

When the editor resolver resolves an editor it:

  • converts the untyped editor to a typed one
  • checks if the same resource is opened in another group
  • closes the editor in that case

This will dispose the file editor and then it cannot be opened anymore because the same editor input that is already being used will be used in the resolver too.

Steps to reproduce:

  • set singlePerResource: true in registerDefaultEditor
  • open a file
  • open an empty group to the side
  • focus that empty group
  • open quick open
  • select the file

=> 🐛 all editors close

I am not sure what should happen here actually, but I believe we would have similar problems if the editor to close is actually dirty and would thus bring up a save dialog. Would a better model be to not close the editor but move it to the target group if possible?

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buginsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeededworkbench-editor-resolverIssues resolving the editor inputs

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions