sessions - allow to open editors in new window#296701
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds functionality to allow opening modal editors in a new window within sessions environments. The implementation introduces a new command that moves editors from a modal part to an auxiliary editor part (new window), complementing the existing functionality to move modal editors to the main window.
Changes:
- Added new
MOVE_MODAL_EDITOR_TO_WINDOW_COMMAND_IDcommand that creates an auxiliary editor part and moves all modal editors to it - Updated modal editor part to include the new command in the allowable commands list
- Added a test case demonstrating the ability to move editors from modal to another group
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/vs/workbench/browser/parts/editor/editorCommands.ts | Added new command MOVE_MODAL_EDITOR_TO_WINDOW_COMMAND_ID with async implementation that creates auxiliary editor part and moves modal editors to it |
| src/vs/workbench/browser/parts/editor/modalEditorPart.ts | Added new command to defaultModalEditorAllowableCommands set and imported the command constant |
| src/vs/workbench/services/editor/test/browser/modalEditorGroup.test.ts | Added test case validating that modal editor part editors can be moved to another group using moveEditors API |
Comments suppressed due to low confidence (1)
src/vs/workbench/services/editor/test/browser/modalEditorGroup.test.ts:614
- This test validates moving editors from modal to the main part group, but it doesn't test the new MOVE_MODAL_EDITOR_TO_WINDOW_COMMAND_ID functionality which moves editors to an auxiliary window (new window) via createAuxiliaryEditorPart(). Consider adding a test that specifically validates the new command's behavior of creating an auxiliary editor part and moving editors to it.
test('modal editor part editors can be moved to another group', async () => {
const instantiationService = workbenchInstantiationService({ contextKeyService: instantiationService => instantiationService.createInstance(MockScopableContextKeyService) }, disposables);
instantiationService.invokeFunction(accessor => Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory).start(accessor));
const parts = await createEditorParts(instantiationService, disposables);
instantiationService.stub(IEditorGroupsService, parts);
// Create modal and open editors
const modalPart = await parts.createModalEditorPart();
const input1 = createTestFileEditorInput(URI.file('foo/bar'), TEST_EDITOR_INPUT_ID);
const input2 = createTestFileEditorInput(URI.file('foo/baz'), TEST_EDITOR_INPUT_ID);
await modalPart.activeGroup.openEditor(input1, { pinned: true });
await modalPart.activeGroup.openEditor(input2, { pinned: true });
assert.strictEqual(modalPart.activeGroup.count, 2);
// Move editors from modal to main part group
const targetGroup = parts.mainPart.activeGroup;
for (const group of modalPart.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE)) {
group.moveEditors(group.editors.map(editor => ({ editor, options: { preserveFocus: true } })), targetGroup);
}
// Editors should be in the target group now
assert.strictEqual(targetGroup.count, 2);
assert.strictEqual(modalPart.activeGroup.count, 0);
// Close modal
modalPart.close();
assert.strictEqual(parts.activeModalEditorPart, undefined);
});
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.