本文整理汇总了TypeScript中vs/platform/contextkey/common/contextkey.RawContextKey类的典型用法代码示例。如果您正苦于以下问题:TypeScript RawContextKey类的具体用法?TypeScript RawContextKey怎么用?TypeScript RawContextKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RawContextKey类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: require
import Event from 'vs/base/common/event';
import platform = require('vs/base/common/platform');
import { IDisposable } from 'vs/base/common/lifecycle';
import { RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { TPromise } from 'vs/base/common/winjs.base';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
export const TERMINAL_PANEL_ID = 'workbench.panel.terminal';
export const TERMINAL_SERVICE_ID = 'terminalService';
export const TERMINAL_DEFAULT_RIGHT_CLICK_COPY_PASTE = platform.isWindows;
/** A context key that is set when the integrated terminal has focus. */
export const KEYBINDING_CONTEXT_TERMINAL_FOCUS = new RawContextKey<boolean>('terminalFocus', undefined);
/** A context key that is set when the integrated terminal does not have focus. */
export const KEYBINDING_CONTEXT_TERMINAL_NOT_FOCUSED: ContextKeyExpr = KEYBINDING_CONTEXT_TERMINAL_FOCUS.toNegated();
/** A keybinding context key that is set when the integrated terminal has text selected. */
export const KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED = new RawContextKey<boolean>('terminalTextSelected', undefined);
/** A keybinding context key that is set when the integrated terminal does not have text selected. */
export const KEYBINDING_CONTEXT_TERMINAL_TEXT_NOT_SELECTED: ContextKeyExpr = KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED.toNegated();
/** A context key that is set when the find widget in integrated terminal is visible. */
export const KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE = new RawContextKey<boolean>('terminalFindWidgetVisible', undefined);
/** A context key that is set when the find widget in integrated terminal is not visible. */
export const KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_NOT_VISIBLE: ContextKeyExpr = KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE.toNegated();
/** A context key that is set when the find widget find input in integrated terminal is focused. */
export const KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED = new RawContextKey<boolean>('terminalFindWidgetInputFocused', false);
/** A context key that is set when the find widget find input in integrated terminal is not focused. */
开发者ID:SeanKilleen,项目名称:vscode,代码行数:30,代码来源:terminal.ts
示例2:
export namespace EditorContextKeys {
/**
* A context key that is set when the editor's text has focus (cursor is blinking).
*/
export const editorTextFocus = new RawContextKey<boolean>('editorTextFocus', false);
/**
* A context key that is set when the editor's text or an editor's widget has focus.
*/
export const focus = new RawContextKey<boolean>('editorFocus', false);
/**
* A context key that is set when any editor input has focus (regular editor, repl input...).
*/
export const textInputFocus = new RawContextKey<boolean>('textInputFocus', false);
export const readOnly = new RawContextKey<boolean>('editorReadonly', false);
export const writable: ContextKeyExpr = readOnly.toNegated();
export const hasNonEmptySelection = new RawContextKey<boolean>('editorHasSelection', false);
export const hasOnlyEmptySelection: ContextKeyExpr = hasNonEmptySelection.toNegated();
export const hasMultipleSelections = new RawContextKey<boolean>('editorHasMultipleSelections', false);
export const hasSingleSelection: ContextKeyExpr = hasMultipleSelections.toNegated();
export const tabMovesFocus = new RawContextKey<boolean>('editorTabMovesFocus', false);
export const tabDoesNotMoveFocus: ContextKeyExpr = tabMovesFocus.toNegated();
export const isInEmbeddedEditor = new RawContextKey<boolean>('isInEmbeddedEditor', false);
export const canUndo = new RawContextKey<boolean>('canUndo', false);
export const canRedo = new RawContextKey<boolean>('canRedo', false);
// -- mode context keys
export const languageId = new RawContextKey<string>('editorLangId', '');
export const hasCompletionItemProvider = new RawContextKey<boolean>('editorHasCompletionItemProvider', false);
export const hasCodeActionsProvider = new RawContextKey<boolean>('editorHasCodeActionsProvider', false);
开发者ID:DonJayamanne,项目名称:vscode,代码行数:31,代码来源:editorContextKeys.ts
示例3:
import Event from 'vs/base/common/event';
import { IJSONSchemaSnippet } from 'vs/base/common/jsonSchema';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IModel as EditorIModel, IEditorContribution, IRange } from 'vs/editor/common/editorCommon';
import { IEditor } from 'vs/platform/editor/common/editor';
import { Position } from 'vs/editor/common/core/position';
import { ISuggestion } from 'vs/editor/common/modes';
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
import { Range } from 'vs/editor/common/core/range';
import { RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
export const VIEWLET_ID = 'workbench.view.debug';
export const REPL_ID = 'workbench.panel.repl';
export const DEBUG_SERVICE_ID = 'debugService';
export const CONTEXT_IN_DEBUG_MODE = new RawContextKey<boolean>('inDebugMode', false);
export const CONTEXT_NOT_IN_DEBUG_MODE: ContextKeyExpr = CONTEXT_IN_DEBUG_MODE.toNegated();
export const CONTEXT_IN_DEBUG_REPL = new RawContextKey<boolean>('inDebugRepl', false);
export const CONTEXT_NOT_IN_DEBUG_REPL: ContextKeyExpr = CONTEXT_IN_DEBUG_REPL.toNegated();
export const CONTEXT_ON_FIRST_DEBUG_REPL_LINE = new RawContextKey<boolean>('onFirsteDebugReplLine', false);
export const CONTEXT_ON_LAST_DEBUG_REPL_LINE = new RawContextKey<boolean>('onLastDebugReplLine', false);
export const CONTEXT_BREAKPOINT_WIDGET_VISIBLE = new RawContextKey<boolean>('breakpointWidgetVisible', false);
export const EDITOR_CONTRIBUTION_ID = 'editor.contrib.debug';
export const DEBUG_SCHEME = 'debug';
// raw
export interface IRawModelUpdate {
threadId: number;
sessionId: string;
开发者ID:pk-codebox-evo,项目名称:ide-microsoft-vscode,代码行数:31,代码来源:debug.ts
示例4:
import {TPromise} from 'vs/base/common/winjs.base';
import {createDecorator} from 'vs/platform/instantiation/common/instantiation';
import {RawContextKey, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
export const TERMINAL_PANEL_ID = 'workbench.panel.terminal';
export const TERMINAL_SERVICE_ID = 'terminalService';
export const TERMINAL_DEFAULT_SHELL_LINUX = !platform.isWindows ? (process.env.SHELL || 'sh') : 'sh';
export const TERMINAL_DEFAULT_SHELL_OSX = !platform.isWindows ? (process.env.SHELL || 'sh') : 'sh';
export const TERMINAL_DEFAULT_SHELL_WINDOWS = processes.getWindowsShell();
/**
* A context key that is set when the integrated terminal has focus.
*/
export const KEYBINDING_CONTEXT_TERMINAL_FOCUS = new RawContextKey<boolean>('terminalFocus', undefined);
export const KEYBINDING_CONTEXT_TERMINAL_NOT_FOCUSED:ContextKeyExpr = KEYBINDING_CONTEXT_TERMINAL_FOCUS.toNegated();
export const ITerminalService = createDecorator<ITerminalService>(TERMINAL_SERVICE_ID);
export interface ITerminalConfiguration {
terminal: {
integrated: {
shell: {
linux: string,
osx: string,
windows: string
},
shellArgs: {
linux: string[],
osx: string[]
开发者ID:douglaseccker,项目名称:vscode,代码行数:31,代码来源:terminal.ts
示例5:
constructor(
id: string,
telemetryService: ITelemetryService,
themeService: IThemeService,
storageService: IStorageService,
contextKeyService: IContextKeyService,
) {
super(id, telemetryService, themeService, storageService);
if (contextKeyService) {
this.contextKey = KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS.bindTo(contextKeyService);
this.findInputFocusContextKey = KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED.bindTo(contextKeyService);
}
}
开发者ID:kieferrm,项目名称:vscode,代码行数:13,代码来源:webviewEditor.ts
示例6: getResourceForCommand
handler: (accessor, resource: URI | object) => {
const listService = accessor.get(IListService);
globalResourceToCompare = getResourceForCommand(resource, listService, accessor.get(IEditorService));
if (!resourceSelectedForCompareContext) {
resourceSelectedForCompareContext = ResourceSelectedForCompareContext.bindTo(accessor.get(IContextKeyService));
}
resourceSelectedForCompareContext.set(true);
}
开发者ID:joelday,项目名称:vscode,代码行数:9,代码来源:fileCommands.ts
示例7:
constructor(
id: string,
telemetryService: ITelemetryService,
themeService: IThemeService,
contextKeyService: IContextKeyService,
) {
super(id, telemetryService, themeService);
if (contextKeyService) {
this.findWidgetVisible = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE.bindTo(contextKeyService);
}
}
开发者ID:ramesius,项目名称:vscode,代码行数:11,代码来源:baseWebviewEditor.ts
示例8:
constructor(
id: string,
telemetryService: ITelemetryService,
themeService: IThemeService,
storageService: IStorageService,
contextKeyService: IContextKeyService,
) {
super(id, telemetryService, themeService, storageService);
if (contextKeyService) {
this.contextKey = KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS.bindTo(contextKeyService);
}
}
开发者ID:naturtle,项目名称:vscode,代码行数:12,代码来源:webviewEditor.ts
示例9: getResourceForCommand
handler: (accessor, resource: URI | object) => {
const listService = accessor.get(IListService);
const tree = listService.lastFocusedList;
// Remove highlight
if (tree instanceof Tree) {
tree.clearHighlight();
tree.domFocus();
}
globalResourceToCompare = getResourceForCommand(resource, listService, accessor.get(IWorkbenchEditorService));
if (!resourceSelectedForCompareContext) {
resourceSelectedForCompareContext = ResourceSelectedForCompareContext.bindTo(accessor.get(IContextKeyService));
}
resourceSelectedForCompareContext.set(true);
}
开发者ID:jinlongchen2018,项目名称:vscode,代码行数:15,代码来源:fileCommands.ts
示例10: registerNotificationCommands
export function registerNotificationCommands(center: INotificationsCenterController, toasts: INotificationsToastController): void {
function getNotificationFromContext(listService: IListService, context?: any): INotificationViewItem {
if (isNotificationViewItem(context)) {
return context;
}
const list = listService.lastFocusedList;
if (list instanceof WorkbenchList) {
const focusedElement = list.getFocusedElements()[0];
if (isNotificationViewItem(focusedElement)) {
return focusedElement;
}
}
return void 0;
}
// Show Notifications Cneter
CommandsRegistry.registerCommand(SHOW_NOTIFICATIONS_CENTER, () => {
center.show();
});
// Hide Notifications Center
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: HIDE_NOTIFICATIONS_CENTER,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50),
when: NotificationsCenterVisibleContext,
primary: KeyCode.Escape,
handler: accessor => center.hide()
});
// Toggle Notifications Center
CommandsRegistry.registerCommand(TOGGLE_NOTIFICATIONS_CENTER, accessor => {
if (center.isVisible) {
center.hide();
} else {
center.show();
}
});
// Clear Notification
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: CLEAR_NOTIFICATION,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: NotificationFocusedContext,
primary: KeyCode.Delete,
mac: {
primary: KeyMod.CtrlCmd | KeyCode.Backspace
},
handler: (accessor, args?: any) => {
const notification = getNotificationFromContext(accessor.get(IListService), args);
if (notification) {
notification.dispose();
}
}
});
// Expand Notification
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: EXPAND_NOTIFICATION,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: NotificationFocusedContext,
primary: KeyCode.RightArrow,
handler: (accessor, args?: any) => {
const notification = getNotificationFromContext(accessor.get(IListService), args);
if (notification) {
notification.expand();
}
}
});
// Collapse Notification
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: COLLAPSE_NOTIFICATION,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: NotificationFocusedContext,
primary: KeyCode.LeftArrow,
handler: (accessor, args?: any) => {
const notification = getNotificationFromContext(accessor.get(IListService), args);
if (notification) {
notification.collapse();
}
}
});
// Toggle Notification
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: TOGGLE_NOTIFICATION,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: NotificationFocusedContext,
primary: KeyCode.Space,
secondary: [KeyCode.Enter],
handler: accessor => {
const notification = getNotificationFromContext(accessor.get(IListService));
if (notification) {
notification.toggle();
}
}
});
//.........这里部分代码省略.........
开发者ID:sameer-coder,项目名称:vscode,代码行数:101,代码来源:notificationsCommands.ts
注:本文中的vs/platform/contextkey/common/contextkey.RawContextKey类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论