Skip to content

Commit 7a242cf

Browse files
committed
Simplify switch event for remote explorer
1 parent 57ddcfd commit 7a242cf

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

src/vs/workbench/browser/parts/views/viewsViewlet.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { DefaultPanelDndController } from 'vs/base/browser/ui/splitview/panelvie
2323
import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listService';
2424
import { IWorkbenchThemeService, IFileIconTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
2525
import { ITreeConfiguration, ITreeOptions } from 'vs/base/parts/tree/browser/tree';
26-
import { Event, Emitter } from 'vs/base/common/event';
26+
import { Event } from 'vs/base/common/event';
2727
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
2828
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
2929
import { localize } from 'vs/nls';
@@ -330,10 +330,9 @@ export abstract class FilterViewContainerViewlet extends ViewContainerViewlet {
330330
private allViews: Map<string, Map<string, IViewDescriptor>> = new Map();
331331
private filterValue: string | undefined;
332332

333-
protected onDidChangeFilterValue: Emitter<string> = new Emitter();
334-
335333
constructor(
336334
viewletId: string,
335+
onDidChangeFilterValue: Event<string>,
337336
@IConfigurationService configurationService: IConfigurationService,
338337
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
339338
@ITelemetryService telemetryService: ITelemetryService,
@@ -345,7 +344,7 @@ export abstract class FilterViewContainerViewlet extends ViewContainerViewlet {
345344
@IWorkspaceContextService contextService: IWorkspaceContextService
346345
) {
347346
super(viewletId, `${viewletId}.state`, false, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
348-
this._register(this.onDidChangeFilterValue.event(newFilterValue => {
347+
this._register(onDidChangeFilterValue(newFilterValue => {
349348
this.filterValue = newFilterValue;
350349
this.onFilterChanged(newFilterValue);
351350
}));

src/vs/workbench/contrib/remote/browser/remote.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,9 @@ export class RemoteViewlet extends FilterViewContainerViewlet implements IViewMo
381381
@IThemeService themeService: IThemeService,
382382
@IContextMenuService contextMenuService: IContextMenuService,
383383
@IExtensionService extensionService: IExtensionService,
384-
@IRemoteExplorerService private readonly remoteExplorerService: IRemoteExplorerService
384+
@IRemoteExplorerService remoteExplorerService: IRemoteExplorerService
385385
) {
386-
super(VIEWLET_ID, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
386+
super(VIEWLET_ID, remoteExplorerService.onDidChangeTargetType, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
387387
this.addConstantViewDescriptors([this.helpPanelDescriptor]);
388388
remoteHelpExtPoint.setHandler((extensions) => {
389389
let helpInformation: HelpInformation[] = [];
@@ -400,10 +400,6 @@ export class RemoteViewlet extends FilterViewContainerViewlet implements IViewMo
400400
viewsRegistry.deregisterViews([this.helpPanelDescriptor], VIEW_CONTAINER);
401401
}
402402
});
403-
404-
this._register(this.remoteExplorerService.onDidChangeTargetType(() => {
405-
this.onDidChangeFilterValue.fire(this.remoteExplorerService.targetType);
406-
}));
407403
}
408404

409405
protected getFilterOn(viewDescriptor: IViewDescriptor): string | undefined {

src/vs/workbench/services/remote/common/remoteExplorerService.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ class RemoteExplorerService implements IRemoteExplorerService {
2323

2424
set targetType(name: string) {
2525
if (this._targetType !== name) {
26-
const oldTarget = this._targetType;
2726
this._targetType = name;
28-
this._onDidChangeTargetType.fire(oldTarget);
27+
this._onDidChangeTargetType.fire(this._targetType);
2928
}
3029
}
3130
get targetType(): string {

0 commit comments

Comments
 (0)