Files
vscode-extension-samples/tree-explorer-sample/src/extension.ts
Sandeep Somavarapu e3f2d83258 Implement sample tree views
- Node depedencies tree
- Json outline tree
2017-05-21 18:18:07 +02:00

24 lines
939 B
TypeScript

'use strict';
import * as vscode from 'vscode';
import { DepNodeProvider } from './nodeDependencies'
import { JsonOutlineProvider } from './jsonOutline'
export function activate(context: vscode.ExtensionContext) {
const rootPath = vscode.workspace.rootPath;
const jsonOutlineProvider = new JsonOutlineProvider(context);
// The `providerId` here must be identical to `contributes.explorer.treeExplorerNodeProviderId` in package.json.
vscode.window.registerTreeDataProvider('nodeDependencies', new DepNodeProvider(rootPath));
vscode.window.registerTreeDataProvider('jsonOutline', jsonOutlineProvider);
vscode.commands.registerCommand('extension.openPackageOnNpm', (node: vscode.TreeItem) => {
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(`https://www.npmjs.com/package/${node.label}`));
});
vscode.commands.registerCommand('extension.openJsonSelection', node => {
jsonOutlineProvider.select(node);
});
}