Repository navigation
Make default text editor replace existing editors for resource - #112848
Conversation
865dd85 to
a5dc09c
Compare
Benjamin Pasero (bpasero)
left a comment
There was a problem hiding this comment.
I am not entirely sure the purpose: is it to have a first entry in the "Open With..." picker to open as text? And then if the editor is already opened we replace the editor instead of opening a new one? What happens if you do not replace, do we open another editor and the original one is also there?
a5dc09c to
1db66c1
Compare
There was a problem hiding this comment.
Instead of looping over all editors in the group, I would do a quick first this.isOpen({ resource }) to see if the editor is open after all. This is a very fast Set lookup without loops and can be used to return quickly.
|
Thanks Benjamin Pasero (@bpasero)! Just pushed the suggested changes |
Benjamin Pasero (bpasero)
left a comment
There was a problem hiding this comment.
Matt Bierner (@mjbvz) one thing I forgot to ask for: is it possible to add a unit test for this new method?
Fixes microsoft#111474 This ports the logic that we previouly had for custom editors to the generic open with flow: https://github.com/microsoft/vscode/blob/f0bb23ca02f320816219017234e412caa425851e/src%2Fvs%2Fworkbench%2Fcontrib%2FcustomEditor%2Fbrowser%2FcustomEditors.ts#L281
This adds a `IEditorService.getEditorsForResource` method that returns all editors associated with a given resource. I've adopted this for custom editors and notebooks
fa2aefd to
f0363e3
Compare
f0363e3 to
15bfcd6
Compare
Fixes #111474
This ports the logic that we previously had for custom editors to the generic open with flow:
vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.ts
Line 281 in f0bb23c