mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
only open 1 editor
This commit is contained in:
parent
f7c4d28d55
commit
0d1c4944c1
1 changed files with 8 additions and 2 deletions
|
|
@ -143,9 +143,8 @@ registerAction2(class extends Action2 {
|
|||
const editorService = accessor.get(IEditorService);
|
||||
const instantiationService = accessor.get(IInstantiationService);
|
||||
|
||||
const openEditors = editorService.findEditors(VoidSettingsInput.RESOURCE);
|
||||
|
||||
// close all instances if found
|
||||
const openEditors = editorService.findEditors(VoidSettingsInput.RESOURCE);
|
||||
if (openEditors.length > 0) {
|
||||
await editorService.closeEditors(openEditors);
|
||||
return;
|
||||
|
|
@ -173,6 +172,13 @@ registerAction2(class extends Action2 {
|
|||
const editorService = accessor.get(IEditorService);
|
||||
const instantiationService = accessor.get(IInstantiationService);
|
||||
|
||||
// close all instances if found
|
||||
const openEditors = editorService.findEditors(VoidSettingsInput.RESOURCE);
|
||||
if (openEditors.length > 0) {
|
||||
await editorService.closeEditors(openEditors);
|
||||
}
|
||||
|
||||
// then, open one single editor
|
||||
const input = instantiationService.createInstance(VoidSettingsInput);
|
||||
await editorService.openEditor(input);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue