Skip to content

Commit ce6acc9

Browse files
author
Benjamin Pasero
committed
grid - fix some lifecycle issues
1 parent e41acb7 commit ce6acc9

3 files changed

Lines changed: 24 additions & 22 deletions

File tree

src/vs/platform/progress/common/progress.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,8 @@ export class LongRunningOperation {
152152
this.currentOperationDisposables = dispose(this.currentOperationDisposables);
153153
}
154154
}
155+
156+
dispose(): void {
157+
this.currentOperationDisposables = dispose(this.currentOperationDisposables);
158+
}
155159
}

src/vs/workbench/browser/parts/editor/editorCommands.ts

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,14 @@ function moveActiveEditorToGroup(args: ActiveEditorMoveArguments, control: IEdit
194194
}
195195

196196
function registerEditorGroupsLayoutCommand(): void {
197-
CommandsRegistry.registerCommand(LAYOUT_EDITOR_GROUPS_COMMAND_ID, applyEditorGroupLayout);
198-
}
199-
200-
function applyEditorGroupLayout(accessor: ServicesAccessor, args: EditorGroupLayout): void {
201-
if (!args || typeof args !== 'object') {
202-
return;
203-
}
197+
CommandsRegistry.registerCommand(LAYOUT_EDITOR_GROUPS_COMMAND_ID, (accessor: ServicesAccessor, args: EditorGroupLayout) => {
198+
if (!args || typeof args !== 'object') {
199+
return;
200+
}
204201

205-
const editorGroupService = accessor.get(IEditorGroupsService);
206-
editorGroupService.applyLayout(args);
202+
const editorGroupService = accessor.get(IEditorGroupsService);
203+
editorGroupService.applyLayout(args);
204+
});
207205
}
208206

209207
export function mergeAllGroups(editorGroupService: IEditorGroupsService, target = editorGroupService.groups[0]): void {
@@ -262,18 +260,6 @@ function registerDiffEditorCommands(): void {
262260
});
263261
}
264262

265-
function getCommandsContext(resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext): IEditorCommandsContext {
266-
if (URI.isUri(resourceOrContext)) {
267-
return context;
268-
}
269-
270-
if (typeof resourceOrContext.groupId === 'number') {
271-
return resourceOrContext;
272-
}
273-
274-
return void 0;
275-
}
276-
277263
function registerOpenEditorAtIndexCommands(): void {
278264

279265
// Keybindings to focus a specific index in the tab folder if tabs are enabled
@@ -598,6 +584,18 @@ function registerCloseEditorCommands() {
598584
});
599585
}
600586

587+
function getCommandsContext(resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext): IEditorCommandsContext {
588+
if (URI.isUri(resourceOrContext)) {
589+
return context;
590+
}
591+
592+
if (resourceOrContext && typeof resourceOrContext.groupId === 'number') {
593+
return resourceOrContext;
594+
}
595+
596+
return void 0;
597+
}
598+
601599
function resolveCommandsContext(editorGroupService: IEditorGroupsService, context?: IEditorCommandsContext): { group: IEditorGroup, editor: IEditorInput, control: IEditor } {
602600

603601
// Resolve from context

src/vs/workbench/browser/parts/editor/editorControl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class EditorControl extends Disposable {
4646
) {
4747
super();
4848

49-
this.editorOperation = new LongRunningOperation(progressService);
49+
this.editorOperation = this._register(new LongRunningOperation(progressService));
5050
}
5151

5252
get activeControl(): BaseEditor {

0 commit comments

Comments
 (0)