Skip to content

Instantly share code, notes, and snippets.

@alexweininger
Forked from bwateratmsft/foo.ts
Last active February 16, 2022 00:56
Show Gist options
  • Save alexweininger/d846d10d53744d3c6c05f2a85e567bfd to your computer and use it in GitHub Desktop.
Save alexweininger/d846d10d53744d3c6c05f2a85e567bfd to your computer and use it in GitHub Desktop.
import { GenericResource } from '@azure/arm-resources';
import { AzExtTreeItem } from '@microsoft/vscode-azext-utils';
import * as vscode from 'vscode';
interface TreeNodeConfiguration {
readonly label: string;
readonly description?: string;
readonly icon?: vscode.ThemeIcon;
readonly contextValue?: string;
}
interface ApplicationResource extends TreeNodeConfiguration {
getChildren?(): vscode.ProviderResult<AzExtTreeItem[]>;
resolveTooltip?(): Thenable<string | vscode.MarkdownString>;
}
export interface GroupableApplicationResource extends ApplicationResource {
readonly rootGroupConfig: TreeNodeConfiguration;
readonly subGroupConfig: {
readonly resourceGroup: TreeNodeConfiguration;
readonly resourceType: TreeNodeConfiguration;
readonly [label: string]: TreeNodeConfiguration; // Don't need to support right off the bat but we can put it in the interface
}
}
export type LocalResource = AzExtTreeItem;
export declare interface ApplicationResourceProvider {
matchesResource?(resource: GenericResource): boolean;
// resource comes from a list returned from an @azure/arm-resources listByResourceGroup call
resolveResource(resource: GenericResource): vscode.ProviderResult<GroupableApplicationResource | undefined>;
}
export interface LocalResourceProvider {
provideResources(): vscode.ProviderResult<LocalResource[] | undefined>;
}
// to be implemented in and exported from host
export interface AzExtProviderApi {
registerLocalResourceProvider(provider: LocalResourceProvider): vscode.Disposable;
registerApplicationResourceProvider(resourceType: string, provider: ApplicationResourceProvider): vscode.Disposable;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment