Clean up contextkey type names
This commit is contained in:
parent
3671802956
commit
8d43ec51ac
|
@ -57,7 +57,7 @@ declare module monaco.editor {
|
|||
export interface ICommandHandler {
|
||||
(...args:any[]): void;
|
||||
}
|
||||
#include(vs/platform/contextkey/common/contextkey): IKeybindingContextKey
|
||||
#include(vs/platform/contextkey/common/contextkey): IContextKey
|
||||
#include(vs/editor/browser/standalone/standaloneServices): IEditorOverrideServices
|
||||
#include(vs/platform/markers/common/markers): IMarkerData
|
||||
#include(vs/editor/browser/standalone/colorizer): IColorizerOptions, IColorizerElementOptions
|
||||
|
|
|
@ -10,7 +10,7 @@ import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
|
|||
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {ICommandService} from 'vs/platform/commands/common/commands';
|
||||
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
|
||||
import {IKeybindingContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {ICommandHandler} from 'vs/platform/commands/common/commands';
|
||||
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||
import {IActionDescriptor, ICodeEditorWidgetCreationOptions, IDiffEditorOptions, IModel, IModelChangedEvent, EventType} from 'vs/editor/common/editorCommon';
|
||||
|
@ -46,13 +46,13 @@ export interface IDiffEditorConstructionOptions extends IDiffEditorOptions {
|
|||
|
||||
export interface IStandaloneCodeEditor extends ICodeEditor {
|
||||
addCommand(keybinding:number, handler:ICommandHandler, context:string): string;
|
||||
createContextKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T>;
|
||||
createContextKey<T>(key: string, defaultValue: T): IContextKey<T>;
|
||||
addAction(descriptor:IActionDescriptor): void;
|
||||
}
|
||||
|
||||
export interface IStandaloneDiffEditor extends IDiffEditor {
|
||||
addCommand(keybinding:number, handler:ICommandHandler, context:string): string;
|
||||
createContextKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T>;
|
||||
createContextKey<T>(key: string, defaultValue: T): IContextKey<T>;
|
||||
addAction(descriptor:IActionDescriptor): void;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ export class StandaloneEditor extends CodeEditorWidget implements IStandaloneCod
|
|||
return this._standaloneKeybindingService.addDynamicKeybinding(keybinding, handler, context);
|
||||
}
|
||||
|
||||
public createContextKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T> {
|
||||
public createContextKey<T>(key: string, defaultValue: T): IContextKey<T> {
|
||||
if (!this._standaloneKeybindingService) {
|
||||
console.warn('Cannot create context key because the editor is configured with an unrecognized KeybindingService');
|
||||
return null;
|
||||
|
@ -208,7 +208,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
|
|||
return this._standaloneKeybindingService.addDynamicKeybinding(keybinding, handler, context);
|
||||
}
|
||||
|
||||
public createContextKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T> {
|
||||
public createContextKey<T>(key: string, defaultValue: T): IContextKey<T> {
|
||||
if (!this._standaloneKeybindingService) {
|
||||
console.warn('Cannot create context key because the editor is configured with an unrecognized KeybindingService');
|
||||
return null;
|
||||
|
|
|
@ -11,7 +11,7 @@ import * as timer from 'vs/base/common/timer';
|
|||
import * as browser from 'vs/base/browser/browser';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import {StyleMutator} from 'vs/base/browser/styleMutator';
|
||||
import {IKeybindingContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {ICommandService} from 'vs/platform/commands/common/commands';
|
||||
import {Range} from 'vs/editor/common/core/range';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
|
@ -89,7 +89,7 @@ export class View extends ViewEventHandler implements editorBrowser.IView, IDisp
|
|||
private accumulatedModelEvents: EmitterEvent[];
|
||||
private _renderAnimationFrame: IDisposable;
|
||||
|
||||
private _editorTextFocusContextKey: IKeybindingContextKey<boolean>;
|
||||
private _editorTextFocusContextKey: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
contextKeyService: IContextKeyService,
|
||||
|
|
|
@ -12,7 +12,7 @@ import {TPromise} from 'vs/base/common/winjs.base';
|
|||
import {ServicesAccessor, IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import {ICommandService} from 'vs/platform/commands/common/commands';
|
||||
import {IKeybindingContextKey, IKeybindingScopeLocation, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKey, IContextKeyServiceTarget, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||
import {CommonEditorConfiguration} from 'vs/editor/common/config/commonEditorConfig';
|
||||
import {DefaultConfig} from 'vs/editor/common/config/defaultConfig';
|
||||
|
@ -84,7 +84,7 @@ export abstract class CommonCodeEditor extends EventEmitter implements editorCom
|
|||
return this.addListener2(editorCommon.EventType.Disposed, listener);
|
||||
}
|
||||
|
||||
protected domElement: IKeybindingScopeLocation;
|
||||
protected domElement: IContextKeyServiceTarget;
|
||||
|
||||
protected id:number;
|
||||
|
||||
|
@ -115,16 +115,16 @@ export abstract class CommonCodeEditor extends EventEmitter implements editorCom
|
|||
private _decorationTypeSubtypes: {[decorationTypeKey:string]:{ [subtype:string]:boolean}};
|
||||
|
||||
private _codeEditorService: ICodeEditorService;
|
||||
private _editorIdContextKey: IKeybindingContextKey<string>;
|
||||
protected _editorFocusContextKey: IKeybindingContextKey<boolean>;
|
||||
private _editorTabMovesFocusKey: IKeybindingContextKey<boolean>;
|
||||
private _editorReadonly: IKeybindingContextKey<boolean>;
|
||||
private _hasMultipleSelectionsKey: IKeybindingContextKey<boolean>;
|
||||
private _hasNonEmptySelectionKey: IKeybindingContextKey<boolean>;
|
||||
private _langIdKey: IKeybindingContextKey<string>;
|
||||
private _editorIdContextKey: IContextKey<string>;
|
||||
protected _editorFocusContextKey: IContextKey<boolean>;
|
||||
private _editorTabMovesFocusKey: IContextKey<boolean>;
|
||||
private _editorReadonly: IContextKey<boolean>;
|
||||
private _hasMultipleSelectionsKey: IContextKey<boolean>;
|
||||
private _hasNonEmptySelectionKey: IContextKey<boolean>;
|
||||
private _langIdKey: IContextKey<string>;
|
||||
|
||||
constructor(
|
||||
domElement: IKeybindingScopeLocation,
|
||||
domElement: IContextKeyServiceTarget,
|
||||
options:editorCommon.IEditorOptions,
|
||||
instantiationService: IInstantiationService,
|
||||
codeEditorService: ICodeEditorService,
|
||||
|
|
|
@ -20,7 +20,7 @@ import {Selection} from 'vs/editor/common/core/selection';
|
|||
import {ModeTransition} from 'vs/editor/common/core/modeTransition';
|
||||
import {IndentRange} from 'vs/editor/common/model/indentRanges';
|
||||
import {ICommandHandlerDescription} from 'vs/platform/commands/common/commands';
|
||||
import {ContextKeyExpr, KbCtxKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {ContextKeyExpr, RawContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
@ -3030,18 +3030,18 @@ export namespace EditorContextKeys {
|
|||
* A context key that is set when the editor's text has focus (cursor is blinking).
|
||||
* @internal
|
||||
*/
|
||||
export const TextFocus = new KbCtxKey<boolean>('editorTextFocus', false);
|
||||
export const TextFocus = new RawContextKey<boolean>('editorTextFocus', false);
|
||||
/**
|
||||
* A context key that is set when the editor's text or an editor's widget has focus.
|
||||
* @internal
|
||||
*/
|
||||
export const Focus = new KbCtxKey<boolean>('editorFocus', false);
|
||||
export const Focus = new RawContextKey<boolean>('editorFocus', false);
|
||||
|
||||
/**
|
||||
* A context key that is set when the editor's text is readonly.
|
||||
* @internal
|
||||
*/
|
||||
export const ReadOnly = new KbCtxKey<boolean>('editorReadonly', false);
|
||||
export const ReadOnly = new RawContextKey<boolean>('editorReadonly', false);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
@ -3052,7 +3052,7 @@ export namespace EditorContextKeys {
|
|||
* A context key that is set when the editor has a non-collapsed selection.
|
||||
* @internal
|
||||
*/
|
||||
export const HasNonEmptySelection = new KbCtxKey<boolean>('editorHasSelection', false);
|
||||
export const HasNonEmptySelection = new RawContextKey<boolean>('editorHasSelection', false);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
@ -3062,7 +3062,7 @@ export namespace EditorContextKeys {
|
|||
* A context key that is set when the editor has multiple selections (multiple cursors).
|
||||
* @internal
|
||||
*/
|
||||
export const HasMultipleSelections = new KbCtxKey<boolean>('editorHasMultipleSelections', false);
|
||||
export const HasMultipleSelections = new RawContextKey<boolean>('editorHasMultipleSelections', false);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
@ -3071,7 +3071,7 @@ export namespace EditorContextKeys {
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const TabMovesFocus = new KbCtxKey<boolean>('editorTabMovesFocus', false);
|
||||
export const TabMovesFocus = new RawContextKey<boolean>('editorTabMovesFocus', false);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
@ -3081,7 +3081,7 @@ export namespace EditorContextKeys {
|
|||
* A context key that is set to the language associated with the model associated with the editor.
|
||||
* @internal
|
||||
*/
|
||||
export const LanguageId = new KbCtxKey<string>('editorLangId', undefined);
|
||||
export const LanguageId = new RawContextKey<string>('editorLangId', undefined);
|
||||
|
||||
};
|
||||
|
||||
|
@ -3093,47 +3093,47 @@ export namespace ModeContextKeys {
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasCompletionItemProvider = new KbCtxKey<boolean>('editorHasCompletionItemProvider', undefined);
|
||||
export const hasCompletionItemProvider = new RawContextKey<boolean>('editorHasCompletionItemProvider', undefined);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasCodeActionsProvider = new KbCtxKey<boolean>('editorHasCodeActionsProvider', undefined);
|
||||
export const hasCodeActionsProvider = new RawContextKey<boolean>('editorHasCodeActionsProvider', undefined);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasCodeLensProvider = new KbCtxKey<boolean>('editorHasCodeLensProvider', undefined);
|
||||
export const hasCodeLensProvider = new RawContextKey<boolean>('editorHasCodeLensProvider', undefined);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasDefinitionProvider = new KbCtxKey<boolean>('editorHasDefinitionProvider', undefined);
|
||||
export const hasDefinitionProvider = new RawContextKey<boolean>('editorHasDefinitionProvider', undefined);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasHoverProvider = new KbCtxKey<boolean>('editorHasHoverProvider', undefined);
|
||||
export const hasHoverProvider = new RawContextKey<boolean>('editorHasHoverProvider', undefined);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasDocumentHighlightProvider = new KbCtxKey<boolean>('editorHasDocumentHighlightProvider', undefined);
|
||||
export const hasDocumentHighlightProvider = new RawContextKey<boolean>('editorHasDocumentHighlightProvider', undefined);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasDocumentSymbolProvider = new KbCtxKey<boolean>('editorHasDocumentSymbolProvider', undefined);
|
||||
export const hasDocumentSymbolProvider = new RawContextKey<boolean>('editorHasDocumentSymbolProvider', undefined);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasReferenceProvider = new KbCtxKey<boolean>('editorHasReferenceProvider', undefined);
|
||||
export const hasReferenceProvider = new RawContextKey<boolean>('editorHasReferenceProvider', undefined);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasRenameProvider = new KbCtxKey<boolean>('editorHasRenameProvider', undefined);
|
||||
export const hasRenameProvider = new RawContextKey<boolean>('editorHasRenameProvider', undefined);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasFormattingProvider = new KbCtxKey<boolean>('editorHasFormattingProvider', undefined);
|
||||
export const hasFormattingProvider = new RawContextKey<boolean>('editorHasFormattingProvider', undefined);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const hasSignatureHelpProvider = new KbCtxKey<boolean>('editorHasSignatureHelpProvider', undefined);
|
||||
export const hasSignatureHelpProvider = new RawContextKey<boolean>('editorHasSignatureHelpProvider', undefined);
|
||||
}
|
||||
|
||||
export class BareFontInfo {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
'use strict';
|
||||
|
||||
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
|
||||
import {IKeybindingContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import {ICommonCodeEditor, ModeContextKeys} from 'vs/editor/common/editorCommon';
|
||||
|
||||
|
@ -14,17 +14,17 @@ export class EditorModeContext {
|
|||
private _disposables: IDisposable[] = [];
|
||||
private _editor: ICommonCodeEditor;
|
||||
|
||||
private _hasCompletionItemProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasCodeActionsProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasCodeLensProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasDefinitionProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasHoverProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasDocumentHighlightProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasDocumentSymbolProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasReferenceProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasRenameProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasFormattingProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasSignatureHelpProvider: IKeybindingContextKey<boolean>;
|
||||
private _hasCompletionItemProvider: IContextKey<boolean>;
|
||||
private _hasCodeActionsProvider: IContextKey<boolean>;
|
||||
private _hasCodeLensProvider: IContextKey<boolean>;
|
||||
private _hasDefinitionProvider: IContextKey<boolean>;
|
||||
private _hasHoverProvider: IContextKey<boolean>;
|
||||
private _hasDocumentHighlightProvider: IContextKey<boolean>;
|
||||
private _hasDocumentSymbolProvider: IContextKey<boolean>;
|
||||
private _hasReferenceProvider: IContextKey<boolean>;
|
||||
private _hasRenameProvider: IContextKey<boolean>;
|
||||
private _hasFormattingProvider: IContextKey<boolean>;
|
||||
private _hasSignatureHelpProvider: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
editor: ICommonCodeEditor,
|
||||
|
|
|
@ -16,7 +16,7 @@ import {StyleMutator} from 'vs/base/browser/styleMutator';
|
|||
import {Widget} from 'vs/base/browser/ui/widget';
|
||||
import {ServicesAccessor} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
|
||||
import {KbCtxKey, IKeybindingContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey, IContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import {GlobalScreenReaderNVDA} from 'vs/editor/common/config/commonEditorConfig';
|
||||
import {ICommonCodeEditor, IEditorContribution, EditorContextKeys} from 'vs/editor/common/editorCommon';
|
||||
|
@ -25,7 +25,7 @@ import {ICodeEditor, IOverlayWidget, IOverlayWidgetPosition} from 'vs/editor/bro
|
|||
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
|
||||
import {ToggleTabFocusModeAction} from 'vs/editor/contrib/toggleTabFocusMode/common/toggleTabFocusMode';
|
||||
|
||||
const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new KbCtxKey<boolean>('accessibilityHelpWidgetVisible', false);
|
||||
const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey<boolean>('accessibilityHelpWidgetVisible', false);
|
||||
const TOGGLE_EXPERIMENTAL_SCREEN_READER_SUPPORT_COMMAND_ID = 'toggleExperimentalScreenReaderSupport';
|
||||
|
||||
class AccessibilityHelpController extends Disposable implements IEditorContribution {
|
||||
|
@ -73,7 +73,7 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
|||
private _keybindingService2: IKeybindingService2;
|
||||
private _domNode: HTMLElement;
|
||||
private _isVisible: boolean;
|
||||
private _isVisibleKey: IKeybindingContextKey<boolean>;
|
||||
private _isVisibleKey: IContextKey<boolean>;
|
||||
|
||||
constructor(editor:ICodeEditor, contextKeyService: IContextKeyService, keybindingService2: IKeybindingService2) {
|
||||
super();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import * as nls from 'vs/nls';
|
||||
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
|
||||
import {Disposable} from 'vs/base/common/lifecycle';
|
||||
import {ContextKeyExpr, KbCtxKey, IKeybindingContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {ContextKeyExpr, RawContextKey, IContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {Range} from 'vs/editor/common/core/range';
|
||||
import {Selection} from 'vs/editor/common/core/selection';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
|
@ -33,7 +33,7 @@ export interface IFindStartOptions {
|
|||
shouldAnimate:boolean;
|
||||
}
|
||||
|
||||
export const CONTEXT_FIND_WIDGET_VISIBLE = new KbCtxKey<boolean>('findWidgetVisible', false);
|
||||
export const CONTEXT_FIND_WIDGET_VISIBLE = new RawContextKey<boolean>('findWidgetVisible', false);
|
||||
export const CONTEXT_FIND_WIDGET_NOT_VISIBLE: ContextKeyExpr = CONTEXT_FIND_WIDGET_VISIBLE.toNegated();
|
||||
|
||||
export class CommonFindController extends Disposable implements editorCommon.IEditorContribution {
|
||||
|
@ -41,7 +41,7 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
|
|||
private static ID = 'editor.contrib.findController';
|
||||
|
||||
private _editor: editorCommon.ICommonCodeEditor;
|
||||
private _findWidgetVisible: IKeybindingContextKey<boolean>;
|
||||
private _findWidgetVisible: IContextKey<boolean>;
|
||||
protected _state: FindReplaceState;
|
||||
private _model: FindModelBoundToEditorModel;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import {TPromise} from 'vs/base/common/winjs.base';
|
|||
import * as dom from 'vs/base/browser/dom';
|
||||
import {renderHtml} from 'vs/base/browser/htmlContentRenderer';
|
||||
import {ICommandService} from 'vs/platform/commands/common/commands';
|
||||
import {KbCtxKey, IKeybindingContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey, IContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IMarker, IMarkerService} from 'vs/platform/markers/common/markers';
|
||||
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||
import {Position} from 'vs/editor/common/core/position';
|
||||
|
@ -445,7 +445,7 @@ class MarkerController implements editorCommon.IEditorContribution {
|
|||
private _model: MarkerModel;
|
||||
private _zone: MarkerNavigationWidget;
|
||||
private _callOnClose: IDisposable[] = [];
|
||||
private _markersNavigationVisible: IKeybindingContextKey<boolean>;
|
||||
private _markersNavigationVisible: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
editor: ICodeEditor,
|
||||
|
@ -544,7 +544,7 @@ class PrevMarkerAction extends MarkerNavigationAction {
|
|||
}
|
||||
}
|
||||
|
||||
var CONTEXT_MARKERS_NAVIGATION_VISIBLE = new KbCtxKey<boolean>('markersNavigationVisible', false);
|
||||
var CONTEXT_MARKERS_NAVIGATION_VISIBLE = new RawContextKey<boolean>('markersNavigationVisible', false);
|
||||
|
||||
const MarkerCommand = EditorCommand.bindToContribution<MarkerController>(MarkerController.getMarkerController);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
|
|||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import Event, {Emitter} from 'vs/base/common/event';
|
||||
import { ICommonCodeEditor, ICursorSelectionChangedEvent } from 'vs/editor/common/editorCommon';
|
||||
import { IKeybindingContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { Context, provideSignatureHelp } from '../common/parameterHints';
|
||||
|
||||
const $ = dom.emmet;
|
||||
|
@ -161,8 +161,8 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
|
|||
private static ID = 'editor.widget.parameterHintsWidget';
|
||||
|
||||
private model: ParameterHintsModel;
|
||||
private keyVisible: IKeybindingContextKey<boolean>;
|
||||
private keyMultipleSignatures: IKeybindingContextKey<boolean>;
|
||||
private keyVisible: IContextKey<boolean>;
|
||||
private keyMultipleSignatures: IContextKey<boolean>;
|
||||
private element: HTMLElement;
|
||||
private signatures: HTMLElement;
|
||||
private overloads: HTMLElement;
|
||||
|
|
|
@ -11,11 +11,11 @@ import { CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions';
|
|||
import { SignatureHelp, SignatureHelpProviderRegistry } from 'vs/editor/common/modes';
|
||||
import { asWinJsPromise } from 'vs/base/common/async';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { KbCtxKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
export const Context = {
|
||||
Visible: new KbCtxKey<boolean>('parameterHintsVisible', false),
|
||||
MultipleSignatures: new KbCtxKey<boolean>('parameterHintsMultipleSignatures', false),
|
||||
Visible: new RawContextKey<boolean>('parameterHintsVisible', false),
|
||||
MultipleSignatures: new RawContextKey<boolean>('parameterHintsMultipleSignatures', false),
|
||||
};
|
||||
|
||||
export function provideSignatureHelp(model:IReadOnlyModel, position:Position): TPromise<SignatureHelp> {
|
||||
|
|
|
@ -9,7 +9,7 @@ import {onUnexpectedError} from 'vs/base/common/errors';
|
|||
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
|
||||
import {IEditorService} from 'vs/platform/editor/common/editor';
|
||||
import {ICommandService} from 'vs/platform/commands/common/commands';
|
||||
import {ContextKeyExpr, KbCtxKey, IKeybindingContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {ContextKeyExpr, RawContextKey, IContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IMarkerService} from 'vs/platform/markers/common/markers';
|
||||
import {IMessageService} from 'vs/platform/message/common/message';
|
||||
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||
|
@ -32,7 +32,7 @@ export class QuickFixController implements IEditorContribution {
|
|||
private editor:ICodeEditor;
|
||||
private model:QuickFixModel;
|
||||
private suggestWidget: QuickFixSelectionWidget;
|
||||
private quickFixWidgetVisible: IKeybindingContextKey<boolean>;
|
||||
private quickFixWidgetVisible: IContextKey<boolean>;
|
||||
|
||||
constructor(editor: ICodeEditor,
|
||||
@IMarkerService private _markerService: IMarkerService,
|
||||
|
@ -135,7 +135,7 @@ export class QuickFixAction extends EditorAction {
|
|||
}
|
||||
}
|
||||
|
||||
var CONTEXT_QUICK_FIX_WIDGET_VISIBLE = new KbCtxKey<boolean>('quickFixWidgetVisible', false);
|
||||
var CONTEXT_QUICK_FIX_WIDGET_VISIBLE = new RawContextKey<boolean>('quickFixWidgetVisible', false);
|
||||
|
||||
const QuickFixCommand = EditorCommand.bindToContribution<QuickFixController>(QuickFixController.getQuickFixController);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import Severity from 'vs/base/common/severity';
|
|||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
import {IEditorService} from 'vs/platform/editor/common/editor';
|
||||
import {IInstantiationService, optional} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {IKeybindingContextKey, IContextKeyService, KbCtxKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKey, IContextKeyService, RawContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IMessageService} from 'vs/platform/message/common/message';
|
||||
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||
import {IConfigurationService, getConfigurationValue} from 'vs/platform/configuration/common/configuration';
|
||||
|
@ -25,7 +25,7 @@ import {ReferencesModel, OneReference} from './referencesModel';
|
|||
import {ReferenceWidget, LayoutData} from './referencesWidget';
|
||||
import {Range} from 'vs/editor/common/core/range';
|
||||
|
||||
export const ctxReferenceSearchVisible = new KbCtxKey<boolean>('referenceSearchVisible', false);
|
||||
export const ctxReferenceSearchVisible = new RawContextKey<boolean>('referenceSearchVisible', false);
|
||||
|
||||
export interface RequestOptions {
|
||||
getMetaTitle(model: ReferencesModel): string;
|
||||
|
@ -43,7 +43,7 @@ export class ReferencesController implements editorCommon.IEditorContribution {
|
|||
private _disposables: IDisposable[] = [];
|
||||
private _ignoreModelChangeEvent = false;
|
||||
|
||||
private _referenceSearchVisible: IKeybindingContextKey<boolean>;
|
||||
private _referenceSearchVisible: IContextKey<boolean>;
|
||||
|
||||
static getController(editor:editorCommon.ICommonCodeEditor): ReferencesController {
|
||||
return <ReferencesController> editor.getContribution(ReferencesController.ID);
|
||||
|
|
|
@ -12,7 +12,7 @@ import Severity from 'vs/base/common/severity';
|
|||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
import {IEditorService} from 'vs/platform/editor/common/editor';
|
||||
import {IEventService} from 'vs/platform/event/common/event';
|
||||
import {KbCtxKey, IKeybindingContextKey, IContextKeyService, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey, IContextKey, IContextKeyService, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IMessageService} from 'vs/platform/message/common/message';
|
||||
import {IProgressService} from 'vs/platform/progress/common/progress';
|
||||
import {editorAction, ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
|
||||
|
@ -25,7 +25,7 @@ import RenameInputField from './renameInputField';
|
|||
|
||||
// --- register actions and commands
|
||||
|
||||
const CONTEXT_RENAME_INPUT_VISIBLE = new KbCtxKey<boolean>('renameInputVisible', false);
|
||||
const CONTEXT_RENAME_INPUT_VISIBLE = new RawContextKey<boolean>('renameInputVisible', false);
|
||||
|
||||
class RenameController implements IEditorContribution {
|
||||
|
||||
|
@ -36,7 +36,7 @@ class RenameController implements IEditorContribution {
|
|||
}
|
||||
|
||||
private _renameInputField: RenameInputField;
|
||||
private _renameInputVisible: IKeybindingContextKey<boolean>;
|
||||
private _renameInputVisible: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
private editor:ICodeEditor,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import * as collections from 'vs/base/common/collections';
|
||||
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import {KbCtxKey, IKeybindingContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey, IContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {EditOperation} from 'vs/editor/common/core/editOperation';
|
||||
import {Range} from 'vs/editor/common/core/range';
|
||||
import {Selection} from 'vs/editor/common/core/selection';
|
||||
|
@ -743,7 +743,7 @@ class SnippetController implements ISnippetController {
|
|||
|
||||
private _editor: editorCommon.ICommonCodeEditor;
|
||||
private _currentController: InsertSnippetController;
|
||||
private _inSnippetMode: IKeybindingContextKey<boolean>;
|
||||
private _inSnippetMode: IContextKey<boolean>;
|
||||
|
||||
constructor(editor: editorCommon.ICommonCodeEditor, @IContextKeyService contextKeyService: IContextKeyService) {
|
||||
this._editor = editor;
|
||||
|
@ -939,7 +939,7 @@ class SnippetController implements ISnippetController {
|
|||
}
|
||||
}
|
||||
|
||||
export var CONTEXT_SNIPPET_MODE = new KbCtxKey<boolean>('inSnippetMode', false);
|
||||
export var CONTEXT_SNIPPET_MODE = new RawContextKey<boolean>('inSnippetMode', false);
|
||||
|
||||
const SnippetCommand = EditorCommand.bindToContribution<ISnippetController>(SnippetController.get);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import { List } from 'vs/base/browser/ui/list/listWidget';
|
|||
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IKeybindingService2 } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IKeybindingContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IConfigurationChangedEvent } from 'vs/editor/common/editorCommon';
|
||||
import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser';
|
||||
import { Context as SuggestContext } from '../common/suggest';
|
||||
|
@ -319,9 +319,9 @@ export class SuggestWidget implements IContentWidget, IDisposable {
|
|||
private delegate: IDelegate<CompletionItem>;
|
||||
private list: List<CompletionItem>;
|
||||
|
||||
private suggestWidgetVisible: IKeybindingContextKey<boolean>;
|
||||
private suggestWidgetMultipleSuggestions: IKeybindingContextKey<boolean>;
|
||||
private suggestionSupportsAutoAccept: IKeybindingContextKey<boolean>;
|
||||
private suggestWidgetVisible: IContextKey<boolean>;
|
||||
private suggestWidgetMultipleSuggestions: IContextKey<boolean>;
|
||||
private suggestionSupportsAutoAccept: IContextKey<boolean>;
|
||||
|
||||
private editorBlurTimeout: TPromise<void>;
|
||||
private showTimeout: TPromise<void>;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
'use strict';
|
||||
|
||||
import {KeyCode} from 'vs/base/common/keyCodes';
|
||||
import {KbCtxKey, IContextKeyService, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey, IContextKeyService, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import {ISnippetsRegistry, Extensions, getNonWhitespacePrefix, ISnippet} from 'vs/editor/common/modes/snippetsRegistry';
|
||||
import {Registry} from 'vs/platform/platform';
|
||||
|
@ -22,7 +22,7 @@ let snippetsRegistry = <ISnippetsRegistry>Registry.as(Extensions.Snippets);
|
|||
class TabCompletionController implements editorCommon.IEditorContribution {
|
||||
|
||||
private static ID = 'editor.tabCompletionController';
|
||||
static ContextKey = new KbCtxKey<boolean>('hasSnippetCompletions', undefined);
|
||||
static ContextKey = new RawContextKey<boolean>('hasSnippetCompletions', undefined);
|
||||
|
||||
public static get(editor:editorCommon.ICommonCodeEditor): TabCompletionController {
|
||||
return <TabCompletionController>editor.getContribution(TabCompletionController.ID);
|
||||
|
|
|
@ -16,12 +16,12 @@ import {ISuggestResult, ISuggestSupport, ISuggestion, SuggestRegistry} from 'vs/
|
|||
import {ISnippetsRegistry, Extensions} from 'vs/editor/common/modes/snippetsRegistry';
|
||||
import {Position} from 'vs/editor/common/core/position';
|
||||
import {Registry} from 'vs/platform/platform';
|
||||
import {KbCtxKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
export const Context = {
|
||||
Visible: new KbCtxKey<boolean>('suggestWidgetVisible', false),
|
||||
MultipleSuggestions: new KbCtxKey<boolean>('suggestWidgetMultipleSuggestions', false),
|
||||
AcceptOnKey: new KbCtxKey<boolean>('suggestionSupportsAcceptOnKey', true)
|
||||
Visible: new RawContextKey<boolean>('suggestWidgetVisible', false),
|
||||
MultipleSuggestions: new RawContextKey<boolean>('suggestWidgetMultipleSuggestions', false),
|
||||
AcceptOnKey: new RawContextKey<boolean>('suggestionSupportsAcceptOnKey', true)
|
||||
};
|
||||
|
||||
export interface ISuggestionItem {
|
||||
|
|
|
@ -19,16 +19,16 @@ import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService';
|
|||
import {ICodeEditor} from 'vs/editor/browser/editorBrowser';
|
||||
import {IOptions, ZoneWidget} from './zoneWidget';
|
||||
import {EmbeddedCodeEditorWidget} from 'vs/editor/browser/widget/embeddedCodeEditorWidget';
|
||||
import {ContextKeyExpr, KbCtxKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {ContextKeyExpr, RawContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
export var IPeekViewService = createDecorator<IPeekViewService>('peekViewService');
|
||||
|
||||
export namespace PeekContext {
|
||||
export const inPeekEditor = new KbCtxKey<boolean>('inReferenceSearchEditor', true);
|
||||
export const inPeekEditor = new RawContextKey<boolean>('inReferenceSearchEditor', true);
|
||||
export const notInPeekEditor:ContextKeyExpr = inPeekEditor.toNegated();
|
||||
}
|
||||
|
||||
export const NOT_INNER_EDITOR_CONTEXT_KEY = new KbCtxKey<boolean>('inReferenceSearchEditor', true);
|
||||
export const NOT_INNER_EDITOR_CONTEXT_KEY = new RawContextKey<boolean>('inReferenceSearchEditor', true);
|
||||
|
||||
export interface IPeekViewService {
|
||||
_serviceBrand: any;
|
||||
|
|
|
@ -9,7 +9,7 @@ import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService';
|
|||
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import {InstantiationService} from 'vs/platform/instantiation/common/instantiationService';
|
||||
import {ICommandService, NullCommandService} from 'vs/platform/commands/common/commands';
|
||||
import {IContextKeyService, IKeybindingScopeLocation} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKeyService, IContextKeyServiceTarget} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {MockKeybindingService} from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||
import {ITelemetryService, NullTelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||
import {CommonCodeEditor} from 'vs/editor/common/commonCodeEditor';
|
||||
|
@ -65,7 +65,7 @@ export class MockCodeEditor extends CommonCodeEditor {
|
|||
}
|
||||
}
|
||||
|
||||
export class MockScopeLocation implements IKeybindingScopeLocation {
|
||||
export class MockScopeLocation implements IContextKeyServiceTarget {
|
||||
setAttribute(attr:string, value:string): void { }
|
||||
removeAttribute(attr:string): void { }
|
||||
hasAttribute(attr: string): boolean { return false; }
|
||||
|
|
6
src/vs/monaco.d.ts
vendored
6
src/vs/monaco.d.ts
vendored
|
@ -884,20 +884,20 @@ declare module monaco.editor {
|
|||
|
||||
export interface IStandaloneCodeEditor extends ICodeEditor {
|
||||
addCommand(keybinding: number, handler: ICommandHandler, context: string): string;
|
||||
createContextKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T>;
|
||||
createContextKey<T>(key: string, defaultValue: T): IContextKey<T>;
|
||||
addAction(descriptor: IActionDescriptor): void;
|
||||
}
|
||||
|
||||
export interface IStandaloneDiffEditor extends IDiffEditor {
|
||||
addCommand(keybinding: number, handler: ICommandHandler, context: string): string;
|
||||
createContextKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T>;
|
||||
createContextKey<T>(key: string, defaultValue: T): IContextKey<T>;
|
||||
addAction(descriptor: IActionDescriptor): void;
|
||||
}
|
||||
export interface ICommandHandler {
|
||||
(...args: any[]): void;
|
||||
}
|
||||
|
||||
export interface IKeybindingContextKey<T> {
|
||||
export interface IContextKey<T> {
|
||||
set(value: T): void;
|
||||
reset(): void;
|
||||
get(): T;
|
||||
|
|
|
@ -5,19 +5,19 @@
|
|||
'use strict';
|
||||
|
||||
import URI from 'vs/base/common/uri';
|
||||
import {KbCtxKey, IContextKeyService, IKeybindingContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey, IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IModeService} from 'vs/editor/common/services/modeService';
|
||||
|
||||
export class ResourceContextKey implements IKeybindingContextKey<URI> {
|
||||
export class ResourceContextKey implements IContextKey<URI> {
|
||||
|
||||
|
||||
static Scheme = new KbCtxKey<string>('resourceScheme', undefined);
|
||||
static LangId = new KbCtxKey<string>('resourceLangId', undefined);
|
||||
static Resource = new KbCtxKey<URI>('resource', undefined);
|
||||
static Scheme = new RawContextKey<string>('resourceScheme', undefined);
|
||||
static LangId = new RawContextKey<string>('resourceLangId', undefined);
|
||||
static Resource = new RawContextKey<URI>('resource', undefined);
|
||||
|
||||
private _resourceKey: IKeybindingContextKey<URI>;
|
||||
private _schemeKey: IKeybindingContextKey<string>;
|
||||
private _langIdKey: IKeybindingContextKey<string>;
|
||||
private _resourceKey: IContextKey<URI>;
|
||||
private _schemeKey: IContextKey<string>;
|
||||
private _langIdKey: IContextKey<string>;
|
||||
|
||||
constructor(
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
|
||||
import {CommandsRegistry} from 'vs/platform/commands/common/commands';
|
||||
import {KeybindingResolver} from 'vs/platform/keybinding/common/keybindingResolver';
|
||||
import {IKeybindingContextKey, IKeybindingScopeLocation, IContextKeyService, SET_CONTEXT_COMMAND_ID, KEYBINDING_CONTEXT_ATTR, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKey, IContextKeyServiceTarget, IContextKeyService, SET_CONTEXT_COMMAND_ID, KEYBINDING_CONTEXT_ATTR, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
|
||||
import Event, {Emitter, debounceEvent} from 'vs/base/common/event';
|
||||
|
||||
|
@ -101,7 +101,7 @@ class ConfigAwareKeybindingContext extends KeybindingContext {
|
|||
}
|
||||
}
|
||||
|
||||
class KeybindingContextKey<T> implements IKeybindingContextKey<T> {
|
||||
class KeybindingContextKey<T> implements IContextKey<T> {
|
||||
|
||||
private _parent: AbstractKeybindingService;
|
||||
private _key: string;
|
||||
|
@ -144,7 +144,7 @@ export abstract class AbstractKeybindingService {
|
|||
this._onDidChangeContextKey = new Emitter<string>();
|
||||
}
|
||||
|
||||
public createKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T> {
|
||||
public createKey<T>(key: string, defaultValue: T): IContextKey<T> {
|
||||
return new KeybindingContextKey(this, key, defaultValue);
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ export abstract class AbstractKeybindingService {
|
|||
return this._onDidChangeContext;
|
||||
}
|
||||
|
||||
public createScoped(domNode: IKeybindingScopeLocation): IContextKeyService {
|
||||
public createScoped(domNode: IContextKeyServiceTarget): IContextKeyService {
|
||||
return new ScopedKeybindingService(this, this._onDidChangeContextKey, domNode);
|
||||
}
|
||||
|
||||
|
@ -254,9 +254,9 @@ CommandsRegistry.registerCommand(SET_CONTEXT_COMMAND_ID, function (accessor, con
|
|||
class ScopedKeybindingService extends AbstractKeybindingService {
|
||||
|
||||
private _parent: AbstractKeybindingService;
|
||||
private _domNode: IKeybindingScopeLocation;
|
||||
private _domNode: IContextKeyServiceTarget;
|
||||
|
||||
constructor(parent: AbstractKeybindingService, emitter: Emitter<string>, domNode: IKeybindingScopeLocation) {
|
||||
constructor(parent: AbstractKeybindingService, emitter: Emitter<string>, domNode: IContextKeyServiceTarget) {
|
||||
super(parent.createChildContext());
|
||||
this._parent = parent;
|
||||
this._onDidChangeContextKey = emitter;
|
||||
|
|
|
@ -9,21 +9,91 @@ import Event from 'vs/base/common/event';
|
|||
|
||||
export const KEYBINDING_CONTEXT_ATTR = 'data-keybinding-context';
|
||||
|
||||
export enum KbExprType {
|
||||
KbDefinedExpression = 1,
|
||||
KbNotExpression = 2,
|
||||
KbEqualsExpression = 3,
|
||||
KbNotEqualsExpression = 4,
|
||||
KbAndExpression = 5
|
||||
export enum ContextKeyExprType {
|
||||
Defined = 1,
|
||||
Not = 2,
|
||||
Equals = 3,
|
||||
NotEquals = 4,
|
||||
And = 5
|
||||
}
|
||||
|
||||
export interface ContextKeyExpr {
|
||||
getType(): KbExprType;
|
||||
equals(other: ContextKeyExpr): boolean;
|
||||
evaluate(context: any): boolean;
|
||||
normalize(): ContextKeyExpr;
|
||||
serialize(): string;
|
||||
keys(): string[];
|
||||
export abstract class ContextKeyExpr {
|
||||
|
||||
public static has(key: string): ContextKeyExpr {
|
||||
return new ContextKeyDefinedExpr(key);
|
||||
}
|
||||
|
||||
public static equals(key: string, value: any): ContextKeyExpr {
|
||||
return new ContextKeyEqualsExpr(key, value);
|
||||
}
|
||||
|
||||
public static notEquals(key: string, value: any): ContextKeyExpr {
|
||||
return new ContextKeyNotEqualsExpr(key, value);
|
||||
}
|
||||
|
||||
public static not(key: string): ContextKeyExpr {
|
||||
return new ContextKeyNotExpr(key);
|
||||
}
|
||||
|
||||
public static and(...expr: ContextKeyExpr[]): ContextKeyExpr {
|
||||
return new ContextKeyAndExpr(expr);
|
||||
}
|
||||
|
||||
public static deserialize(serialized: string): ContextKeyExpr {
|
||||
if (!serialized) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let pieces = serialized.split('&&');
|
||||
let result = new ContextKeyAndExpr(pieces.map(p => this._deserializeOne(p)));
|
||||
return result.normalize();
|
||||
}
|
||||
|
||||
private static _deserializeOne(serializedOne: string): ContextKeyExpr {
|
||||
serializedOne = serializedOne.trim();
|
||||
|
||||
if (serializedOne.indexOf('!=') >= 0) {
|
||||
let pieces = serializedOne.split('!=');
|
||||
return new ContextKeyNotEqualsExpr(pieces[0].trim(), this._deserializeValue(pieces[1]));
|
||||
}
|
||||
|
||||
if (serializedOne.indexOf('==') >= 0) {
|
||||
let pieces = serializedOne.split('==');
|
||||
return new ContextKeyEqualsExpr(pieces[0].trim(), this._deserializeValue(pieces[1]));
|
||||
}
|
||||
|
||||
if (/^\!\s*/.test(serializedOne)) {
|
||||
return new ContextKeyNotExpr(serializedOne.substr(1).trim());
|
||||
}
|
||||
|
||||
return new ContextKeyDefinedExpr(serializedOne);
|
||||
}
|
||||
|
||||
private static _deserializeValue(serializedValue: string): any {
|
||||
serializedValue = serializedValue.trim();
|
||||
|
||||
if (serializedValue === 'true') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (serializedValue === 'false') {
|
||||
return false;
|
||||
}
|
||||
|
||||
let m = /^'([^']*)'$/.exec(serializedValue);
|
||||
if (m) {
|
||||
return m[1].trim();
|
||||
}
|
||||
|
||||
return serializedValue;
|
||||
}
|
||||
|
||||
public abstract getType(): ContextKeyExprType;
|
||||
public abstract equals(other: ContextKeyExpr): boolean;
|
||||
public abstract evaluate(context: any): boolean;
|
||||
public abstract normalize(): ContextKeyExpr;
|
||||
public abstract serialize(): string;
|
||||
public abstract keys(): string[];
|
||||
}
|
||||
|
||||
function cmp(a:ContextKeyExpr, b:ContextKeyExpr): number {
|
||||
|
@ -33,28 +103,28 @@ function cmp(a:ContextKeyExpr, b:ContextKeyExpr): number {
|
|||
return aType - bType;
|
||||
}
|
||||
switch(aType) {
|
||||
case KbExprType.KbDefinedExpression:
|
||||
return (<KbDefinedExpression>a).cmp(<KbDefinedExpression>b);
|
||||
case KbExprType.KbNotExpression:
|
||||
return (<KbNotExpression>a).cmp(<KbNotExpression>b);
|
||||
case KbExprType.KbEqualsExpression:
|
||||
return (<KbEqualsExpression>a).cmp(<KbEqualsExpression>b);
|
||||
case KbExprType.KbNotEqualsExpression:
|
||||
return (<KbNotEqualsExpression>a).cmp(<KbNotEqualsExpression>b);
|
||||
case ContextKeyExprType.Defined:
|
||||
return (<ContextKeyDefinedExpr>a).cmp(<ContextKeyDefinedExpr>b);
|
||||
case ContextKeyExprType.Not:
|
||||
return (<ContextKeyNotExpr>a).cmp(<ContextKeyNotExpr>b);
|
||||
case ContextKeyExprType.Equals:
|
||||
return (<ContextKeyEqualsExpr>a).cmp(<ContextKeyEqualsExpr>b);
|
||||
case ContextKeyExprType.NotEquals:
|
||||
return (<ContextKeyNotEqualsExpr>a).cmp(<ContextKeyNotEqualsExpr>b);
|
||||
default:
|
||||
throw new Error('Unknown ContextKeyExpr!');
|
||||
}
|
||||
}
|
||||
|
||||
export class KbDefinedExpression implements ContextKeyExpr {
|
||||
export class ContextKeyDefinedExpr implements ContextKeyExpr {
|
||||
constructor(protected key: string) {
|
||||
}
|
||||
|
||||
public getType(): KbExprType {
|
||||
return KbExprType.KbDefinedExpression;
|
||||
public getType(): ContextKeyExprType {
|
||||
return ContextKeyExprType.Defined;
|
||||
}
|
||||
|
||||
public cmp(other:KbDefinedExpression): number {
|
||||
public cmp(other:ContextKeyDefinedExpr): number {
|
||||
if (this.key < other.key) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -65,7 +135,7 @@ export class KbDefinedExpression implements ContextKeyExpr {
|
|||
}
|
||||
|
||||
public equals(other: ContextKeyExpr): boolean {
|
||||
if (other instanceof KbDefinedExpression) {
|
||||
if (other instanceof ContextKeyDefinedExpr) {
|
||||
return (this.key === other.key);
|
||||
}
|
||||
return false;
|
||||
|
@ -88,15 +158,15 @@ export class KbDefinedExpression implements ContextKeyExpr {
|
|||
}
|
||||
}
|
||||
|
||||
export class KbEqualsExpression implements ContextKeyExpr {
|
||||
export class ContextKeyEqualsExpr implements ContextKeyExpr {
|
||||
constructor(private key: string, private value: any) {
|
||||
}
|
||||
|
||||
public getType(): KbExprType {
|
||||
return KbExprType.KbEqualsExpression;
|
||||
public getType(): ContextKeyExprType {
|
||||
return ContextKeyExprType.Equals;
|
||||
}
|
||||
|
||||
public cmp(other:KbEqualsExpression): number {
|
||||
public cmp(other:ContextKeyEqualsExpr): number {
|
||||
if (this.key < other.key) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -113,7 +183,7 @@ export class KbEqualsExpression implements ContextKeyExpr {
|
|||
}
|
||||
|
||||
public equals(other: ContextKeyExpr): boolean {
|
||||
if (other instanceof KbEqualsExpression) {
|
||||
if (other instanceof ContextKeyEqualsExpr) {
|
||||
return (this.key === other.key && this.value === other.value);
|
||||
}
|
||||
return false;
|
||||
|
@ -129,9 +199,9 @@ export class KbEqualsExpression implements ContextKeyExpr {
|
|||
public normalize(): ContextKeyExpr {
|
||||
if (typeof this.value === 'boolean') {
|
||||
if (this.value) {
|
||||
return new KbDefinedExpression(this.key);
|
||||
return new ContextKeyDefinedExpr(this.key);
|
||||
}
|
||||
return new KbNotExpression(this.key);
|
||||
return new ContextKeyNotExpr(this.key);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -149,15 +219,15 @@ export class KbEqualsExpression implements ContextKeyExpr {
|
|||
}
|
||||
}
|
||||
|
||||
export class KbNotEqualsExpression implements ContextKeyExpr {
|
||||
export class ContextKeyNotEqualsExpr implements ContextKeyExpr {
|
||||
constructor(private key: string, private value: any) {
|
||||
}
|
||||
|
||||
public getType(): KbExprType {
|
||||
return KbExprType.KbNotEqualsExpression;
|
||||
public getType(): ContextKeyExprType {
|
||||
return ContextKeyExprType.NotEquals;
|
||||
}
|
||||
|
||||
public cmp(other:KbNotEqualsExpression): number {
|
||||
public cmp(other:ContextKeyNotEqualsExpr): number {
|
||||
if (this.key < other.key) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -174,7 +244,7 @@ export class KbNotEqualsExpression implements ContextKeyExpr {
|
|||
}
|
||||
|
||||
public equals(other: ContextKeyExpr): boolean {
|
||||
if (other instanceof KbNotEqualsExpression) {
|
||||
if (other instanceof ContextKeyNotEqualsExpr) {
|
||||
return (this.key === other.key && this.value === other.value);
|
||||
}
|
||||
return false;
|
||||
|
@ -190,9 +260,9 @@ export class KbNotEqualsExpression implements ContextKeyExpr {
|
|||
public normalize(): ContextKeyExpr {
|
||||
if (typeof this.value === 'boolean') {
|
||||
if (this.value) {
|
||||
return new KbNotExpression(this.key);
|
||||
return new ContextKeyNotExpr(this.key);
|
||||
}
|
||||
return new KbDefinedExpression(this.key);
|
||||
return new ContextKeyDefinedExpr(this.key);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -210,15 +280,15 @@ export class KbNotEqualsExpression implements ContextKeyExpr {
|
|||
}
|
||||
}
|
||||
|
||||
export class KbNotExpression implements ContextKeyExpr {
|
||||
export class ContextKeyNotExpr implements ContextKeyExpr {
|
||||
constructor(private key: string) {
|
||||
}
|
||||
|
||||
public getType(): KbExprType {
|
||||
return KbExprType.KbNotExpression;
|
||||
public getType(): ContextKeyExprType {
|
||||
return ContextKeyExprType.Not;
|
||||
}
|
||||
|
||||
public cmp(other:KbNotExpression): number {
|
||||
public cmp(other:ContextKeyNotExpr): number {
|
||||
if (this.key < other.key) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -229,7 +299,7 @@ export class KbNotExpression implements ContextKeyExpr {
|
|||
}
|
||||
|
||||
public equals(other: ContextKeyExpr): boolean {
|
||||
if (other instanceof KbNotExpression) {
|
||||
if (other instanceof ContextKeyNotExpr) {
|
||||
return (this.key === other.key);
|
||||
}
|
||||
return false;
|
||||
|
@ -252,19 +322,19 @@ export class KbNotExpression implements ContextKeyExpr {
|
|||
}
|
||||
}
|
||||
|
||||
export class KbAndExpression implements ContextKeyExpr {
|
||||
export class ContextKeyAndExpr implements ContextKeyExpr {
|
||||
private expr: ContextKeyExpr[];
|
||||
|
||||
constructor(expr: ContextKeyExpr[]) {
|
||||
this.expr = KbAndExpression._normalizeArr(expr);
|
||||
this.expr = ContextKeyAndExpr._normalizeArr(expr);
|
||||
}
|
||||
|
||||
public getType(): KbExprType {
|
||||
return KbExprType.KbAndExpression;
|
||||
public getType(): ContextKeyExprType {
|
||||
return ContextKeyExprType.And;
|
||||
}
|
||||
|
||||
public equals(other: ContextKeyExpr): boolean {
|
||||
if (other instanceof KbAndExpression) {
|
||||
if (other instanceof ContextKeyAndExpr) {
|
||||
if (this.expr.length !== other.expr.length) {
|
||||
return false;
|
||||
}
|
||||
|
@ -301,7 +371,7 @@ export class KbAndExpression implements ContextKeyExpr {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (e instanceof KbAndExpression) {
|
||||
if (e instanceof ContextKeyAndExpr) {
|
||||
expr = expr.concat(e.expr);
|
||||
continue;
|
||||
}
|
||||
|
@ -346,7 +416,7 @@ export class KbAndExpression implements ContextKeyExpr {
|
|||
}
|
||||
}
|
||||
|
||||
export class KbCtxKey<T> extends KbDefinedExpression {
|
||||
export class RawContextKey<T> extends ContextKeyDefinedExpr {
|
||||
|
||||
private _defaultValue: T;
|
||||
|
||||
|
@ -355,7 +425,7 @@ export class KbCtxKey<T> extends KbDefinedExpression {
|
|||
this._defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public bindTo(target:IContextKeyService): IKeybindingContextKey<T> {
|
||||
public bindTo(target:IContextKeyService): IContextKey<T> {
|
||||
return target.createKey(this.key, this._defaultValue);
|
||||
}
|
||||
|
||||
|
@ -372,74 +442,18 @@ export class KbCtxKey<T> extends KbDefinedExpression {
|
|||
}
|
||||
}
|
||||
|
||||
export let ContextKeyExpr = {
|
||||
has: (key: string) => new KbDefinedExpression(key),
|
||||
equals: (key: string, value: any) => new KbEqualsExpression(key, value),
|
||||
notEquals: (key: string, value: any) => new KbNotEqualsExpression(key, value),
|
||||
not: (key: string) => new KbNotExpression(key),
|
||||
and: (...expr: ContextKeyExpr[]) => new KbAndExpression(expr),
|
||||
deserialize: (serialized: string): ContextKeyExpr => {
|
||||
if (!serialized) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let pieces = serialized.split('&&');
|
||||
let result = new KbAndExpression(pieces.map(p => ContextKeyExpr._deserializeOne(p)));
|
||||
return result.normalize();
|
||||
},
|
||||
|
||||
_deserializeOne: (serializedOne: string): ContextKeyExpr => {
|
||||
serializedOne = serializedOne.trim();
|
||||
|
||||
if (serializedOne.indexOf('!=') >= 0) {
|
||||
let pieces = serializedOne.split('!=');
|
||||
return new KbNotEqualsExpression(pieces[0].trim(), ContextKeyExpr._deserializeValue(pieces[1]));
|
||||
}
|
||||
|
||||
if (serializedOne.indexOf('==') >= 0) {
|
||||
let pieces = serializedOne.split('==');
|
||||
return new KbEqualsExpression(pieces[0].trim(), ContextKeyExpr._deserializeValue(pieces[1]));
|
||||
}
|
||||
|
||||
if (/^\!\s*/.test(serializedOne)) {
|
||||
return new KbNotExpression(serializedOne.substr(1).trim());
|
||||
}
|
||||
|
||||
return new KbDefinedExpression(serializedOne);
|
||||
},
|
||||
|
||||
_deserializeValue: (serializedValue: string): any => {
|
||||
serializedValue = serializedValue.trim();
|
||||
|
||||
if (serializedValue === 'true') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (serializedValue === 'false') {
|
||||
return false;
|
||||
}
|
||||
|
||||
let m = /^'([^']*)'$/.exec(serializedValue);
|
||||
if (m) {
|
||||
return m[1].trim();
|
||||
}
|
||||
|
||||
return serializedValue;
|
||||
}
|
||||
};
|
||||
|
||||
export interface IKeybindingContextKey<T> {
|
||||
export interface IContextKey<T> {
|
||||
set(value: T): void;
|
||||
reset(): void;
|
||||
get(): T;
|
||||
}
|
||||
|
||||
export interface IKeybindingScopeLocation {
|
||||
export interface IContextKeyServiceTarget {
|
||||
setAttribute(attr: string, value: string): void;
|
||||
removeAttribute(attr: string): void;
|
||||
}
|
||||
|
||||
export interface IKeybindingContext {
|
||||
export interface IContextValuesProvider {
|
||||
fillInContext(bucket: any): void;
|
||||
}
|
||||
|
||||
|
@ -450,13 +464,13 @@ export interface IContextKeyService {
|
|||
dispose(): void;
|
||||
|
||||
onDidChangeContext: Event<string[]>;
|
||||
createKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T>;
|
||||
createKey<T>(key: string, defaultValue: T): IContextKey<T>;
|
||||
contextMatchesRules(rules: ContextKeyExpr): boolean;
|
||||
getContextValue<T>(key: string): T;
|
||||
|
||||
createScoped(domNode: IKeybindingScopeLocation): IContextKeyService;
|
||||
createScoped(domNode: IContextKeyServiceTarget): IContextKeyService;
|
||||
|
||||
getContext(contextId: number): IKeybindingContext;
|
||||
getContext(contextId: number): IContextValuesProvider;
|
||||
}
|
||||
|
||||
export const SET_CONTEXT_COMMAND_ID = 'setContext';
|
||||
|
|
|
@ -8,7 +8,7 @@ import * as assert from 'assert';
|
|||
import {BinaryKeybindings, KeyCode, KeyMod} from 'vs/base/common/keyCodes';
|
||||
import {IOSupport, KeybindingResolver, NormalizedKeybindingItem} from 'vs/platform/keybinding/common/keybindingResolver';
|
||||
import {IKeybindingItem} from 'vs/platform/keybinding/common/keybinding';
|
||||
import {KbAndExpression, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {ContextKeyAndExpr, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
suite('Keybinding Service', () => {
|
||||
|
||||
|
@ -313,10 +313,10 @@ suite('Keybinding Service', () => {
|
|||
|
||||
test('contextIsEntirelyIncluded', function() {
|
||||
let assertIsIncluded = (a: ContextKeyExpr[], b: ContextKeyExpr[]) => {
|
||||
assert.equal(KeybindingResolver.whenIsEntirelyIncluded(false, new KbAndExpression(a), new KbAndExpression(b)), true);
|
||||
assert.equal(KeybindingResolver.whenIsEntirelyIncluded(false, new ContextKeyAndExpr(a), new ContextKeyAndExpr(b)), true);
|
||||
};
|
||||
let assertIsNotIncluded = (a: ContextKeyExpr[], b: ContextKeyExpr[]) => {
|
||||
assert.equal(KeybindingResolver.whenIsEntirelyIncluded(false, new KbAndExpression(a), new KbAndExpression(b)), false);
|
||||
assert.equal(KeybindingResolver.whenIsEntirelyIncluded(false, new ContextKeyAndExpr(a), new ContextKeyAndExpr(b)), false);
|
||||
};
|
||||
let key1IsTrue = ContextKeyExpr.equals('key1', true);
|
||||
let key1IsNotFalse = ContextKeyExpr.notEquals('key1', false);
|
||||
|
|
|
@ -8,9 +8,9 @@ import {IHTMLContentElement} from 'vs/base/common/htmlContent';
|
|||
import {Keybinding} from 'vs/base/common/keyCodes';
|
||||
import Event from 'vs/base/common/event';
|
||||
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
|
||||
import {IKeybindingContextKey, IContextKeyService, IKeybindingContext, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKey, IContextKeyService, IContextValuesProvider, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
class MockKeybindingContextKey<T> implements IKeybindingContextKey<T> {
|
||||
class MockKeybindingContextKey<T> implements IContextKey<T> {
|
||||
private _key: string;
|
||||
private _defaultValue: T;
|
||||
private _value: T;
|
||||
|
@ -39,7 +39,7 @@ export class MockKeybindingService implements IContextKeyService {
|
|||
|
||||
public dispose(): void { }
|
||||
|
||||
public createKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T> {
|
||||
public createKey<T>(key: string, defaultValue: T): IContextKey<T> {
|
||||
return new MockKeybindingContextKey(key, defaultValue);
|
||||
}
|
||||
public contextMatchesRules(rules: ContextKeyExpr): boolean {
|
||||
|
@ -51,7 +51,7 @@ export class MockKeybindingService implements IContextKeyService {
|
|||
public getContextValue(key: string) {
|
||||
return;
|
||||
}
|
||||
public getContext(contextId: number): IKeybindingContext {
|
||||
public getContext(contextId: number): IContextValuesProvider {
|
||||
return null;
|
||||
}
|
||||
public createScoped(domNode: HTMLElement): IContextKeyService {
|
||||
|
|
|
@ -35,10 +35,10 @@ import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollect
|
|||
import {IMessageService} from 'vs/platform/message/common/message';
|
||||
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
|
||||
import {IModeService} from 'vs/editor/common/services/modeService';
|
||||
import {KbCtxKey, IContextKeyService, IKeybindingContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey, IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IThemeService} from 'vs/workbench/services/themes/common/themeService';
|
||||
|
||||
export const TextCompareEditorVisible = new KbCtxKey<boolean>('textCompareEditorVisible', false);
|
||||
export const TextCompareEditorVisible = new RawContextKey<boolean>('textCompareEditorVisible', false);
|
||||
|
||||
/**
|
||||
* The text editor that leverages the diff text editor for the editing experience.
|
||||
|
@ -51,7 +51,7 @@ export class TextDiffEditor extends BaseTextEditor {
|
|||
private nextDiffAction: NavigateAction;
|
||||
private previousDiffAction: NavigateAction;
|
||||
|
||||
private textDiffEditorVisible: IKeybindingContextKey<boolean>;
|
||||
private textDiffEditorVisible: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
|
|
|
@ -37,11 +37,11 @@ import {IInstantiationService} from 'vs/platform/instantiation/common/instantiat
|
|||
import {IMessageService, Severity} from 'vs/platform/message/common/message';
|
||||
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||
import {IWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
|
||||
import {IContextKeyService, KbCtxKey, IKeybindingContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKeyService, RawContextKey, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IHistoryService} from 'vs/workbench/services/history/common/history';
|
||||
|
||||
const HELP_PREFIX = '?';
|
||||
const QUICK_OPEN_MODE = new KbCtxKey<boolean>('inQuickOpen', false);
|
||||
const QUICK_OPEN_MODE = new RawContextKey<boolean>('inQuickOpen', false);
|
||||
|
||||
interface IPickOpenEntryItem extends IPickOpenEntry {
|
||||
height?: number;
|
||||
|
@ -76,7 +76,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
|
|||
private mapResolvedHandlersToPrefix: { [prefix: string]: QuickOpenHandler; };
|
||||
private currentResultToken: string;
|
||||
private currentPickerToken: string;
|
||||
private inQuickOpenMode: IKeybindingContextKey<boolean>;
|
||||
private inQuickOpenMode: IContextKey<boolean>;
|
||||
private promisesToCompleteOnHide: ValueCallback[];
|
||||
private previousActiveHandlerDescriptor: QuickOpenHandlerDescriptor;
|
||||
private actionProvider = new ContributableActionProvider();
|
||||
|
|
|
@ -48,7 +48,7 @@ import {WorkbenchKeybindingService2} from 'vs/workbench/services/keybinding/elec
|
|||
import {KeybindingService} from 'vs/platform/contextkey/browser/contextKeyService';
|
||||
import {IWorkspace, IConfiguration} from 'vs/platform/workspace/common/workspace';
|
||||
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
|
||||
import {ContextKeyExpr, KbCtxKey, IContextKeyService, IKeybindingContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {ContextKeyExpr, RawContextKey, IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IActivityService} from 'vs/workbench/services/activity/common/activityService';
|
||||
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
|
||||
import {IPanelService} from 'vs/workbench/services/panel/common/panelService';
|
||||
|
@ -69,8 +69,8 @@ import {IMenuService} from 'vs/platform/actions/common/actions';
|
|||
import {MenuService} from 'vs/platform/actions/common/menuService';
|
||||
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
|
||||
|
||||
export const MessagesVisibleContext = new KbCtxKey<boolean>('globalMessageVisible', false);
|
||||
export const EditorsVisibleContext = new KbCtxKey<boolean>('editorIsOpen', false);
|
||||
export const MessagesVisibleContext = new RawContextKey<boolean>('globalMessageVisible', false);
|
||||
export const EditorsVisibleContext = new RawContextKey<boolean>('editorIsOpen', false);
|
||||
export const NoEditorsVisibleContext:ContextKeyExpr = EditorsVisibleContext.toNegated();
|
||||
|
||||
interface WorkbenchParams {
|
||||
|
@ -124,8 +124,8 @@ export class Workbench implements IPartService {
|
|||
private sideBarPosition: Position;
|
||||
private panelHidden: boolean;
|
||||
private editorBackgroundDelayer: Delayer<void>;
|
||||
private messagesVisibleContext: IKeybindingContextKey<boolean>;
|
||||
private editorsVisibleContext: IKeybindingContextKey<boolean>;
|
||||
private messagesVisibleContext: IContextKey<boolean>;
|
||||
private editorsVisibleContext: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
container: HTMLElement,
|
||||
|
|
|
@ -18,12 +18,12 @@ import editorbrowser = require('vs/editor/browser/editorBrowser');
|
|||
import {ZoneWidget} from 'vs/editor/contrib/zoneWidget/browser/zoneWidget';
|
||||
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
|
||||
import {KbCtxKey, IContextKeyService, IKeybindingContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey, IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import debug = require('vs/workbench/parts/debug/common/debug');
|
||||
import {IKeyboardEvent} from 'vs/base/browser/keyboardEvent';
|
||||
|
||||
const $ = dom.emmet;
|
||||
const CONTEXT_BREAKPOINT_WIDGET_VISIBLE = new KbCtxKey<boolean>('breakpointWidgetVisible', false);
|
||||
const CONTEXT_BREAKPOINT_WIDGET_VISIBLE = new RawContextKey<boolean>('breakpointWidgetVisible', false);
|
||||
const CLOSE_BREAKPOINT_WIDGET_COMMAND_ID = 'closeBreakpointWidget';
|
||||
|
||||
export class BreakpointWidget extends ZoneWidget {
|
||||
|
@ -32,7 +32,7 @@ export class BreakpointWidget extends ZoneWidget {
|
|||
|
||||
private inputBox: InputBox;
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
private breakpointWidgetVisible: IKeybindingContextKey<boolean>;
|
||||
private breakpointWidgetVisible: IContextKey<boolean>;
|
||||
|
||||
constructor(editor: editorbrowser.ICodeEditor, private lineNumber: number,
|
||||
@IContextViewService private contextViewService: IContextViewService,
|
||||
|
|
|
@ -11,12 +11,12 @@ import {createDecorator} from 'vs/platform/instantiation/common/instantiation';
|
|||
import editor = require('vs/editor/common/editorCommon');
|
||||
import {Source} from 'vs/workbench/parts/debug/common/debugSource';
|
||||
import {Range} from 'vs/editor/common/core/range';
|
||||
import {KbCtxKey, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
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 KbCtxKey<boolean>('inDebugMode', false);
|
||||
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 EDITOR_CONTRIBUTION_ID = 'editor.contrib.debug';
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import severity from 'vs/base/common/severity';
|
|||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
import aria = require('vs/base/browser/ui/aria/aria');
|
||||
import editorbrowser = require('vs/editor/browser/editorBrowser');
|
||||
import {IContextKeyService, IKeybindingContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IMarkerService} from 'vs/platform/markers/common/markers';
|
||||
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import {IExtensionService} from 'vs/platform/extensions/common/extensions';
|
||||
|
@ -73,7 +73,7 @@ export class DebugService implements debug.IDebugService {
|
|||
private lastTaskEvent: TaskEvent;
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
private toDisposeOnSessionEnd: lifecycle.IDisposable[];
|
||||
private inDebugMode: IKeybindingContextKey<boolean>;
|
||||
private inDebugMode: IContextKey<boolean>;
|
||||
private breakpointsToSendOnResourceSaved: { [uri: string]: boolean };
|
||||
|
||||
constructor(
|
||||
|
|
|
@ -30,7 +30,7 @@ import {EditorInput, EditorOptions} from 'vs/workbench/common/editor';
|
|||
import {BaseEditor} from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
|
||||
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
|
||||
import {IContextKeyService, IKeybindingContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
export class ExplorerViewlet extends Viewlet {
|
||||
private viewletContainer: Builder;
|
||||
|
@ -48,7 +48,7 @@ export class ExplorerViewlet extends Viewlet {
|
|||
private viewletState: FileViewletState;
|
||||
private dimension: Dimension;
|
||||
|
||||
private viewletVisibleContextKey: IKeybindingContextKey<boolean>;
|
||||
private viewletVisibleContextKey: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
|
|
|
@ -14,14 +14,14 @@ import {EncodingMode, EditorInput, IFileEditorInput, ConfirmResult, IWorkbenchEd
|
|||
import {IFileStat, IFilesConfiguration, IBaseStat, IResolveContentOptions} from 'vs/platform/files/common/files';
|
||||
import {createDecorator} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {FileStat} from 'vs/workbench/parts/files/common/explorerViewModel';
|
||||
import {KbCtxKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
/**
|
||||
* Explorer viewlet id.
|
||||
*/
|
||||
export const VIEWLET_ID = 'workbench.view.explorer';
|
||||
|
||||
export const ExplorerViewletVisible = new KbCtxKey<boolean>('explorerViewletVisible', true);
|
||||
export const ExplorerViewletVisible = new RawContextKey<boolean>('explorerViewletVisible', true);
|
||||
|
||||
/**
|
||||
* File editor input id.
|
||||
|
|
|
@ -46,7 +46,7 @@ import {ISearchService} from 'vs/platform/search/common/search';
|
|||
import {IProgressService} from 'vs/platform/progress/common/progress';
|
||||
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
||||
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
|
||||
import {IContextKeyService, IKeybindingContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||
import {KeyCode, CommonKeybindings} from 'vs/base/common/keyCodes';
|
||||
import { PatternInputWidget } from 'vs/workbench/parts/search/browser/patternInputWidget';
|
||||
|
@ -69,7 +69,7 @@ export class SearchViewlet extends Viewlet {
|
|||
private viewModel: SearchModel;
|
||||
private callOnModelChange: lifecycle.IDisposable[];
|
||||
|
||||
private viewletVisible: IKeybindingContextKey<boolean>;
|
||||
private viewletVisible: IContextKey<boolean>;
|
||||
private actionRegistry: { [key: string]: Action; };
|
||||
private tree: ITree;
|
||||
private viewletSettings: any;
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Button } from 'vs/base/browser/ui/button/button';
|
|||
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { IKeybindingService2 } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ContextKeyExpr, KbCtxKey, IContextKeyService, IKeybindingContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ContextKeyExpr, RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
|
@ -65,7 +65,7 @@ class ReplaceAllAction extends Action {
|
|||
|
||||
export class SearchWidget extends Widget {
|
||||
|
||||
static REPLACE_ACTIVE_CONTEXT_KEY= new KbCtxKey<boolean>('replaceActive', false);
|
||||
static REPLACE_ACTIVE_CONTEXT_KEY= new RawContextKey<boolean>('replaceActive', false);
|
||||
private static REPLACE_ALL_DISABLED_LABEL= nls.localize('search.action.replaceAll.disabled.label', "Replace All (Submit Search to Enable)");
|
||||
private static REPLACE_ALL_ENABLED_LABEL=(keyBindingService2: IKeybindingService2):string=>{
|
||||
let keybindings = keyBindingService2.lookupKeybindings(ReplaceAllAction.ID);
|
||||
|
@ -79,7 +79,7 @@ export class SearchWidget extends Widget {
|
|||
private replaceContainer: HTMLElement;
|
||||
private toggleReplaceButton: Button;
|
||||
private replaceAllAction: ReplaceAllAction;
|
||||
private replaceActive: IKeybindingContextKey<boolean>;
|
||||
private replaceActive: IContextKey<boolean>;
|
||||
private replaceActionBar: ActionBar;
|
||||
|
||||
private _onSearchSubmit = this._register(new Emitter<boolean>());
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import {KbCtxKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
export const VIEWLET_ID = 'workbench.view.search';
|
||||
|
||||
export const SearchViewletVisible = new KbCtxKey<boolean>('searchViewletVisible', true);
|
||||
export const SearchViewletVisible = new RawContextKey<boolean>('searchViewletVisible', true);
|
||||
|
|
|
@ -11,7 +11,7 @@ import processes = require('vs/base/node/processes');
|
|||
import {Builder} from 'vs/base/browser/builder';
|
||||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
import {createDecorator} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {KbCtxKey, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {RawContextKey, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
export const TERMINAL_PANEL_ID = 'workbench.panel.terminal';
|
||||
|
||||
|
@ -24,7 +24,7 @@ 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 KbCtxKey<boolean>('terminalFocus', undefined);
|
||||
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);
|
||||
|
|
|
@ -12,7 +12,7 @@ import {Dimension} from 'vs/base/browser/builder';
|
|||
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
|
||||
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
|
||||
import {IKeybindingContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IMessageService, Severity} from 'vs/platform/message/common/message';
|
||||
import {ITerminalFont} from 'vs/workbench/parts/terminal/electron-browser/terminalConfigHelper';
|
||||
import {ITerminalProcess, ITerminalService} from 'vs/workbench/parts/terminal/electron-browser/terminal';
|
||||
|
@ -43,7 +43,7 @@ export class TerminalInstance {
|
|||
private keybindingService2: IKeybindingService2,
|
||||
private terminalService: ITerminalService,
|
||||
private messageService: IMessageService,
|
||||
private terminalFocusContextKey: IKeybindingContextKey<boolean>,
|
||||
private terminalFocusContextKey: IContextKey<boolean>,
|
||||
private onExitCallback: (TerminalInstance) => void
|
||||
) {
|
||||
let self = this;
|
||||
|
|
|
@ -15,7 +15,7 @@ import {IConfigurationService} from 'vs/platform/configuration/common/configurat
|
|||
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
|
||||
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
|
||||
import {IKeybindingContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IMessageService} from 'vs/platform/message/common/message';
|
||||
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||
import {ITerminalFont, TerminalConfigHelper} from 'vs/workbench/parts/terminal/electron-browser/terminalConfigHelper';
|
||||
|
@ -175,7 +175,7 @@ export class TerminalPanel extends Panel {
|
|||
}));
|
||||
}
|
||||
|
||||
public createNewTerminalInstance(terminalProcess: ITerminalProcess, terminalFocusContextKey: IKeybindingContextKey<boolean>): TPromise<void> {
|
||||
public createNewTerminalInstance(terminalProcess: ITerminalProcess, terminalFocusContextKey: IContextKey<boolean>): TPromise<void> {
|
||||
return this.createTerminal(terminalProcess, terminalFocusContextKey).then(() => {
|
||||
this.updateConfig();
|
||||
this.focus();
|
||||
|
@ -207,7 +207,7 @@ export class TerminalPanel extends Panel {
|
|||
return super.setVisible(visible);
|
||||
}
|
||||
|
||||
private createTerminal(terminalProcess: ITerminalProcess, terminalFocusContextKey: IKeybindingContextKey<boolean>): TPromise<TerminalInstance> {
|
||||
private createTerminal(terminalProcess: ITerminalProcess, terminalFocusContextKey: IContextKey<boolean>): TPromise<TerminalInstance> {
|
||||
return new TPromise<TerminalInstance>(resolve => {
|
||||
var terminalInstance = new TerminalInstance(
|
||||
terminalProcess,
|
||||
|
|
|
@ -14,7 +14,7 @@ import {Builder} from 'vs/base/browser/builder';
|
|||
import {EndOfLinePreference} from 'vs/editor/common/editorCommon';
|
||||
import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService';
|
||||
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
|
||||
import {IKeybindingContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IContextKey, IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IMessageService, Severity} from 'vs/platform/message/common/message';
|
||||
import {IPanelService} from 'vs/workbench/services/panel/common/panelService';
|
||||
import {IPartService} from 'vs/workbench/services/part/common/partService';
|
||||
|
@ -30,7 +30,7 @@ export class TerminalService implements ITerminalService {
|
|||
|
||||
private activeTerminalIndex: number = 0;
|
||||
private terminalProcesses: ITerminalProcess[] = [];
|
||||
protected _terminalFocusContextKey: IKeybindingContextKey<boolean>;
|
||||
protected _terminalFocusContextKey: IContextKey<boolean>;
|
||||
|
||||
private configHelper: TerminalConfigHelper;
|
||||
private _onActiveInstanceChanged: Emitter<string>;
|
||||
|
|
Loading…
Reference in a new issue