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


TypeScript commands.getCommands方法代码示例

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


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

示例1: activate

export function activate(context) {

	const commands = vscode.commands.getCommands(true);

	//keybindings.json command-suggestions
	const disposable = vscode.languages.registerCompletionItemProvider({ pattern: '**/keybindings.json' }, {

		provideCompletionItems(document, position, token) {
			const location = getLocation(document.getText(), document.offsetAt(position));
			if (location.path[1] === 'command') {

				const range = document.getWordRangeAtPosition(position) || new vscode.Range(position, position);

				return commands.then(ids => ids.map(id => {
					const item = new vscode.CompletionItem(`"${id}"`);
					item.kind = vscode.CompletionItemKind.Value;
					item.textEdit = {
						range,
						newText: item.label
					};
					return item;
				}));
			}
		}
	});

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

示例2: test

 test("\'Generate Build Task command\' is registered", (done) => {
     let cmds = vscode.commands.getCommands(true)
     cmds.then(ids => {
             let containsCmd = ids.indexOf(addBuildScriptCmd)
             assert.notEqual(containsCmd, -1)
             done()
         })
 });
开发者ID:OverlyExcessive,项目名称:conformity,代码行数:8,代码来源:extension.test.ts

示例3: test

 test('Verify that the commands registered by Cordova extension are loaded', () => {
     return vscode.commands.getCommands(true)
     .then((results) => {
         let cordovaCmdsAvailable = results.filter((commandName: string) => {
             return commandName.indexOf("cordova.") > -1
         });
         assert.deepEqual(cordovaCmdsAvailable, ["cordova.build", "cordova.run", "cordova.prepare"])
     });
 });
开发者ID:Paradox-Cascade,项目名称:vscode-cordova,代码行数:9,代码来源:cordova.test.ts

示例4: it

	it("command is available when cursor is inside a test", async () => {
		const editor = await openFile(helloWorldTestMainFile);
		editor.selection = new vs.Selection(positionOf("expect^("), positionOf("^expect("));

		// Allow some time to check, because the flag is flipped in a selection change handler
		await waitForResult(() => cursorIsInTest);

		// Also ensure the command exists.
		const command = (await vs.commands.getCommands(true)).filter((id) => id === "dart.runTestAtCursor");
		assert.ok(command);
	});
开发者ID:DanTup,项目名称:Dart-Code,代码行数:11,代码来源:run_test_at_cursor.test.ts

示例5: test

	test('should register all spell commands', function(done){
		return vscode.commands.getCommands(true).then((commands) => 
		{
			let spellCmds = commands.filter(function (value) {
				return Global.changeLanguageCmdId === value ||
						Global.spellCurrentTextDocumentCmdId === value;
			});
			assert.ok(spellCmds.length === 2, 'missing spell commands');
			done();
		});
	});
开发者ID:silverbulleters,项目名称:vsc-spellchecker,代码行数:11,代码来源:extension.test.ts

示例6: registerKeybindingsCompletions

function registerKeybindingsCompletions(): vscode.Disposable {
	const commands = vscode.commands.getCommands(true);

	return vscode.languages.registerCompletionItemProvider({ pattern: '**/keybindings.json' }, {

		provideCompletionItems(document, position, token) {
			const location = getLocation(document.getText(), document.offsetAt(position));
			if (location.path[1] === 'command') {

				const range = document.getWordRangeAtPosition(position) || new vscode.Range(position, position);
				return commands.then(ids => ids.map(id => newCompletionItem(id, range)));
			}
		}
	});
}
开发者ID:elemongw,项目名称:vscode,代码行数:15,代码来源:extension.ts

示例7: test

    test("all keys have handlers", async () => {
        let pkg = require(__dirname + '/../../package.json');
        assert.ok(pkg);

        let registeredCommands = await vscode.commands.getCommands();
        let keybindings = pkg.contributes.keybindings;
        assert.ok(pkg);

        for (let i = 0; i < keybindings.length; i++) {
            let keybinding = keybindings[i];

            var found = registeredCommands.indexOf(keybinding.command) >= -1;
            assert.ok(found, "Missing handler for key=" + keybinding.key + ". Expected handler=" + keybinding.command);
        }
    });
开发者ID:CoderNumber1,项目名称:Vim,代码行数:15,代码来源:extension.test.ts

示例8: test

  test('all keys have handlers', async () => {
    let registeredCommands = await vscode.commands.getCommands();
    let keybindings = pkg.contributes.keybindings;
    assert.ok(keybindings);

    for (let i = 0; i < keybindings.length; i++) {
      let keybinding = keybindings[i];

      var found = registeredCommands.indexOf(keybinding.command) >= -1;
      assert.ok(
        found,
        'Missing handler for key=' + keybinding.key + '. Expected handler=' + keybinding.command
      );
    }
  });
开发者ID:arussellk,项目名称:Vim,代码行数:15,代码来源:extension.test.ts

示例9: activate

export function activate(context) {

	const commands = vscode.commands.getCommands(true);

	//keybindings.json command-suggestions
	const disposable = vscode.languages.registerCompletionItemProvider({ pattern: '**/keybindings.json' }, {

		provideCompletionItems(document, position, token) {
			const location = getLocation(document.getText(), document.offsetAt(position));
			if (location.path[1] === 'command') {
				return commands.then(ids => ids.map(id => new vscode.CompletionItem(id, vscode.CompletionItemKind.Value)));
			}
		}
	});

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

示例10: initialize

 public async initialize(): Promise<void> {
   this.map = new Map(
     (await vscode.commands.getCommands(true)).map(x => [x, true] as [string, boolean])
   );
 }
开发者ID:octref,项目名称:Vim,代码行数:5,代码来源:configurationValidator.ts


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