Skip to content

Commit

Permalink
Make splitting respect supportMultipleDocument (#120263)
Browse files Browse the repository at this point in the history
* Make splitting respect supportMultipleDocument

* Make split move the unsupported editor in the direction of the split

* Make it always split an empty group if the editor doesn't support splitting
  • Loading branch information
lramos15 committed Apr 7, 2021
1 parent bb6757b commit fe10639
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/vs/workbench/browser/parts/editor/editorCommands.ts
Expand Up @@ -632,12 +632,13 @@ export function splitEditor(editorGroupService: IEditorGroupsService, direction:
editorToCopy = withNullAsUndefined(sourceGroup.activeEditor);
}

// Copy the editor to the new group, else move the editor to the new group
if (editorToCopy && (editorToCopy as EditorInput).supportsSplitEditor()) {
sourceGroup.copyEditor(editorToCopy, newGroup);
// Focus
newGroup.focus();
}

// Focus
newGroup.focus();
}

function registerSplitEditorCommands() {
Expand Down
Expand Up @@ -90,7 +90,7 @@ export class CustomEditorInput extends LazilyResolvedWebviewEditorInput {
}

public supportsSplitEditor() {
return true;
return !!this.customEditorService.getCustomEditorCapabilities(this.viewType)?.supportsMultipleEditorsPerDocument;
}

getName(): string {
Expand Down
Expand Up @@ -199,7 +199,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
});
}

private getCustomEditorCapabilities(viewType: string): CustomEditorCapabilities | undefined {
public getCustomEditorCapabilities(viewType: string): CustomEditorCapabilities | undefined {
return this._editorCapabilities.get(viewType);
}

Expand Down
Expand Up @@ -44,6 +44,7 @@ export interface ICustomEditorService {
openWith(resource: URI, customEditorViewType: string, options?: ITextEditorOptions, group?: IEditorGroup): Promise<IEditorPane | undefined>;

registerCustomEditorCapabilities(viewType: string, options: CustomEditorCapabilities): IDisposable;
getCustomEditorCapabilities(viewType: string): CustomEditorCapabilities | undefined
}

export interface ICustomEditorModelManager {
Expand Down

0 comments on commit fe10639

Please sign in to comment.