• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript keybindingService.KbExpr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vs/platform/keybinding/common/keybindingService.KbExpr的典型用法代码示例。如果您正苦于以下问题:TypeScript KbExpr类的具体用法?TypeScript KbExpr怎么用?TypeScript KbExpr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: registerClipboardAction

function registerClipboardAction(desc: IClipboardCommand, alias: string, weight: number) {
	if (!browser.supportsExecCommand(desc.execCommand)) {
		return;
	}

	CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(desc.ctor, desc.id, desc.label, {
		handler: execCommandToHandler.bind(null, desc.id, desc.execCommand),
		context: ContextKey.None,
		primary: desc.primary,
		secondary: desc.secondary,
		win: desc.win,
		linux: desc.linux,
		mac: desc.mac,
		kbExpr: KbExpr.has(editorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS)
	}, alias));

	MenuRegistry.addCommand({
		id: desc.id,
		title: desc.label
	});

	MenuRegistry.appendMenuItem(MenuId.EditorContext, {
		command: MenuRegistry.getCommand(desc.id),
		group: `cutcopypaste@${weight}`,
		when: desc.kbExpr
	});
}
开发者ID:Almorang,项目名称:vscode,代码行数:27,代码来源:clipboard.ts


示例2: registerClipboardAction

function registerClipboardAction(desc:IClipboardCommand, alias:string) {
	if (!browser.supportsExecCommand(desc.execCommand)) {
		return;
	}

	CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(desc.ctor, desc.id, desc.label, {
		handler: execCommandToHandler.bind(null, desc.id, desc.execCommand),
		context: ContextKey.None,
		primary: desc.primary,
		secondary: desc.secondary,
		win: desc.win,
		linux: desc.linux,
		mac: desc.mac,
		kbExpr: KbExpr.has(editorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS)
	}, alias));
}
开发者ID:AjuanM,项目名称:vscode,代码行数:16,代码来源:clipboard.ts


示例3: forEach

		forEach(value, entry => {
			if (!schema.isValidMenuItems(entry.value, collector)) {
				return;
			}

			const menu = schema.parseMenuId(entry.key);
			if (!menu) {
				collector.warn(localize('menuId.invalid', "`{0}` is not a valid menu identifier", entry.key));
				return;
			}

			for (let item of entry.value) {
				let command = MenuRegistry.getCommand(item.command);
				let alt = item.alt && MenuRegistry.getCommand(item.alt);

				if (!command) {
					collector.warn(localize('missing.command', "Menu item references a command `{0}` which is not defined in the 'commands' section.", item.command));
				}
				if (item.alt && !alt) {
					collector.warn(localize('missing.altCommand', "Menu item references an alt-command `{0}` which is not defined in the 'commands' section.", item.alt));
				}
				if (item.command === item.alt) {
					collector.info(localize('dupe.command', "Menu item references the same command as default and alt-command"));
				}

				if (item.alt && menu !== MenuId.EditorTitle && item.group !== 'navigation') {
					collector.info(localize('nosupport.altCommand', "Sorry, but currently only the 'navigation' group of the 'editor/title' menu supports alt-commands"));
				}

				MenuRegistry.appendMenuItem(menu, {
					command,
					alt,
					group: item.group || undefined,
					when: KbExpr.deserialize(item.when)
				});
			}
		});
开发者ID:Almorang,项目名称:vscode,代码行数:37,代码来源:menusExtensionPoint.ts


示例4: require

/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

import nls = require('vs/nls');
import {CommonEditorRegistry, EditorActionDescriptor} from 'vs/editor/common/editorCommonExtensions';
import editorCommon = require('vs/editor/common/editorCommon');
import {ExpandAbbreviationAction} from './emmetActions';
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {KeyCode} from 'vs/base/common/keyCodes';
import {KbExpr} from 'vs/platform/keybinding/common/keybindingService';

CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(ExpandAbbreviationAction,
	ExpandAbbreviationAction.ID,
	nls.localize('expandAbbreviationAction',
	"Emmet: Expand Abbreviation")));

KeybindingsRegistry.registerCommandRule({
	id: ExpandAbbreviationAction.ID,
	weight: KeybindingsRegistry.WEIGHT.editorContrib(),
	context: KbExpr.and(
		KbExpr.has(editorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS),
		KbExpr.not(editorCommon.KEYBINDING_CONTEXT_EDITOR_HAS_NON_EMPTY_SELECTION),
		KbExpr.not(editorCommon.KEYBINDING_CONTEXT_EDITOR_HAS_MULTIPLE_SELECTIONS),
		KbExpr.not(editorCommon.KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS)
	),
	primary: KeyCode.Tab
});
开发者ID:578723746,项目名称:vscode,代码行数:30,代码来源:emmet.contribution.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap