diff --git a/packages/vscode/package.json b/packages/vscode/package.json index 411af23..1bd7017 100644 --- a/packages/vscode/package.json +++ b/packages/vscode/package.json @@ -11,7 +11,7 @@ "Other" ], "activationEvents": [ - "onCommand:extension.helloWorld" + "*" ], "main": "./dist/extension.js", "contributes": { @@ -60,8 +60,8 @@ "vscode:prepublish": "yarn run compile", "compile": "tsc -p ./", "watch": "tsc -watch -p ./", - "postinstall": "node ../../node_modules/vscode/bin/install", - "test": "yarn run compile && node ./node_modules/vscode/bin/test" + "postinstall": "node ../../../node_modules/vscode/bin/install", + "test": "yarn run compile && node ../../../node_modules/vscode/bin/test" }, "dependencies": { "@dayu/docker-api": "^0.0.1", diff --git a/packages/vscode/src/extension.ts b/packages/vscode/src/extension.ts index 6d73a13..bc9c0e6 100644 --- a/packages/vscode/src/extension.ts +++ b/packages/vscode/src/extension.ts @@ -1,14 +1,16 @@ // The module 'vscode' contains the VS Code extensibility API // Import the module and reference it with the alias vscode in your code below import * as vscode from 'vscode'; -process.env.DOCKER_HOST = '/var/run/docker.sock' -import { OpenFaasProvider, DockerProvider } from './provider' +process.env.DOCKER_HOST = 'https://dscli.miaowoo.cc'; +import { OpenFaasProvider, DockerProvider } from './provider'; // this method is called when your extension is activated // your extension is activated the very first time the command is executed export function activate(context: vscode.ExtensionContext) { - console.log('init...') + console.log('init...'); + // tslint:disable-next-line: no-unused-expression new DockerProvider(context); + // tslint:disable-next-line: no-unused-expression new OpenFaasProvider(context); } diff --git a/packages/vscode/src/provider/faas.ts b/packages/vscode/src/provider/faas.ts index 784a24e..5657124 100644 --- a/packages/vscode/src/provider/faas.ts +++ b/packages/vscode/src/provider/faas.ts @@ -1,6 +1,6 @@ -import * as vscode from 'vscode' -import * as faas from '@dayu/faas' -import { BaseProvider, ItemContextValue } from './base' +import * as vscode from 'vscode'; +import * as faas from '@dayu/faas'; +import { BaseProvider, ItemContextValue } from './base'; enum Type { ROOT = "ROOT", @@ -10,10 +10,10 @@ export class OpenFaasProvider extends BaseProvider { onDidChangeTreeData?: vscode.Event; constructor(context: vscode.ExtensionContext) { - super() + super(); context.subscriptions.push( vscode.window.registerTreeDataProvider('openfaas-explorer', this) - ) + ); } getTreeItem(element: vscode.TreeItem): vscode.TreeItem | Promise { @@ -29,7 +29,7 @@ export class OpenFaasProvider extends BaseProvider { type: Type.ROOT }, icon: "logo" - })] + })]; } let value: ItemContextValue = JSON.parse(element.contextValue); switch (value.type) { @@ -39,7 +39,7 @@ export class OpenFaasProvider extends BaseProvider { return this.createTreeItem({ label: f.name, tooltip: JSON.stringify(f, undefined, 2) - }) + }); }); default: return [];