当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript commands.registerCommand方法代码示例

本文整理汇总了TypeScript中vscode.commands.registerCommand方法的典型用法代码示例。如果您正苦于以下问题:TypeScript commands.registerCommand方法的具体用法?TypeScript commands.registerCommand怎么用?TypeScript commands.registerCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vscode.commands的用法示例。


在下文中一共展示了commands.registerCommand方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: registerCommands

export default function registerCommands(server: OmniSharpServer, platformInfo: PlatformInformation, eventStream: EventStream, optionProvider: OptionProvider, monoResolver: IMonoResolver): CompositeDisposable {
    let disposable = new CompositeDisposable();
    disposable.add(vscode.commands.registerCommand('o.restart', () => restartOmniSharp(server)));
    disposable.add(vscode.commands.registerCommand('o.pickProjectAndStart', async () => pickProjectAndStart(server, optionProvider)));
    disposable.add(vscode.commands.registerCommand('o.showOutput', () => eventStream.post(new ShowOmniSharpChannel())));
    disposable.add(vscode.commands.registerCommand('dotnet.restore.project', async () => pickProjectAndDotnetRestore(server, eventStream)));
    disposable.add(vscode.commands.registerCommand('dotnet.restore.all', async () => dotnetRestoreAllProjects(server, eventStream)));

    // register empty handler for csharp.installDebugger
    // running the command activates the extension, which is all we need for installation to kickoff
    disposable.add(vscode.commands.registerCommand('csharp.downloadDebugger', () => { }));

    // register process picker for attach
    let attachItemsProvider = DotNetAttachItemsProviderFactory.Get();
    let attacher = new AttachPicker(attachItemsProvider);
    disposable.add(vscode.commands.registerCommand('csharp.listProcess', async () => attacher.ShowAttachEntries()));

    // Register command for generating tasks.json and launch.json assets.
    disposable.add(vscode.commands.registerCommand('dotnet.generateAssets', async () => generateAssets(server)));

    // Register command for remote process picker for attach
    disposable.add(vscode.commands.registerCommand('csharp.listRemoteProcess', async (args) => RemoteAttachPicker.ShowAttachEntries(args, platformInfo)));

    // Register command for adapter executable command.
    disposable.add(vscode.commands.registerCommand('csharp.coreclrAdapterExecutableCommand', async (args) => getAdapterExecutionCommand(platformInfo, eventStream)));
    disposable.add(vscode.commands.registerCommand('csharp.clrAdapterExecutableCommand', async (args) => getAdapterExecutionCommand(platformInfo, eventStream)));
    disposable.add(vscode.commands.registerCommand('csharp.reportIssue', async () => reportIssue(vscode, eventStream, getDotnetInfo, platformInfo.isValidPlatformForMono(), optionProvider.GetLatestOptions(), monoResolver)));

    return new CompositeDisposable(disposable);
}
开发者ID:gregg-miskelly,项目名称:omnisharp-vscode,代码行数:30,代码来源:commands.ts

示例2: activate

export function activate(context: ExtensionContext) {

    // Use the console to output diagnostic information (console.log) and errors (console.error)
    // This line of code will only be executed once when your extension is activated
    console.log('Congratulations, your extension "rest-client" is now active!');

    let outChannel = window.createOutputChannel('REST');
    let statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left)
    let restClientSettings = new RestClientSettings();

    // The command has been defined in the package.json file
    // Now provide the implementation of the command with  registerCommand
    // The commandId parameter must match the command field in package.json
    let disposable = commands.registerCommand('rest-client.request', () => {
        let editor = window.activeTextEditor;
        if (!editor || !editor.document) {
            return;
        }

        // Get selected text of selected lines or full document
        let selectedText: string;
        if (editor.selection.isEmpty) {
            selectedText = editor.document.getText();
        } else {
            selectedText = editor.document.getText(editor.selection);
        }

        if (selectedText === '') {
            return;
        }

        if (restClientSettings.clearOutput) {
            outChannel.clear();
        }

        // clear status bar
        statusBarItem.text = `$(cloud-upload)`;
        statusBarItem.show();

        // parse http request
        let httpRequest = RequestParser.parseHttpRequest(selectedText);
        if (!httpRequest) {
            return;
        }

        // set http request
        let httpClient = new HttpClient(restClientSettings);
        httpClient.send(httpRequest)
            .then(response => {
                let output = `HTTP/${response.httpVersion} ${response.statusCode} ${response.statusMessage}\n`
                for (var header in response.headers) {
                    if (response.headers.hasOwnProperty(header)) {
                        var value = response.headers[header];
                        output += `${header}: ${value}\n`
                    }
                }

                let body = response.body;
                let contentType = response.headers['content-type'];
                if (contentType) {
                    let type = MimeUtility.parse(contentType).type;
                    if (type === 'application/json') {
                        body = JSON.stringify(JSON.parse(body), null, 4);
                    }
                }

                output += `\n${body}`;
                outChannel.appendLine(`${output}\n`);
                outChannel.show(true);

                statusBarItem.text = ` $(clock) ${response.elapsedMillionSeconds}ms`;
                statusBarItem.tooltip = 'duration';
            })
            .catch(error => {
                statusBarItem.text = '';
                outChannel.appendLine(`${error}\n`);
                outChannel.show(true);
            });
    });

    context.subscriptions.push(disposable);
}
开发者ID:ashisha7i,项目名称:vscode-restclient,代码行数:82,代码来源:extension.ts

示例3: runNgCommand

'use strict';

import * as vscode from 'vscode';
import { runNgCommand } from './run'

export var ngbuild = vscode.commands.registerCommand('extension.ngBuild', () => {
    vscode.window.showInputBox({ placeHolder: 'Enter optional paramaters if any, example --target=production --environment=prod' })
                 .then((optionalParams = '') => {
                    runNgCommand([`build ${optionalParams}`], true);
                 });
                
});
开发者ID:web-dave,项目名称:vsc-angular-cli,代码行数:12,代码来源:build.ts

示例4: activate


//.........这里部分代码省略.........
		} else {
			client.info(stopped);
			statusBarItem.tooltip = stopped;
			serverRunning = false;
		}
		udpateStatusBarVisibility(window.activeTextEditor);
	});

	client.onNotification(StatusNotification.type, (params) => {
		updateStatus(params.state);
	});

	function applyTextEdits(uri: string, documentVersion: number, edits: TextEdit[]) {
		let textEditor = window.activeTextEditor;
		if (textEditor && textEditor.document.uri.toString() === uri) {
			if (textEditor.document.version !== documentVersion) {
				window.showInformationMessage(`TSLint fixes are outdated and can't be applied to the document.`);
			}
			textEditor.edit(mutator => {
				for (let edit of edits) {
					mutator.replace(Protocol2Code.asRange(edit.range), edit.newText);
				}
			}).then((success) => {
				if (!success) {
					window.showErrorMessage('Failed to apply TSLint fixes to the document. Please consider opening an issue with steps to reproduce.');
				}
			});
		}
	}

	function fixAllProblems() {
		let textEditor = window.activeTextEditor;
		if (!textEditor) {
			return;
		}
		let uri: string = textEditor.document.uri.toString();
		client.sendRequest(AllFixesRequest.type, { textDocument: { uri } }).then((result) => {
			if (result) {
				applyTextEdits(uri, result.documentVersion, result.edits);
			}
		}, (error) => {
			window.showErrorMessage('Failed to apply TSLint fixes to the document. Please consider opening an issue with steps to reproduce.');
		});
	}

	function createDefaultConfiguration(): void {
		if (!workspace.rootPath) {
			window.showErrorMessage('A TSLint configuration file can only be generated if VS Code is opened on a folder.');
		}
		let tslintConfigFile = path.join(workspace.rootPath, 'tslint.json');

		if (fs.existsSync(tslintConfigFile)) {
			window.showInformationMessage('A TSLint configuration file already exists.');
		} else {
			fs.writeFileSync(tslintConfigFile, tslintConfig, { encoding: 'utf8' });
		}
	}

	function configurationChanged() {
		let config = workspace.getConfiguration('tslint');
		let autoFix = config.get('autoFixOnSave', false);
		if (autoFix && !willSaveTextDocument) {
			willSaveTextDocument = workspace.onWillSaveTextDocument((event) => {
				let document = event.document;
				// only auto fix when the document was not auto saved
				if (!isTypeScriptDocument(document.languageId) || event.reason === TextDocumentSaveReason.AfterDelay) {
					return;
				}
				const version = document.version;
				event.waitUntil(
					client.sendRequest(AllFixesRequest.type, { textDocument: { uri: document.uri.toString() } }).then((result) => {
						if (result && version === result.documentVersion) {
							return Protocol2Code.asTextEdits(result.edits);
						} else {
							return [];
						}
					})
				);
			});
		} else if (!autoFix && willSaveTextDocument) {
			willSaveTextDocument.dispose();
			willSaveTextDocument = undefined;
		}
	}

	configurationChangedListener = workspace.onDidChangeConfiguration(configurationChanged);
	configurationChanged();

	context.subscriptions.push(
		new SettingMonitor(client, 'tslint.enable').start(),
		configurationChangedListener,
		commands.registerCommand('tslint.applySingleFix', applyTextEdits),
		commands.registerCommand('tslint.applySameFixes', applyTextEdits),
		commands.registerCommand('tslint.applyAllFixes', applyTextEdits),
		commands.registerCommand('tslint.fixAllProblems', fixAllProblems),
		commands.registerCommand('tslint.createConfig', createDefaultConfiguration),
		commands.registerCommand('tslint.showOutputChannel', () => { client.outputChannel.show(); }),
		statusBarItem
	);
}
开发者ID:ericanderson,项目名称:vscode-tslint,代码行数:101,代码来源:extension.ts

示例5: registerCommands

 registerCommands() {
     this.disposables.push(vscode.commands.registerCommand(Commands.Build_Workspace_Symbols, this.buildWorkspaceSymbols.bind(this)));
 }
开发者ID:walkoncross,项目名称:pythonVSCode,代码行数:3,代码来源:main.ts

示例6: activate

export function activate(context: vscode.ExtensionContext) {

    const global = new Global(vscAdapter);

    context.subscriptions.push(vscode.languages.registerCompletionItemProvider(BSL_MODE, new CompletionItemProvider(global), ".", "="));
    context.subscriptions.push(vscode.languages.registerDefinitionProvider(BSL_MODE, new DefinitionProvider(global)));
    context.subscriptions.push(vscode.languages.registerDocumentSymbolProvider(BSL_MODE, new DocumentSymbolProvider(global)));
    context.subscriptions.push(vscode.languages.registerReferenceProvider(BSL_MODE, new ReferenceProvider(global)));
    context.subscriptions.push(vscode.languages.registerWorkspaceSymbolProvider(new WorkspaseSymbolProvider(global)));
    context.subscriptions.push(vscode.languages.registerSignatureHelpProvider(BSL_MODE, new SignatureHelpProvider(global), "(", ","));
    context.subscriptions.push(vscode.languages.registerHoverProvider(BSL_MODE, new HoverProvider(global)));

    let syntaxHelper = new SyntaxHelper(global);
    context.subscriptions.push(vscode.workspace.registerTextDocumentContentProvider("syntax-helper", syntaxHelper));

    let linter = new LintProvider();
    linter.activate(context.subscriptions);

    context.subscriptions.push(vscode.commands.registerCommand("language-1c-bsl.update", () => {
        let filename = vscode.window.activeTextEditor.document.fileName;
        global.updateCache();
    }));

    context.subscriptions.push(vscode.commands.registerCommand("language-1c-bsl.createComments", () => {
        if (vscode.window.activeTextEditor.document.languageId === "bsl") {
            let configuration = vscode.workspace.getConfiguration("language-1c-bsl");
            let aL: any = configuration.get("languageAutocomplete");
            let editor = vscode.window.activeTextEditor;
            let positionStart = vscode.window.activeTextEditor.selection.anchor;
            let positionEnd = vscode.window.activeTextEditor.selection.active;
            let lineMethod = (positionStart.line > positionEnd.line) ? positionStart.line + 1 : positionEnd.line + 1;
            let re = /^(Процедура|Функция|procedure|function)\s*([\wа-яё]+)/im;
            for (let indexLine = lineMethod; indexLine >= 0; --indexLine) {
                let MatchMethod = re.exec(editor.document.lineAt(indexLine).text);
                if (MatchMethod === null) {
                    continue;
                }
                let isFunc = (MatchMethod[1].toLowerCase() === "function" || MatchMethod[1].toLowerCase() === "функция");
                let comment = "";
                let methodDescription = "";
                if (aL === "en") {
                    methodDescription = (isFunc) ? "Function description" : "Procedure description";
                } else {
                    methodDescription = (isFunc) ? "Описание функции" : "Описание процедуры";
                }
                comment += "// <" + methodDescription + ">\n";
                let params = global.getCacheLocal(editor.document.fileName, MatchMethod[2], editor.document.getText())[0]._method.Params;
                if (params.length > 0) {
                    comment += "//\n";
                    comment += ((aL === "en") ? "// Parameters:\n" : "// Параметры:\n");
                }
                for (let index = 0; index < params.length; index++) {
                    let element = params[index];
                    comment += "//   " + element + ((aL === "en") ? " - <Type.Subtype> - <parameter description>" : " - <Тип.Вид> - <описание параметра>");
                    comment += "\n";
                }
                if (isFunc) {
                    comment += "//\n";
                    comment += ((aL === "en") ? "//  Returns:\n" : "//  Возвращаемое значение:\n");
                    comment += ((aL === "en") ? "//   <Type.Subtype>   - <returned value description>" : "//   <Тип.Вид>   - <описание возвращаемого значения>");
                    comment += "\n";
                }
                comment += "//\n";
                editor.edit(function (editBuilder) {
                    editBuilder.replace(new vscode.Position(indexLine, 0), comment);
                });
            }
        }
    }));

    context.subscriptions.push(vscode.commands.registerCommand("language-1c-bsl.createTasks", () => {
        let rootPath = vscode.workspace.rootPath;
        if (rootPath === undefined) {
            return;
        }
        let vscodePath = path.join(rootPath, ".vscode");
        let promise = new Promise( (resolve, reject) => {
            fs.stat(vscodePath, (err: NodeJS.ErrnoException, stats: fs.Stats) => {
                if (err) {
                    fs.mkdir(vscodePath, (err) => {
                        if (err) {
                            reject(err);
                        }
                        resolve();
                    })
                    return;
                }
                resolve();
            });            
        });
        
        promise.then( (result) => {
            let tasksPath = path.join(vscodePath, "tasks.json");
            fs.stat(tasksPath, (err: NodeJS.ErrnoException, stats: fs.Stats) => {
                if (err) {
                    fs.writeFile(tasksPath, JSON.stringify(tasksTemplate.getTasksObject(), null, 4), (err: NodeJS.ErrnoException) => {
                        if (err) {
                            throw err;
                        }
                        vscode.window.showInformationMessage("tasks.json was created");
//.........这里部分代码省略.........
开发者ID:artbear,项目名称:vsc-language-1c-bsl,代码行数:101,代码来源:extension.ts

示例7: activate

export function activate(context: vscode.ExtensionContext): void {
    // Asynchronously enable telemetry
    Telemetry.init('cordova-tools', require('./../../package.json').version, true);

    // Get the project root and check if it is a Cordova project
    let cordovaProjectRoot = CordovaProjectHelper.getCordovaProjectRoot(vscode.workspace.rootPath);

    if (!cordovaProjectRoot) {
        return;
    }

    let activateExtensionEvent = TelemetryHelper.createTelemetryEvent("activate");
    let projectType: IProjectType;

    TelemetryHelper.determineProjectTypes(cordovaProjectRoot)
        .then((projType) => {
            projectType = projType;
            activateExtensionEvent.properties["projectType"] = projType;
        })
        .finally(() => {
            Telemetry.send(activateExtensionEvent);
        }).done();

    // We need to update the type definitions added to the project
    // as and when plugins are added or removed. For this reason,
    // setup a file system watcher to watch changes to plugins in the Cordova project
    // Note that watching plugins/fetch.json file would suffice

    let watcher = vscode.workspace.createFileSystemWatcher('**/plugins/fetch.json', false /*ignoreCreateEvents*/, false /*ignoreChangeEvents*/, false /*ignoreDeleteEvents*/);

    watcher.onDidChange((e: vscode.Uri) => updatePluginTypeDefinitions(cordovaProjectRoot));
    watcher.onDidDelete((e: vscode.Uri) => updatePluginTypeDefinitions(cordovaProjectRoot));
    watcher.onDidCreate((e: vscode.Uri) => updatePluginTypeDefinitions(cordovaProjectRoot));

    context.subscriptions.push(watcher);

    // Register Cordova commands
    context.subscriptions.push(vscode.commands.registerCommand('cordova.prepare',
        () => CordovaCommandHelper.executeCordovaCommand(cordovaProjectRoot, "prepare")));
    context.subscriptions.push(vscode.commands.registerCommand('cordova.build',
        () => CordovaCommandHelper.executeCordovaCommand(cordovaProjectRoot, "build")));
    context.subscriptions.push(vscode.commands.registerCommand('cordova.run',
        () => CordovaCommandHelper.executeCordovaCommand(cordovaProjectRoot, "run")));
    context.subscriptions.push(vscode.commands.registerCommand('ionic.prepare',
        () => CordovaCommandHelper.executeCordovaCommand(cordovaProjectRoot, "prepare", true)));
    context.subscriptions.push(vscode.commands.registerCommand('ionic.build',
        () => CordovaCommandHelper.executeCordovaCommand(cordovaProjectRoot, "build", true)));
    context.subscriptions.push(vscode.commands.registerCommand('ionic.run',
        () => CordovaCommandHelper.executeCordovaCommand(cordovaProjectRoot, "run", true)));

    // Install Ionic type definitions if necessary
    if (CordovaProjectHelper.isIonicProject(cordovaProjectRoot)) {
        let ionicTypings: string[] = [
            path.join("angularjs", "angular.d.ts"),
            path.join("jquery", "jquery.d.ts"),
            path.join("ionic", "ionic.d.ts")
        ];
        TsdHelper.installTypings(CordovaProjectHelper.getOrCreateTypingsTargetPath(cordovaProjectRoot), ionicTypings);
    }

    let pluginTypings = getPluginTypingsJson();
    if (!pluginTypings) {
        return;
    }

    // Install the type defintion files for Cordova
    TsdHelper.installTypings(CordovaProjectHelper.getOrCreateTypingsTargetPath(cordovaProjectRoot), [pluginTypings[CORDOVA_TYPINGS_QUERYSTRING].typingFile]);

    // Install type definition files for the currently installed plugins
    updatePluginTypeDefinitions(cordovaProjectRoot);

    // In VSCode 0.10.10+, if the root doesn't contain jsconfig.json or tsconfig.json, intellisense won't work for files without /// typing references, so add a jsconfig.json here if necessary
    let jsconfigPath: string = path.join(vscode.workspace.rootPath, JSCONFIG_FILENAME);
    let tsconfigPath: string = path.join(vscode.workspace.rootPath, TSCONFIG_FILENAME);

    Q.all([Q.nfcall(fs.exists, jsconfigPath), Q.nfcall(fs.exists, tsconfigPath)]).spread((jsExists: boolean, tsExists: boolean) => {
        if (!jsExists && !tsExists) {
            Q.nfcall(fs.writeFile, jsconfigPath, "{}").then(() => {
                // Any open file must be reloaded to enable intellisense on them, so inform the user
                vscode.window.showInformationMessage("A 'jsconfig.json' file was created to enable IntelliSense. You may need to reload your open JS file(s).");
            });
        }
    });
}
开发者ID:vijayaraju,项目名称:vscode-cordova,代码行数:84,代码来源:cordova.ts

示例8:

 selectionActions.forEach((selectionAction) => {
     context.subscriptions.push(vscode.commands.registerCommand("emacs." + selectionAction, () => {
         vscode.commands.executeCommand("editor." + selectionAction).then(exitRegionMode);
     }))
 })
开发者ID:t-yng,项目名称:vscode-emacs-region,代码行数:5,代码来源:extension.ts

示例9: registerCommands

export function registerCommands(): void {
    if (commandsRegistered) {
        return;
    }
    commandsRegistered = true;
    getTemporaryCommandRegistrarInstance().clearTempCommands();
    disposables.push(vscode.commands.registerCommand('C_Cpp.Navigate', onNavigate));
    disposables.push(vscode.commands.registerCommand('C_Cpp.GoToDeclaration', onGoToDeclaration));
    disposables.push(vscode.commands.registerCommand('C_Cpp.PeekDeclaration', onPeekDeclaration));
    disposables.push(vscode.commands.registerCommand('C_Cpp.SwitchHeaderSource', onSwitchHeaderSource));
    disposables.push(vscode.commands.registerCommand('C_Cpp.ResetDatabase', onResetDatabase));
    disposables.push(vscode.commands.registerCommand('C_Cpp.ConfigurationSelect', onSelectConfiguration));
    disposables.push(vscode.commands.registerCommand('C_Cpp.ConfigurationProviderSelect', onSelectConfigurationProvider));
    disposables.push(vscode.commands.registerCommand('C_Cpp.ConfigurationEditJSON', onEditConfigurationJSON));
    disposables.push(vscode.commands.registerCommand('C_Cpp.ConfigurationEditUI', onEditConfigurationUI));
    disposables.push(vscode.commands.registerCommand('C_Cpp.AddToIncludePath', onAddToIncludePath));
    disposables.push(vscode.commands.registerCommand('C_Cpp.EnableErrorSquiggles', onEnableSquiggles));
    disposables.push(vscode.commands.registerCommand('C_Cpp.DisableErrorSquiggles', onDisableSquiggles));
    disposables.push(vscode.commands.registerCommand('C_Cpp.ToggleIncludeFallback', onToggleIncludeFallback));
    disposables.push(vscode.commands.registerCommand('C_Cpp.ToggleDimInactiveRegions', onToggleDimInactiveRegions));
    disposables.push(vscode.commands.registerCommand('C_Cpp.ShowReleaseNotes', onShowReleaseNotes));
    disposables.push(vscode.commands.registerCommand('C_Cpp.PauseParsing', onPauseParsing));
    disposables.push(vscode.commands.registerCommand('C_Cpp.ResumeParsing', onResumeParsing));
    disposables.push(vscode.commands.registerCommand('C_Cpp.ShowParsingCommands', onShowParsingCommands));
    disposables.push(vscode.commands.registerCommand('C_Cpp.TakeSurvey', onTakeSurvey));
    disposables.push(vscode.commands.registerCommand('C_Cpp.LogDiagnostics', onLogDiagnostics));
    disposables.push(vscode.commands.registerCommand('cpptools.activeConfigName', onGetActiveConfigName));
    getTemporaryCommandRegistrarInstance().executeDelayedCommands();
}
开发者ID:Microsoft,项目名称:vscppsamples,代码行数:29,代码来源:extension.ts

示例10: activate

export function activate(context: vscode.ExtensionContext) {

	// Use the console to output diagnostic information (console.log) and errors (console.error)
	// This line of code will only be executed once when your extension is activated
	console.log('Congratulations, your extension "bowerpm" is now active!');

	var adapter = new CodeAdapter();
	var progressIndicator = new ProgressIndicator();

	var commansAndHandlers = [
		{
			"label": "Bower Init",
			"description": "Create bower.json (bower init)",
			"handler": function() { init(adapter, progressIndicator); }
		},
		{
			"label": "Bower Install",
			"description": "Restore packages defined in bower.json (bower install)",
			"handler": function() { restore(adapter, progressIndicator); }
		},
		{
			"label": "Bower Search and Install",
			"description": "Search for a package and install it",
			"handler": function() { bowerSearch.search(adapter, progressIndicator); }
		},
		{
			"label": "Bower Uninstall",
			"description": "Select and uninstall a package",
			"handler": function() { uninstall(adapter, progressIndicator); }
		},
		{
			"label": "Bower Update",
			"description": "Update all packages or a selected package (bower update)",
			"handler": function() { update(adapter, progressIndicator); }
		},
		{
			"label": "Bower Cache - Clear",
			"description": "Clear bower cache (bower cache clear)",
			"handler": function() { bowerCache.cleanEverythingFromCache(adapter, progressIndicator); }
		},
		{
			"label": "Bower Cache - List",
			"description": "List the items in the bower cache and action them",
			"handler": function() { bowerCache.listCache(adapter, progressIndicator); }
		}
	];

	var disposable = vscode.commands.registerCommand('extension.bower', () => {
		vscode.window.showQuickPick(commansAndHandlers).then(cmd=> {
			if (!cmd) {
				return;
			}
			//var cwd2 = vscode.workspace.rootPath;
			var rootPath = vscode.workspace.rootPath;
			var currentFilePath = null;
			if (vscode.window.activeTextEditor && vscode.window.activeTextEditor.document) {
				currentFilePath = vscode.window.activeTextEditor.document.fileName;
			}
			getBowerConfigDir(rootPath, currentFilePath).then(cwd=> {
				process.chdir(cwd);

				adapter.clearLog();
				adapter.showLog();
				cmd.handler();
			});
		});
	});

	context.subscriptions.push(disposable);
}
开发者ID:Tyriar,项目名称:bowerVSCode,代码行数:70,代码来源:extension.ts


注:本文中的vscode.commands.registerCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。