Skip to content

Commit eb12756

Browse files
author
Benjamin Pasero
committed
debt - part service => layout service
1 parent 93b1976 commit eb12756

60 files changed

Lines changed: 328 additions & 330 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/tsconfig.strictNullChecks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@
430430
"./vs/workbench/services/mode/common/workbenchModeService.ts",
431431
"./vs/workbench/services/notification/common/notificationService.ts",
432432
"./vs/workbench/services/panel/common/panelService.ts",
433-
"./vs/workbench/services/part/browser/partService.ts",
433+
"./vs/workbench/services/layout/browser/layoutService.ts",
434434
"./vs/workbench/services/preferences/common/keybindingsEditorModel.ts",
435435
"./vs/workbench/services/preferences/test/common/keybindingsEditorModel.test.ts",
436436
"./vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl.ts",

src/vs/workbench/api/browser/viewsExtensionPoint.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, Sh
2525
import { IExtensionDescription, IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
2626
import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet';
2727
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
28-
import { IPartService } from 'vs/workbench/services/part/browser/partService';
28+
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
2929
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
3030
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
3131
import { IStorageService } from 'vs/platform/storage/common/storage';
@@ -281,7 +281,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
281281
class CustomViewlet extends ViewContainerViewlet {
282282
constructor(
283283
@IConfigurationService configurationService: IConfigurationService,
284-
@IPartService partService: IPartService,
284+
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
285285
@ITelemetryService telemetryService: ITelemetryService,
286286
@IWorkspaceContextService contextService: IWorkspaceContextService,
287287
@IStorageService storageService: IStorageService,
@@ -291,7 +291,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
291291
@IContextMenuService contextMenuService: IContextMenuService,
292292
@IExtensionService extensionService: IExtensionService
293293
) {
294-
super(id, `${id}.state`, true, configurationService, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
294+
super(id, `${id}.state`, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
295295
}
296296
}
297297
const viewletDescriptor = new ViewletDescriptor(
@@ -311,9 +311,9 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
311311
id: string, label: string,
312312
@IViewletService viewletService: IViewletService,
313313
@IEditorGroupsService editorGroupService: IEditorGroupsService,
314-
@IPartService partService: IPartService
314+
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService
315315
) {
316-
super(id, label, id, viewletService, editorGroupService, partService);
316+
super(id, label, id, viewletService, editorGroupService, layoutService);
317317
}
318318
}
319319
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);

src/vs/workbench/api/electron-browser/mainThreadOutputService.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { Registry } from 'vs/platform/registry/common/platform';
77
import { IOutputService, IOutputChannel, OUTPUT_PANEL_ID, Extensions, IOutputChannelRegistry } from 'vs/workbench/contrib/output/common/output';
8-
import { IPartService } from 'vs/workbench/services/part/browser/partService';
8+
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
99
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
1010
import { MainThreadOutputServiceShape, MainContext, IExtHostContext, ExtHostOutputServiceShape, ExtHostContext } from '../node/extHost.protocol';
1111
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
@@ -20,18 +20,18 @@ export class MainThreadOutputService extends Disposable implements MainThreadOut
2020

2121
private readonly _proxy: ExtHostOutputServiceShape;
2222
private readonly _outputService: IOutputService;
23-
private readonly _partService: IPartService;
23+
private readonly _layoutService: IWorkbenchLayoutService;
2424
private readonly _panelService: IPanelService;
2525

2626
constructor(
2727
extHostContext: IExtHostContext,
2828
@IOutputService outputService: IOutputService,
29-
@IPartService partService: IPartService,
29+
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
3030
@IPanelService panelService: IPanelService
3131
) {
3232
super();
3333
this._outputService = outputService;
34-
this._partService = partService;
34+
this._layoutService = layoutService;
3535
this._panelService = panelService;
3636

3737
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostOutputService);
@@ -89,7 +89,7 @@ export class MainThreadOutputService extends Disposable implements MainThreadOut
8989
if (panel && panel.getId() === OUTPUT_PANEL_ID) {
9090
const activeChannel = this._outputService.getActiveChannel();
9191
if (activeChannel && channelId === activeChannel.id) {
92-
this._partService.setPanelHidden(true);
92+
this._layoutService.setPanelHidden(true);
9393
}
9494
}
9595

src/vs/workbench/api/electron-browser/mainThreadWebview.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
2525
import { WebviewElement } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
2626
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
2727
import { CodeInsetController } from 'vs/workbench/contrib/codeinset/electron-browser/codeInset.contribution';
28-
import { IPartService, Parts } from 'vs/workbench/services/part/browser/partService';
28+
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
2929

3030
@extHostNamedCustomer(MainContext.MainThreadWebviews)
3131
export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviver {
@@ -56,7 +56,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
5656
@ITelemetryService private readonly _telemetryService: ITelemetryService,
5757
@IInstantiationService private readonly _instantiationService: IInstantiationService,
5858
@ICodeEditorService private readonly _codeEditorService: ICodeEditorService,
59-
@IPartService private readonly _partService: IPartService,
59+
@IWorkbenchLayoutService private readonly _layoutService: IWorkbenchLayoutService,
6060
) {
6161
this._proxy = context.getProxy(ExtHostContext.ExtHostWebviews);
6262
_editorService.onDidActiveEditorChange(this.onActiveEditorChanged, this, this._toDispose);
@@ -114,7 +114,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
114114
// 4) continue to forward messages to the webview
115115
const webview = this._instantiationService.createInstance(
116116
WebviewElement,
117-
this._partService.getContainer(Parts.EDITOR_PART),
117+
this._layoutService.getContainer(Parts.EDITOR_PART),
118118
{
119119
useSameOriginForRoot: true,
120120
extensionLocation: URI.revive(extensionLocation),

src/vs/workbench/browser/actions/layoutActions.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Action } from 'vs/base/common/actions';
1111
import { SyncActionDescriptor, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
1212
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
1313
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
14-
import { IPartService, Parts, Position } from 'vs/workbench/services/part/browser/partService';
14+
import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService';
1515
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
1616
import { IEditorGroupsService, GroupOrientation } from 'vs/workbench/services/editor/common/editorGroupsService';
1717
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
@@ -39,16 +39,16 @@ export class ToggleActivityBarVisibilityAction extends Action {
3939
constructor(
4040
id: string,
4141
label: string,
42-
@IPartService private readonly partService: IPartService,
42+
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
4343
@IConfigurationService private readonly configurationService: IConfigurationService
4444
) {
4545
super(id, label);
4646

47-
this.enabled = !!this.partService;
47+
this.enabled = !!this.layoutService;
4848
}
4949

5050
run(): Promise<any> {
51-
const visibility = this.partService.isVisible(Parts.ACTIVITYBAR_PART);
51+
const visibility = this.layoutService.isVisible(Parts.ACTIVITYBAR_PART);
5252
const newVisibilityValue = !visibility;
5353

5454
return this.configurationService.updateValue(ToggleActivityBarVisibilityAction.activityBarVisibleKey, newVisibilityValue, ConfigurationTarget.USER);
@@ -76,14 +76,14 @@ class ToggleCenteredLayout extends Action {
7676
constructor(
7777
id: string,
7878
label: string,
79-
@IPartService private readonly partService: IPartService
79+
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
8080
) {
8181
super(id, label);
82-
this.enabled = !!this.partService;
82+
this.enabled = !!this.layoutService;
8383
}
8484

8585
run(): Promise<any> {
86-
this.partService.centerEditorLayout(!this.partService.isEditorLayoutCentered());
86+
this.layoutService.centerEditorLayout(!this.layoutService.isEditorLayoutCentered());
8787

8888
return Promise.resolve();
8989
}
@@ -180,23 +180,23 @@ export class ToggleSidebarPositionAction extends Action {
180180
constructor(
181181
id: string,
182182
label: string,
183-
@IPartService private readonly partService: IPartService,
183+
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
184184
@IConfigurationService private readonly configurationService: IConfigurationService
185185
) {
186186
super(id, label);
187187

188-
this.enabled = !!this.partService && !!this.configurationService;
188+
this.enabled = !!this.layoutService && !!this.configurationService;
189189
}
190190

191191
run(): Promise<any> {
192-
const position = this.partService.getSideBarPosition();
192+
const position = this.layoutService.getSideBarPosition();
193193
const newPositionValue = (position === Position.LEFT) ? 'right' : 'left';
194194

195195
return this.configurationService.updateValue(ToggleSidebarPositionAction.sidebarPositionConfigurationKey, newPositionValue, ConfigurationTarget.USER);
196196
}
197197

198-
static getLabel(partService: IPartService): string {
199-
return partService.getSideBarPosition() === Position.LEFT ? nls.localize('moveSidebarRight', "Move Side Bar Right") : nls.localize('moveSidebarLeft', "Move Side Bar Left");
198+
static getLabel(layoutService: IWorkbenchLayoutService): string {
199+
return layoutService.getSideBarPosition() === Position.LEFT ? nls.localize('moveSidebarRight', "Move Side Bar Right") : nls.localize('moveSidebarLeft', "Move Side Bar Left");
200200
}
201201
}
202202

@@ -220,16 +220,16 @@ export class ToggleEditorVisibilityAction extends Action {
220220
constructor(
221221
id: string,
222222
label: string,
223-
@IPartService private readonly partService: IPartService
223+
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
224224
) {
225225
super(id, label);
226226

227-
this.enabled = !!this.partService;
227+
this.enabled = !!this.layoutService;
228228
}
229229

230230
run(): Promise<any> {
231-
const hideEditor = this.partService.isVisible(Parts.EDITOR_PART);
232-
this.partService.setEditorHidden(hideEditor);
231+
const hideEditor = this.layoutService.isVisible(Parts.EDITOR_PART);
232+
this.layoutService.setEditorHidden(hideEditor);
233233

234234
return Promise.resolve();
235235
}
@@ -247,16 +247,16 @@ export class ToggleSidebarVisibilityAction extends Action {
247247
constructor(
248248
id: string,
249249
label: string,
250-
@IPartService private readonly partService: IPartService
250+
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
251251
) {
252252
super(id, label);
253253

254-
this.enabled = !!this.partService;
254+
this.enabled = !!this.layoutService;
255255
}
256256

257257
run(): Promise<any> {
258-
const hideSidebar = this.partService.isVisible(Parts.SIDEBAR_PART);
259-
this.partService.setSideBarHidden(hideSidebar);
258+
const hideSidebar = this.layoutService.isVisible(Parts.SIDEBAR_PART);
259+
this.layoutService.setSideBarHidden(hideSidebar);
260260

261261
return Promise.resolve();
262262
}
@@ -285,16 +285,16 @@ class ToggleStatusbarVisibilityAction extends Action {
285285
constructor(
286286
id: string,
287287
label: string,
288-
@IPartService private readonly partService: IPartService,
288+
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
289289
@IConfigurationService private readonly configurationService: IConfigurationService
290290
) {
291291
super(id, label);
292292

293-
this.enabled = !!this.partService;
293+
this.enabled = !!this.layoutService;
294294
}
295295

296296
run(): Promise<any> {
297-
const visibility = this.partService.isVisible(Parts.STATUSBAR_PART);
297+
const visibility = this.layoutService.isVisible(Parts.STATUSBAR_PART);
298298
const newVisibilityValue = !visibility;
299299

300300
return this.configurationService.updateValue(ToggleStatusbarVisibilityAction.statusbarVisibleKey, newVisibilityValue, ConfigurationTarget.USER);
@@ -353,14 +353,14 @@ class ToggleZenMode extends Action {
353353
constructor(
354354
id: string,
355355
label: string,
356-
@IPartService private readonly partService: IPartService
356+
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
357357
) {
358358
super(id, label);
359-
this.enabled = !!this.partService;
359+
this.enabled = !!this.layoutService;
360360
}
361361

362362
run(): Promise<any> {
363-
this.partService.toggleZenMode();
363+
this.layoutService.toggleZenMode();
364364

365365
return Promise.resolve();
366366
}
@@ -381,8 +381,8 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
381381
id: 'workbench.action.exitZenMode',
382382
weight: KeybindingWeight.EditorContrib - 1000,
383383
handler(accessor: ServicesAccessor) {
384-
const partService = accessor.get(IPartService);
385-
partService.toggleZenMode();
384+
const layoutService = accessor.get(IWorkbenchLayoutService);
385+
layoutService.toggleZenMode();
386386
},
387387
when: InEditorZenModeContext,
388388
primary: KeyChord(KeyCode.Escape, KeyCode.Escape)
@@ -447,15 +447,15 @@ export abstract class BaseResizeViewAction extends Action {
447447
constructor(
448448
id: string,
449449
label: string,
450-
@IPartService protected partService: IPartService
450+
@IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService
451451
) {
452452
super(id, label);
453453
}
454454

455455
protected resizePart(sizeChange: number): void {
456-
const isEditorFocus = this.partService.hasFocus(Parts.EDITOR_PART);
457-
const isSidebarFocus = this.partService.hasFocus(Parts.SIDEBAR_PART);
458-
const isPanelFocus = this.partService.hasFocus(Parts.PANEL_PART);
456+
const isEditorFocus = this.layoutService.hasFocus(Parts.EDITOR_PART);
457+
const isSidebarFocus = this.layoutService.hasFocus(Parts.SIDEBAR_PART);
458+
const isPanelFocus = this.layoutService.hasFocus(Parts.PANEL_PART);
459459

460460
let part: Parts | undefined;
461461
if (isSidebarFocus) {
@@ -467,7 +467,7 @@ export abstract class BaseResizeViewAction extends Action {
467467
}
468468

469469
if (part) {
470-
this.partService.resizePart(part, sizeChange);
470+
this.layoutService.resizePart(part, sizeChange);
471471
}
472472
}
473473
}
@@ -480,9 +480,9 @@ export class IncreaseViewSizeAction extends BaseResizeViewAction {
480480
constructor(
481481
id: string,
482482
label: string,
483-
@IPartService partService: IPartService
483+
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService
484484
) {
485-
super(id, label, partService);
485+
super(id, label, layoutService);
486486
}
487487

488488
run(): Promise<boolean> {
@@ -499,10 +499,10 @@ export class DecreaseViewSizeAction extends BaseResizeViewAction {
499499
constructor(
500500
id: string,
501501
label: string,
502-
@IPartService partService: IPartService
502+
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService
503503

504504
) {
505-
super(id, label, partService);
505+
super(id, label, layoutService);
506506
}
507507

508508
run(): Promise<boolean> {

0 commit comments

Comments
 (0)