Repository navigation
Added a setting for closing the active editor group when the last edi… - #49517
Alex Ross (alexr00) wants to merge 2 commits into
Conversation
…tor in the group is closed.
Benjamin Pasero (bpasero)
left a comment
There was a problem hiding this comment.
Alex Ross (@alexr00) some feedback provided
| getGroup(identifier: GroupIdentifier): INextEditorGroupView; | ||
|
|
||
| addGroup(location: INextEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): INextEditorGroup; | ||
| removeGroup(): void; |
There was a problem hiding this comment.
I think my merge caused a bad formatting here, suggest to code format once
| const copyEditor = this.shouldCopyEditor(draggedEditor, event); | ||
| if (!copyEditor) { | ||
| sourceGroup.closeEditor(draggedEditor.editor); | ||
| sourceGroup.closeEditor(draggedEditor.editor, true); |
There was a problem hiding this comment.
I think we can tweak this a little bit: If the user drags an editor to another group and drops it there, I would think that it is fine to close the editor if its the last. Same for dragging it to another group to split the group there.
In other words, maybe the only time we should allow the editor group to stay empty is when you drag the editor into the same group it originates from and you are splitting that group into one of the directions.
| 'workbench.editor.collapseEmptyGroupsOnClose': { | ||
| 'type': 'boolean', | ||
| 'description': nls.localize('collapseEmptyGroupsOnClose', "Controls the behavior of empty editor groups when the last tab in the group is closed. When enabled, empty groups will automatically collapse. When disabled, empty groups will remain part of the grid."), | ||
| 'default': false |
There was a problem hiding this comment.
I would make this the default to preserve our todays liquid layout.
| 'description': nls.localize('revealIfOpen', "Controls if an editor is revealed in any of the visible groups if opened. If disabled, an editor will prefer to open in the currently active editor group. If enabled, an already opened editor will be revealed instead of opened again in the currently active editor group. Note that there are some cases where this setting is ignored, e.g. when forcing an editor to open in a specific group or to the side of the currently active group."), | ||
| 'default': false | ||
| }, | ||
| 'workbench.editor.collapseEmptyGroupsOnClose': { |
There was a problem hiding this comment.
The setting name is a bit hard to understand. How about removeEmptyGroups or collapseEmptyGroups and then explaining in the description that it applies when you close the last editor?
| } | ||
|
|
||
| removeGroup(group: INextEditorGroupView | GroupIdentifier): void { | ||
| removeGroup(group: INextEditorGroupView | GroupIdentifier = this.activeGroup): void { |
There was a problem hiding this comment.
This will unfortunately not work if the group where the editor gets closed is not active. This happens when you just click on the tab close button while the group is not active. I suggest to expose the group parameter to the accessor and then using it.
| @IConfigurationService private configurationService: IConfigurationService, | ||
| ) { | ||
| super(themeService); | ||
| this.workbenchEditorOptions = getEditorPartOptions(this.configurationService.getValue<IWorkbenchEditorConfiguration>()); |
There was a problem hiding this comment.
I suggest to just use the accessor here to get to the editor options instead of keeping it as variable.
|
I pushed this in a slightly modified form via 26ee938. The change ended up to be much simpler because of changes I did meanwhile. I no longer think that there should be different behaviour when dragging compared to just closing the last editor. |
…tor in the group is closed.