Skip to content

Commit

Permalink
More strict function fixes
Browse files Browse the repository at this point in the history
For #81574
  • Loading branch information
mjbvz committed Feb 11, 2020
1 parent efb781e commit 7a1ab29
Showing 5 changed files with 20 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts
Original file line number Diff line number Diff line change
@@ -181,6 +181,8 @@ export interface SelectionEvent {
readonly element?: Location;
}

class ReferencesTree extends WorkbenchAsyncDataTree<ReferencesModel | FileReferences, TreeElement, FuzzyScore> { }

/**
* ZoneWidget that is shown inside the editor
*/
@@ -195,7 +197,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
private readonly _onDidSelectReference = new Emitter<SelectionEvent>();
readonly onDidSelectReference = this._onDidSelectReference.event;

private _tree!: WorkbenchAsyncDataTree<ReferencesModel | FileReferences, TreeElement, FuzzyScore>;
private _tree!: ReferencesTree;
private _treeContainer!: HTMLElement;
private _splitView!: SplitView;
private _preview!: ICodeEditor;
@@ -316,8 +318,8 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
listBackground: peekView.peekViewResultsBackground
}
};
this._tree = this._instantiationService.createInstance<typeof WorkbenchAsyncDataTree, WorkbenchAsyncDataTree<ReferencesModel | FileReferences, TreeElement, FuzzyScore>>(
WorkbenchAsyncDataTree,
this._tree = this._instantiationService.createInstance(
ReferencesTree,
'ReferencesWidget',
this._treeContainer,
new Delegate(),
4 changes: 2 additions & 2 deletions src/vs/workbench/api/common/extHostCustomers.ts
Original file line number Diff line number Diff line change
@@ -14,12 +14,12 @@ export type IExtHostCustomerCtor<T extends IDisposable> = IConstructorSignature1

export function extHostNamedCustomer<T extends IDisposable>(id: ProxyIdentifier<T>) {
return function <Services extends BrandedService[]>(ctor: { new(context: IExtHostContext, ...services: Services): T }): void {
ExtHostCustomersRegistryImpl.INSTANCE.registerNamedCustomer(id, ctor);
ExtHostCustomersRegistryImpl.INSTANCE.registerNamedCustomer(id, ctor as IExtHostCustomerCtor<T>);
};
}

export function extHostCustomer<T extends IDisposable, Services extends BrandedService[]>(ctor: { new(context: IExtHostContext, ...services: Services): T }): void {
ExtHostCustomersRegistryImpl.INSTANCE.registerCustomer(ctor);
ExtHostCustomersRegistryImpl.INSTANCE.registerCustomer(ctor as IExtHostCustomerCtor<T>);
}

export namespace ExtHostCustomersRegistry {
6 changes: 4 additions & 2 deletions src/vs/workbench/browser/parts/views/customView.ts
Original file line number Diff line number Diff line change
@@ -118,6 +118,8 @@ class Root implements ITreeItem {

const noDataProviderMessage = localize('no-dataprovider', "There is no data provider registered that can provide view data.");

class CustomTree extends WorkbenchAsyncDataTree<ITreeItem, ITreeItem, FuzzyScore> { }

export class CustomTreeView extends Disposable implements ITreeView {

private isVisible: boolean = false;
@@ -132,7 +134,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
private _messageValue: string | undefined;
private _canSelectMany: boolean = false;
private messageElement!: HTMLDivElement;
private tree: WorkbenchAsyncDataTree<ITreeItem, ITreeItem, FuzzyScore> | undefined;
private tree: CustomTree | undefined;
private treeLabels: ResourceLabels | undefined;

private root: ITreeItem;
@@ -356,7 +358,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
const aligner = new Aligner(this.themeService);
const renderer = this.instantiationService.createInstance(TreeRenderer, this.id, treeMenus, this.treeLabels, actionViewItemProvider, aligner);

this.tree = this._register(this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'CustomView', this.treeContainer, new CustomTreeDelegate(), [renderer],
this.tree = this._register(this.instantiationService.createInstance(CustomTree, 'CustomView', this.treeContainer, new CustomTreeDelegate(), [renderer],
dataSource, {
identityProvider: new CustomViewIdentityProvider(),
accessibilityProvider: {
Original file line number Diff line number Diff line change
@@ -82,13 +82,15 @@ class LayoutInfo {
) { }
}

class CallHierarchyTree extends WorkbenchAsyncDataTree<CallHierarchyModel, callHTree.Call, FuzzyScore>{ }

export class CallHierarchyTreePeekWidget extends peekView.PeekViewWidget {

private _changeDirectionAction?: ChangeHierarchyDirectionAction;
private _parent!: HTMLElement;
private _message!: HTMLElement;
private _splitView!: SplitView;
private _tree!: WorkbenchAsyncDataTree<CallHierarchyModel, callHTree.Call, FuzzyScore>;
private _tree!: CallHierarchyTree;
private _treeViewStates = new Map<CallHierarchyDirection, IAsyncDataTreeViewState>();
private _editor!: EmbeddedCodeEditorWidget;
private _dim!: Dimension;
@@ -204,8 +206,8 @@ export class CallHierarchyTreePeekWidget extends peekView.PeekViewWidget {
listBackground: peekView.peekViewResultsBackground
}
};
this._tree = this._instantiationService.createInstance<typeof WorkbenchAsyncDataTree, WorkbenchAsyncDataTree<CallHierarchyModel, callHTree.Call, FuzzyScore>>(
WorkbenchAsyncDataTree,
this._tree = this._instantiationService.createInstance(
CallHierarchyTree,
'CallHierarchyPeek',
treeContainer,
new callHTree.VirtualDelegate(),
6 changes: 4 additions & 2 deletions src/vs/workbench/contrib/remote/browser/tunnelView.ts
Original file line number Diff line number Diff line change
@@ -426,10 +426,12 @@ const TunnelViewSelectionKeyName = 'tunnelViewSelection';
const TunnelViewSelectionContextKey = new RawContextKey<ITunnelItem | undefined>(TunnelViewSelectionKeyName, undefined);
const PortChangableContextKey = new RawContextKey<boolean>('portChangable', false);

class TunnelDataTree extends WorkbenchAsyncDataTree<any, any, any> { }

export class TunnelPanel extends ViewPane {
static readonly ID = '~remote.forwardedPorts';
static readonly TITLE = nls.localize('remote.tunnel', "Forwarded Ports");
private tree!: WorkbenchAsyncDataTree<any, any, any>;
private tree!: TunnelDataTree;
private tunnelTypeContext: IContextKey<TunnelType>;
private tunnelCloseableContext: IContextKey<boolean>;
private tunnelViewFocusContext: IContextKey<boolean>;
@@ -492,7 +494,7 @@ export class TunnelPanel extends ViewPane {
dom.addClass(treeContainer, 'show-file-icons');

const renderer = new TunnelTreeRenderer(TunnelPanel.ID, this.menuService, this.contextKeyService, this.instantiationService, this.contextViewService, this.themeService, this.remoteExplorerService);
this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree,
this.tree = this.instantiationService.createInstance(TunnelDataTree,
'RemoteTunnels',
treeContainer,
new TunnelTreeVirtualDelegate(),

0 comments on commit 7a1ab29

Please sign in to comment.