mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Merge branch 'master' into ben/electron
This commit is contained in:
commit
73571b598f
22
extensions/theme-dark-plus/package.json
Normal file
22
extensions/theme-dark-plus/package.json
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "theme-dark-plus",
|
||||
"version": "0.1.0",
|
||||
"publisher": "vscode",
|
||||
"engines": { "vscode": "*" },
|
||||
"contributes": {
|
||||
"themes": [
|
||||
{
|
||||
"label": "Dark+",
|
||||
"description": "Dark theme with a touch of color",
|
||||
"uiTheme": "vs-dark",
|
||||
"path": "./themes/dark_plus.tmTheme"
|
||||
},
|
||||
{
|
||||
"label": "Light+",
|
||||
"description": "Light theme with a touch of color",
|
||||
"uiTheme": "vs",
|
||||
"path": "./themes/light_plus.tmTheme"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
55
extensions/theme-dark-plus/themes/dark_plus.tmTheme
Normal file
55
extensions/theme-dark-plus/themes/dark_plus.tmTheme
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Dark+</string>
|
||||
<key>settings</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Function declarations</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#DCDCAA</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Types declaration and references</string>
|
||||
<key>scope</key>
|
||||
<string>meta.parameter.type, entity.name.class, new.storage.type, meta.cast, cast.storage.type, heritage.storage.type, annotation.storage.type, var.annotation.storage.type</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#4EC9B0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Control flow keywords</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.control, meta.preprocessor</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#C586C0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Parameter name</string>
|
||||
<key>scope</key>
|
||||
<string>meta.parameter.type.variable, variable.parameter</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#9CDCFE</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
55
extensions/theme-dark-plus/themes/light_plus.tmTheme
Normal file
55
extensions/theme-dark-plus/themes/light_plus.tmTheme
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Light+</string>
|
||||
<key>settings</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Function declarations</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#404040</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Types declaration and references</string>
|
||||
<key>scope</key>
|
||||
<string>meta.parameter.type, entity.name.class, new.storage.type, meta.cast, cast.storage.type, heritage.storage.type, annotation.storage.type, var.annotation.storage.type</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#2B91AF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Control flow keywords</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.control, meta.preprocessor</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#AF00DB</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Parameter name</string>
|
||||
<key>scope</key>
|
||||
<string>meta.parameter.type.variable, variable.parameter</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#001080</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -15,6 +15,8 @@
|
|||
"activationEvents": [
|
||||
"onLanguage:typescript",
|
||||
"onLanguage:typescriptreact",
|
||||
"onLanguage:javascript",
|
||||
"onLanguage:javascriptreact",
|
||||
"onCommand:typescript.reloadProjects"
|
||||
],
|
||||
"main": "./out/typescriptMain",
|
||||
|
|
|
@ -33,7 +33,8 @@ export function activate(context: ExtensionContext): void {
|
|||
|
||||
let MODE_ID_TS = 'typescript';
|
||||
let MODE_ID_TSX = 'typescriptreact';
|
||||
let MY_PLUGIN_ID = 'vs.language.typescript';
|
||||
let MODE_ID_JS = 'javascript';
|
||||
let MODE_ID_JSX = 'javascriptreact';
|
||||
|
||||
let clientHost = new TypeScriptServiceClientHost();
|
||||
let client = clientHost.serviceClient;
|
||||
|
@ -45,6 +46,11 @@ export function activate(context: ExtensionContext): void {
|
|||
client.onReady().then(() => {
|
||||
registerSupports(MODE_ID_TS, clientHost, client);
|
||||
registerSupports(MODE_ID_TSX, clientHost, client);
|
||||
let useSalsa = !!process.env['CODE_TSJS'] || !!process.env['VSCODE_TSJS']
|
||||
if (useSalsa) {
|
||||
registerSupports(MODE_ID_JS, clientHost, client);
|
||||
registerSupports(MODE_ID_JSX, clientHost, client);
|
||||
}
|
||||
}, () => {
|
||||
// Nothing to do here. The client did show a message;
|
||||
})
|
||||
|
|
|
@ -117,6 +117,11 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
|||
} else if (workspace.rootPath) {
|
||||
modulePath = path.join(workspace.rootPath, this.tsdk, 'tsserver.js');
|
||||
}
|
||||
} else if (!!process.env['CODE_TSJS'] || !!process.env['VSCODE_TSJS']) {
|
||||
let candidate = path.join(workspace.rootPath, 'node_modules', 'typescript', 'lib', 'tsserver.js');
|
||||
if (fs.existsSync(candidate)) {
|
||||
modulePath = candidate;
|
||||
}
|
||||
}
|
||||
if (!fs.existsSync(modulePath)) {
|
||||
window.showErrorMessage(`The path ${path.dirname(modulePath)} doesn't point to a valid tsserver install. TypeScript language features will be disabled.`);
|
||||
|
|
6
npm-shrinkwrap.json
generated
6
npm-shrinkwrap.json
generated
|
@ -416,9 +416,9 @@
|
|||
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz"
|
||||
},
|
||||
"vscode-debugprotocol": {
|
||||
"version": "1.1.1",
|
||||
"from": "vscode-debugprotocol@>=1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.1.1.tgz"
|
||||
"version": "1.2.1",
|
||||
"from": "vscode-debugprotocol@>=1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.2.1.tgz"
|
||||
},
|
||||
"vscode-textmate": {
|
||||
"version": "1.0.9",
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"iconv-lite": "^0.4.13",
|
||||
"sax": "^1.1.1",
|
||||
"semver": "^4.2.0",
|
||||
"vscode-debugprotocol": "^1.1.1",
|
||||
"vscode-debugprotocol": "^1.2.1",
|
||||
"vscode-textmate": "^1.0.9",
|
||||
"native-keymap": "^0.1.2",
|
||||
"winreg": "0.0.12",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
.monaco-split-view > .split-view-view > .header {
|
||||
position: relative;
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
|
|
|
@ -64,8 +64,8 @@ export class View extends ee.EventEmitter {
|
|||
|
||||
this.size = 0;
|
||||
this._sizing = types.isUndefined(opts.sizing) ? ViewSizing.Flexible : opts.sizing;
|
||||
this._fixedSize = types.isUndefined(opts.fixedSize) ? 24 : opts.fixedSize;
|
||||
this._minimumSize = types.isUndefined(opts.minimumSize) ? 24 : opts.minimumSize;
|
||||
this._fixedSize = types.isUndefined(opts.fixedSize) ? 22 : opts.fixedSize;
|
||||
this._minimumSize = types.isUndefined(opts.minimumSize) ? 22 : opts.minimumSize;
|
||||
}
|
||||
|
||||
public get sizing(): ViewSizing { return this._sizing; }
|
||||
|
@ -108,7 +108,7 @@ export class HeaderView extends View {
|
|||
constructor(opts: IHeaderViewOptions) {
|
||||
super(opts);
|
||||
|
||||
this.headerSize = types.isUndefined(opts.headerSize) ? 24 : opts.headerSize;
|
||||
this.headerSize = types.isUndefined(opts.headerSize) ? 22 : opts.headerSize;
|
||||
}
|
||||
|
||||
public render(container: HTMLElement, orientation: Orientation): void {
|
||||
|
@ -292,7 +292,7 @@ export class FixedCollapsibleView extends AbstractCollapsibleView {
|
|||
|
||||
constructor(opts: IFixedCollapsibleViewOptions) {
|
||||
super(objects.mixin({ sizing: ViewSizing.Fixed }, opts));
|
||||
this._expandedBodySize = types.isUndefined(opts.expandedBodySize) ? 24 : opts.expandedBodySize;
|
||||
this._expandedBodySize = types.isUndefined(opts.expandedBodySize) ? 22 : opts.expandedBodySize;
|
||||
}
|
||||
|
||||
public get fixedSize(): number { return this.state === CollapsibleState.EXPANDED ? this.expandedSize : this.headerSize; }
|
||||
|
|
|
@ -421,7 +421,7 @@ class Renderer implements IRenderer<QuickOpenEntry> {
|
|||
return (<QuickOpenEntryItem>entry).getHeight();
|
||||
}
|
||||
|
||||
return 24;
|
||||
return 22;
|
||||
}
|
||||
|
||||
public getTemplateId(entry: QuickOpenEntry): string {
|
||||
|
|
|
@ -61,7 +61,7 @@ export class QuickOpenController extends DefaultController {
|
|||
export class QuickOpenWidget implements IModelProvider {
|
||||
|
||||
public static MAX_WIDTH = 600; // Max total width of quick open widget
|
||||
public static MAX_ITEMS_HEIGHT = 20 * 24; // Max height of item list below input field
|
||||
public static MAX_ITEMS_HEIGHT = 20 * 22; // Max height of item list below input field
|
||||
|
||||
private options: IQuickOpenOptions;
|
||||
private builder: Builder;
|
||||
|
@ -693,7 +693,7 @@ export class QuickOpenWidget implements IModelProvider {
|
|||
this.tree.setInput(null);
|
||||
|
||||
// Reset Tree Height
|
||||
this.treeContainer.style({ height: (this.options.minItemsToShow ? this.options.minItemsToShow * 24 : 0) + 'px' });
|
||||
this.treeContainer.style({ height: (this.options.minItemsToShow ? this.options.minItemsToShow * 22 : 0) + 'px' });
|
||||
|
||||
// Clear any running Progress
|
||||
this.progressBar.stop().getContainer().hide();
|
||||
|
|
|
@ -278,7 +278,12 @@ export class ViewItem implements IViewItem {
|
|||
if (afterElement === null) {
|
||||
container.appendChild(this.element);
|
||||
} else {
|
||||
container.insertBefore(this.element, afterElement);
|
||||
try {
|
||||
container.insertBefore(this.element, afterElement);
|
||||
} catch (e) {
|
||||
console.warn('Failed to locate previous tree element');
|
||||
container.appendChild(this.element);
|
||||
}
|
||||
}
|
||||
|
||||
this.render();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
'use strict';
|
||||
|
||||
import {KeybindingsRegistry,ICommandDescriptor} from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import {IKeybindingContextRule, IKeybindings} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {KbExpr, IKeybindings} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {ServicesAccessor} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {IEditorService} from 'vs/platform/editor/common/editor';
|
||||
import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService';
|
||||
|
@ -60,12 +60,12 @@ function triggerEditorHandler(handlerId: string, accessor: ServicesAccessor, arg
|
|||
});
|
||||
}
|
||||
|
||||
function registerCoreCommand(handlerId: string, kb: IKeybindings, weight: number = KeybindingsRegistry.WEIGHT.editorCore(), context?: IKeybindingContextRule[]) {
|
||||
function registerCoreCommand(handlerId: string, kb: IKeybindings, weight: number = KeybindingsRegistry.WEIGHT.editorCore(), context?: KbExpr) {
|
||||
var desc: ICommandDescriptor = {
|
||||
id: handlerId,
|
||||
handler: triggerEditorHandler.bind(null, handlerId),
|
||||
weight: weight,
|
||||
context: (context ? context : [{ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS}]),
|
||||
context: (context ? context : KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS)),
|
||||
primary: kb.primary,
|
||||
secondary: kb.secondary,
|
||||
win: kb.win,
|
||||
|
@ -219,16 +219,16 @@ registerCoreCommand(H.ScrollPageDown, {
|
|||
|
||||
registerCoreCommand(H.Tab, {
|
||||
primary: KeyCode.Tab
|
||||
}, KeybindingsRegistry.WEIGHT.editorCore(), [
|
||||
{ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS },
|
||||
{ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS, operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL, operand: true }
|
||||
]);
|
||||
}, KeybindingsRegistry.WEIGHT.editorCore(), KbExpr.and(
|
||||
KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS),
|
||||
KbExpr.not(EditorCommon.KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS)
|
||||
));
|
||||
registerCoreCommand(H.Outdent, {
|
||||
primary: KeyMod.Shift | KeyCode.Tab
|
||||
}, KeybindingsRegistry.WEIGHT.editorCore(), [
|
||||
{ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS },
|
||||
{ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS, operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL, operand: true }
|
||||
]);
|
||||
}, KeybindingsRegistry.WEIGHT.editorCore(), KbExpr.and(
|
||||
KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS),
|
||||
KbExpr.not(EditorCommon.KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS)
|
||||
));
|
||||
|
||||
registerCoreCommand(H.DeleteLeft, {
|
||||
primary: KeyCode.Backspace,
|
||||
|
@ -263,16 +263,16 @@ registerWordCommand(H.DeleteWordRight, false, KeyCode.Delete);
|
|||
|
||||
registerCoreCommand(H.CancelSelection, {
|
||||
primary: KeyCode.Escape
|
||||
}, KeybindingsRegistry.WEIGHT.editorCore(), [
|
||||
{ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS },
|
||||
{ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_HAS_NON_EMPTY_SELECTION }
|
||||
]);
|
||||
}, KeybindingsRegistry.WEIGHT.editorCore(), KbExpr.and(
|
||||
KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS),
|
||||
KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_HAS_NON_EMPTY_SELECTION)
|
||||
));
|
||||
registerCoreCommand(H.RemoveSecondaryCursors, {
|
||||
primary: KeyCode.Escape
|
||||
}, KeybindingsRegistry.WEIGHT.editorCore(1), [
|
||||
{ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS },
|
||||
{ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_HAS_MULTIPLE_SELECTIONS }
|
||||
]);
|
||||
}, KeybindingsRegistry.WEIGHT.editorCore(1), KbExpr.and(
|
||||
KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS),
|
||||
KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_HAS_MULTIPLE_SELECTIONS)
|
||||
));
|
||||
|
||||
registerCoreCommand(H.CursorTop, {
|
||||
primary: KeyMod.CtrlCmd | KeyCode.Home,
|
||||
|
|
|
@ -16,7 +16,7 @@ import {KeybindingsRegistry,ICommandDescriptor} from 'vs/platform/keybinding/com
|
|||
import config = require('vs/editor/common/config/config');
|
||||
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {SyncDescriptor1, createSyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
|
||||
import {IKeybindingContextRule, ICommandHandler, IKeybindings} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {KbExpr, ICommandHandler, IKeybindings} from 'vs/platform/keybinding/common/keybindingService';
|
||||
|
||||
// --- Keybinding extensions to make it more concise to express keybindings conditions
|
||||
export enum ContextKey {
|
||||
|
@ -176,15 +176,11 @@ class EditorContributionRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
var context: IKeybindingContextRule[] = null;
|
||||
var context: KbExpr = null;
|
||||
if (desc.kbOpts.context === ContextKey.EditorTextFocus) {
|
||||
context = [{
|
||||
key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
|
||||
}];
|
||||
context = KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS);
|
||||
} else if (desc.kbOpts.context === ContextKey.EditorFocus) {
|
||||
context = [{
|
||||
key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_FOCUS
|
||||
}];
|
||||
context = KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_FOCUS);
|
||||
}
|
||||
|
||||
var commandDesc: ICommandDescriptor = {
|
||||
|
@ -236,20 +232,15 @@ function triggerEditorActionGlobal(actionId: string, accessor: ServicesAccessor,
|
|||
|
||||
var defaultEditorActionKeybindingOptions:IEditorActionKeybindingOptions = { primary: null, context: ContextKey.EditorTextFocus };
|
||||
|
||||
function contextRule(needsTextFocus: boolean, needsKey: string): IKeybindingContextRule[] {
|
||||
let result: IKeybindingContextRule[] = [];
|
||||
function contextRule(needsTextFocus: boolean, needsKey: string): KbExpr {
|
||||
|
||||
if (needsTextFocus) {
|
||||
result.push({ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS });
|
||||
} else {
|
||||
result.push({ key: EditorCommon.KEYBINDING_CONTEXT_EDITOR_FOCUS });
|
||||
}
|
||||
let base = KbExpr.has(needsTextFocus ? EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS : EditorCommon.KEYBINDING_CONTEXT_EDITOR_FOCUS);
|
||||
|
||||
if (needsKey) {
|
||||
result.push({ key: needsKey });
|
||||
return KbExpr.and(base, KbExpr.has(needsKey));
|
||||
}
|
||||
|
||||
return result;
|
||||
return base;
|
||||
}
|
||||
|
||||
function createCommandHandler(commandId: string, handler: IEditorCommandHandler): ICommandHandler {
|
||||
|
|
|
@ -349,14 +349,14 @@ KeybindingsRegistry.registerCommandDesc({
|
|||
id: 'editor.action.findReferences',
|
||||
handler: findReferencesCommand,
|
||||
weight: CommonEditorRegistry.commandWeight(50),
|
||||
context: [],
|
||||
context: null,
|
||||
primary: undefined
|
||||
});
|
||||
KeybindingsRegistry.registerCommandDesc({
|
||||
id: 'editor.action.showReferences',
|
||||
handler: showReferencesCommand,
|
||||
weight: CommonEditorRegistry.commandWeight(50),
|
||||
context: [],
|
||||
context: null,
|
||||
primary: undefined,
|
||||
description: {
|
||||
description: 'Show references at a position in a file',
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
width: 20%;
|
||||
color: #646465;
|
||||
font-family: "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", sans-serif, "Droid Sans Fallback";
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@
|
|||
|
||||
.monaco-editor .reference-zone-widget .tree .reference-file {
|
||||
position: relative;
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
color: #1E1E1E;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import nls = require('vs/nls');
|
|||
import env = require('vs/base/common/flags');
|
||||
import platform = require('vs/platform/platform');
|
||||
import ConfigurationRegistry = require('vs/platform/configuration/common/configurationRegistry');
|
||||
import modesExtensions = require('vs/editor/common/modes/modesRegistry');
|
||||
import {LanguageExtensions} from 'vs/editor/common/modes/languageExtensionPoint';
|
||||
import typescript = require('vs/languages/typescript/common/typescript');
|
||||
import extensions = require('vs/languages/javascript/common/javascript.extensions');
|
||||
import Options = require('vs/languages/typescript/common/options');
|
||||
|
@ -17,7 +17,7 @@ import Mime = require('vs/base/common/mime');
|
|||
|
||||
if (!env.enableTypeScriptServiceModeForJS) {
|
||||
|
||||
modesExtensions.registerMode({
|
||||
LanguageExtensions.registerCompatMode({
|
||||
id: 'javascript',
|
||||
extensions: ['.js', '.es6'],
|
||||
firstLine: '^#!.*\\bnode',
|
||||
|
@ -187,5 +187,12 @@ if (!env.enableTypeScriptServiceModeForJS) {
|
|||
]
|
||||
});
|
||||
} else {
|
||||
Mime.registerTextMimeByFilename('.js', 'text/typescript');
|
||||
}
|
||||
LanguageExtensions.registerLanguage({
|
||||
id: 'javascript',
|
||||
extensions: ['.js', '.es6'],
|
||||
firstLine: '^#!.*\\bnode',
|
||||
filenames: ['jakefile'],
|
||||
aliases: ['JavaScript', 'javascript', 'js'],
|
||||
mimetypes: ['text/javascript']
|
||||
});
|
||||
}
|
|
@ -13,7 +13,7 @@ import {AsyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
|
|||
// contributes the project resolver logic to TypeScript and JavaScript
|
||||
// this guy is for the workbench, but not for the standalone editor
|
||||
|
||||
if (env.enableJavaScriptRewriting) {
|
||||
if (env.enableJavaScriptRewriting && !env.enableTypeScriptServiceModeForJS) {
|
||||
modesExt.registerWorkerParticipant('javascript', 'vs/languages/typescript/common/js/globalVariableRewriter', 'GlobalVariableCollector');
|
||||
modesExt.registerWorkerParticipant('javascript', 'vs/languages/typescript/common/js/angularServiceRewriter', 'AngularServiceRewriter');
|
||||
modesExt.registerWorkerParticipant('javascript', 'vs/languages/typescript/common/js/requireRewriter');
|
||||
|
|
|
@ -11,7 +11,7 @@ import EventEmitter = require('vs/base/common/eventEmitter');
|
|||
|
||||
import Descriptors = require('vs/platform/instantiation/common/descriptors');
|
||||
import Instantiation = require('vs/platform/instantiation/common/instantiation');
|
||||
import {IKeybindingContextRule, IKeybindings} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {KbExpr, IKeybindings} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export var IActionsService = createDecorator<IActionsService>('actionsService');
|
||||
|
@ -28,11 +28,11 @@ export class SyncActionDescriptor {
|
|||
private _id: string;
|
||||
private _label: string;
|
||||
private _keybindings: IKeybindings;
|
||||
private _keybindingContext: IKeybindingContextRule[];
|
||||
private _keybindingContext: KbExpr;
|
||||
private _keybindingWeight: number;
|
||||
|
||||
constructor(ctor:Instantiation.INewConstructorSignature2<string, string, Actions.Action>,
|
||||
id:string, label:string, keybindings?:IKeybindings, keybindingContext?:IKeybindingContextRule[], keybindingWeight?:number
|
||||
id:string, label:string, keybindings?:IKeybindings, keybindingContext?:KbExpr, keybindingWeight?:number
|
||||
) {
|
||||
this._id = id;
|
||||
this._label = label;
|
||||
|
@ -58,7 +58,7 @@ export class SyncActionDescriptor {
|
|||
return this._keybindings;
|
||||
}
|
||||
|
||||
public get keybindingContext(): IKeybindingContextRule[] {
|
||||
public get keybindingContext(): KbExpr {
|
||||
return this._keybindingContext;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,7 @@ import lifecycle = require('vs/base/common/lifecycle');
|
|||
import DOM = require('vs/base/browser/dom');
|
||||
import Keyboard = require('vs/base/browser/keyboardEvent');
|
||||
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import {KeybindingsUtils} from 'vs/platform/keybinding/common/keybindingsUtils';
|
||||
import strings = require('vs/base/common/strings');
|
||||
import Platform = require('vs/base/common/platform');
|
||||
import {IKeybindingService, IKeybindingScopeLocation, ICommandHandler, IKeybindingItem, IKeybindings, IKeybindingContextRule, IUserFriendlyKeybinding, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {IKeybindingService, IKeybindingScopeLocation, ICommandHandler, IKeybindingItem, IKeybindings, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {IMessageService} from 'vs/platform/message/common/message';
|
||||
import {IResolveResult, CommonKeybindingResolver} from 'vs/platform/keybinding/common/commonKeybindingResolver';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import {KeybindingsUtils} from 'vs/platform/keybinding/common/keybindingsUtils';
|
||||
import Platform = require('vs/base/common/platform');
|
||||
import {IKeybindingService, IKeybindingScopeLocation, ICommandHandler, IKeybindingItem, IKeybindings, IKeybindingContextRule, IUserFriendlyKeybinding, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {IKeybindingService, IKeybindingScopeLocation, ICommandHandler, IKeybindingItem, IKeybindings, KbExpr, IUserFriendlyKeybinding, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {KeyMod, KeyCode, BinaryKeybindings, Keybinding} from 'vs/base/common/keyCodes';
|
||||
|
||||
export interface IResolveResult {
|
||||
|
@ -28,7 +28,7 @@ interface IChordsMap {
|
|||
}
|
||||
|
||||
interface ICommandEntry {
|
||||
context: IKeybindingContextRule[];
|
||||
context: KbExpr;
|
||||
keybinding: number;
|
||||
commandId: string;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ export class CommonKeybindingResolver {
|
|||
continue;
|
||||
}
|
||||
if (k.context) {
|
||||
k.context = k.context.map(CommonKeybindingResolver.normalizeRule);
|
||||
k.context = k.context.normalize();
|
||||
}
|
||||
|
||||
let entry:ICommandEntry = {
|
||||
|
@ -140,26 +140,28 @@ export class CommonKeybindingResolver {
|
|||
* Returns true if `b` is a more relaxed `a`.
|
||||
* Return true if (`a` === true implies `b` === true).
|
||||
*/
|
||||
public static contextIsEntirelyIncluded(inNormalizedForm: boolean, a: IKeybindingContextRule[], b: IKeybindingContextRule[]): boolean {
|
||||
if (!b || b.length === 0) {
|
||||
public static contextIsEntirelyIncluded(inNormalizedForm: boolean, a: KbExpr, b: KbExpr): boolean {
|
||||
if (!inNormalizedForm) {
|
||||
a = a ? a.normalize() : null;
|
||||
b = b ? b.normalize() : null;
|
||||
}
|
||||
if (!b) {
|
||||
return true;
|
||||
}
|
||||
if (!a || a.length === 0) {
|
||||
if (!a) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!inNormalizedForm) {
|
||||
a = a.map(CommonKeybindingResolver.normalizeRule);
|
||||
b = b.map(CommonKeybindingResolver.normalizeRule);
|
||||
let aRulesArr = a.serialize().split(' && ');
|
||||
let bRulesArr = b.serialize().split(' && ');
|
||||
|
||||
let aRules: { [rule:string]: boolean; } = Object.create(null);
|
||||
for (let i = 0, len = aRulesArr.length; i < len; i++) {
|
||||
aRules[aRulesArr[i]] = true;
|
||||
}
|
||||
|
||||
var aRules: { [rule:string]: boolean; } = Object.create(null);
|
||||
for (var i = 0, len = a.length; i < len; i++) {
|
||||
aRules[CommonKeybindingResolver._ruleToString(a[i])] = true;
|
||||
}
|
||||
|
||||
for (var i = 0, len = b.length; i < len; i++) {
|
||||
if (!aRules[CommonKeybindingResolver._ruleToString(b[i])]) {
|
||||
for (let i = 0, len = bRulesArr.length; i < len; i++) {
|
||||
if (!aRules[bRulesArr[i]]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -167,34 +169,6 @@ export class CommonKeybindingResolver {
|
|||
return true;
|
||||
}
|
||||
|
||||
private static _ruleToString(rule: IKeybindingContextRule): string {
|
||||
var r = rule.key;
|
||||
if (typeof rule.operator === 'undefined') {
|
||||
r += ';' + KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL;
|
||||
} else {
|
||||
r += ';' + rule.operator;
|
||||
}
|
||||
if (typeof rule.operand === 'undefined') {
|
||||
r += ';' + true;
|
||||
} else {
|
||||
r += ';' + rule.operand;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public static normalizeRule(rule: IKeybindingContextRule): IKeybindingContextRule {
|
||||
if (rule.operator === KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL) {
|
||||
if (typeof rule.operand === 'boolean') {
|
||||
return {
|
||||
key: rule.key,
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL,
|
||||
operand: !rule.operand
|
||||
};
|
||||
}
|
||||
}
|
||||
return rule;
|
||||
}
|
||||
|
||||
private _addToLookupMap(item: IKeybindingItem): void {
|
||||
if (!item.command) {
|
||||
return;
|
||||
|
@ -298,35 +272,11 @@ export class CommonKeybindingResolver {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static contextMatchesRules(context: any, rules: IKeybindingContextRule[]): boolean {
|
||||
if (!rules || rules.length === 0) {
|
||||
public static contextMatchesRules(context: any, rules: KbExpr): boolean {
|
||||
if (!rules) {
|
||||
return true;
|
||||
}
|
||||
for (var i = 0, len = rules.length; i < len; i++) {
|
||||
if (!CommonKeybindingResolver.contextMatchesRule(context, rules[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static contextMatchesRule(context: any, rule:IKeybindingContextRule): boolean {
|
||||
var operator = (typeof rule.operator === 'undefined' ? KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL : rule.operator);
|
||||
var operand = (typeof rule.operand === 'undefined' ? true : rule.operand);
|
||||
|
||||
switch (operator) {
|
||||
case KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL:
|
||||
if (operand === false) {
|
||||
// Evaluate `key == false` as `!key`
|
||||
return !context[rule.key];
|
||||
}
|
||||
return context[rule.key] === operand;
|
||||
case KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL:
|
||||
return context[rule.key] !== operand;
|
||||
default:
|
||||
console.warn('Unknown operator ' + operator);
|
||||
}
|
||||
return true;
|
||||
return rules.evaluate(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,16 +324,13 @@ export class IOSupport {
|
|||
|
||||
public static writeKeybindingItem(out: OutputBuilder, item: IKeybindingItem): void {
|
||||
out.write('{ "key": ' + rightPaddedString('"' + IOSupport.writeKeybinding(item.keybinding).replace(/\\/g, '\\\\') + '",', 25) + ' "command": ');
|
||||
if (item.context) {
|
||||
let serializedContext = item.context ? item.context.serialize() : '';
|
||||
if (serializedContext.length > 0) {
|
||||
out.write('"' + item.command + '",');
|
||||
out.writeLine();
|
||||
if (item.context.length > 0) {
|
||||
out.write(' "when": "');
|
||||
IOSupport.writeKeybindingContexts(out, item.context);
|
||||
out.write('" ');
|
||||
} else {
|
||||
out.write('"when": "" ');
|
||||
}
|
||||
out.write(' "when": "');
|
||||
out.write(serializedContext);
|
||||
out.write('" ');
|
||||
} else {
|
||||
out.write('"' + item.command + '" ');
|
||||
}
|
||||
|
@ -497,96 +444,7 @@ export class IOSupport {
|
|||
return KeyMod.chord(result, chord);
|
||||
}
|
||||
|
||||
private static writeKeybindingContexts(out: OutputBuilder, context: IKeybindingContextRule[]): void {
|
||||
var lastCtxIndex = context.length - 1;
|
||||
context.forEach((c, i) => {
|
||||
IOSupport.writeKeybindingContent(out, c);
|
||||
if (i !== lastCtxIndex) {
|
||||
out.write(' && ');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static readKeybindingContexts(input: string): IKeybindingContextRule[] {
|
||||
if (!input) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var result: IKeybindingContextRule[] = [];
|
||||
|
||||
var pieces = input.split('&&');
|
||||
for (var i = 0; i < pieces.length; i++) {
|
||||
result.push(IOSupport.readKeybindingContext(pieces[i]));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static writeKeybindingContent(out: OutputBuilder, context: IKeybindingContextRule): void {
|
||||
if (context.operator) {
|
||||
if (
|
||||
(context.operator === KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL && context.operand === true)
|
||||
|| (context.operator === KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL && context.operand === false)
|
||||
) {
|
||||
out.write('!' + context.key);
|
||||
return;
|
||||
}
|
||||
}
|
||||
out.write(context.key);
|
||||
if (context.operator) {
|
||||
if (context.operator === KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL) {
|
||||
out.write(' == ');
|
||||
} else {
|
||||
out.write(' != ');
|
||||
}
|
||||
|
||||
if (typeof context.operand === 'boolean') {
|
||||
out.write(context.operand);
|
||||
} else {
|
||||
out.write('\'' + context.operand + '\'');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static readKeybindingContext(input: string): IKeybindingContextRule {
|
||||
input = input.trim();
|
||||
|
||||
var pieces: string[], operator: string = null;
|
||||
if (input.indexOf('!=') >= 0) {
|
||||
pieces = input.split('!=');
|
||||
operator = KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL;
|
||||
} else if (input.indexOf('==') >= 0) {
|
||||
pieces = input.split('==');
|
||||
operator = KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL;
|
||||
} else {
|
||||
if (/^\!\s*/.test(input)) {
|
||||
return {
|
||||
key: input.substr(1).trim(),
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL,
|
||||
operand: true
|
||||
};
|
||||
}
|
||||
return {
|
||||
key: input
|
||||
};
|
||||
}
|
||||
|
||||
var operand = <any>pieces[1].trim();
|
||||
|
||||
if (operand === 'true') {
|
||||
operand = true;
|
||||
} else if (operand === 'false') {
|
||||
operand = false;
|
||||
} else {
|
||||
var m = /^'([^']*)'$/.exec(operand);
|
||||
if (m) {
|
||||
operand = m[1];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
key: pieces[0].trim(),
|
||||
operator: operator,
|
||||
operand: operand
|
||||
};
|
||||
public static readKeybindingContexts(input: string): KbExpr {
|
||||
return KbExpr.deserialize(input);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,22 +33,254 @@ export interface IKeybindings {
|
|||
};
|
||||
}
|
||||
|
||||
export interface IKeybindingContextRule {
|
||||
key: string;
|
||||
/**
|
||||
* Defaults to 'equal' (string)
|
||||
*/
|
||||
operator?: string;
|
||||
/**
|
||||
* Defaults to true (boolean)
|
||||
*/
|
||||
operand?: any;
|
||||
export interface KbExpr {
|
||||
equals(other:KbExpr): boolean;
|
||||
evaluate(context:any): boolean;
|
||||
normalize(): KbExpr;
|
||||
serialize(): string;
|
||||
}
|
||||
|
||||
export class KbDefinedExpression implements KbExpr {
|
||||
constructor(private key:string) {
|
||||
}
|
||||
|
||||
public equals(other:KbExpr): boolean {
|
||||
if (other instanceof KbDefinedExpression) {
|
||||
return (this.key === other.key);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public evaluate(context:any): boolean {
|
||||
return (!!context[this.key]);
|
||||
}
|
||||
|
||||
public normalize(): KbExpr {
|
||||
return this;
|
||||
}
|
||||
|
||||
public serialize(): string {
|
||||
return this.key;
|
||||
}
|
||||
}
|
||||
|
||||
export class KbEqualsExpression implements KbExpr {
|
||||
constructor(private key:string, private value:any) {
|
||||
}
|
||||
|
||||
public equals(other:KbExpr): boolean {
|
||||
if (other instanceof KbEqualsExpression) {
|
||||
return (this.key === other.key && this.value === other.value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public evaluate(context:any): boolean {
|
||||
return (context[this.key] == this.value);
|
||||
}
|
||||
|
||||
public normalize(): KbExpr {
|
||||
if (typeof this.value === 'boolean') {
|
||||
if (this.value) {
|
||||
return new KbDefinedExpression(this.key);
|
||||
}
|
||||
return new KbNotExpression(this.key);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public serialize(): string {
|
||||
if (typeof this.value === 'boolean') {
|
||||
return this.normalize().serialize();
|
||||
}
|
||||
|
||||
return this.key + ' == \'' + this.value + '\'';
|
||||
}
|
||||
}
|
||||
|
||||
export class KbNotEqualsExpression implements KbExpr {
|
||||
constructor(private key:string, private value:any) {
|
||||
}
|
||||
|
||||
public equals(other:KbExpr): boolean {
|
||||
if (other instanceof KbNotEqualsExpression) {
|
||||
return (this.key === other.key && this.value === other.value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public evaluate(context:any): boolean {
|
||||
return (context[this.key] != this.value);
|
||||
}
|
||||
|
||||
public normalize(): KbExpr {
|
||||
if (typeof this.value === 'boolean') {
|
||||
if (this.value) {
|
||||
return new KbNotExpression(this.key);
|
||||
}
|
||||
return new KbDefinedExpression(this.key);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public serialize(): string {
|
||||
if (typeof this.value === 'boolean') {
|
||||
return this.normalize().serialize();
|
||||
}
|
||||
|
||||
return this.key + ' != \'' + this.value + '\'';
|
||||
}
|
||||
}
|
||||
|
||||
export class KbNotExpression implements KbExpr {
|
||||
constructor(private key:string) {
|
||||
}
|
||||
|
||||
public equals(other:KbExpr): boolean {
|
||||
if (other instanceof KbNotExpression) {
|
||||
return (this.key === other.key);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public evaluate(context:any): boolean {
|
||||
return (!context[this.key]);
|
||||
}
|
||||
|
||||
public normalize(): KbExpr {
|
||||
return this;
|
||||
}
|
||||
|
||||
public serialize(): string {
|
||||
return '!' + this.key;
|
||||
}
|
||||
}
|
||||
|
||||
export class KbAndExpression implements KbExpr {
|
||||
private expr:KbExpr[];
|
||||
|
||||
constructor(expr:KbExpr[]) {
|
||||
this.expr = expr || [];
|
||||
}
|
||||
|
||||
public equals(other:KbExpr): boolean {
|
||||
return this === other;
|
||||
}
|
||||
|
||||
public evaluate(context:any): boolean {
|
||||
for (var i = 0, len = this.expr.length; i < len; i++) {
|
||||
if (!this.expr[i].evaluate(context)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public normalize(): KbExpr {
|
||||
let expr:KbExpr[] = [];
|
||||
|
||||
for (let i = 0, len = this.expr.length; i < len; i++) {
|
||||
let e = this.expr[i];
|
||||
if (!e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
e = e.normalize();
|
||||
if (!e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (e instanceof KbAndExpression) {
|
||||
expr = expr.concat(e.expr);
|
||||
continue;
|
||||
}
|
||||
|
||||
expr.push(e);
|
||||
}
|
||||
|
||||
if (expr.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (expr.length === 1) {
|
||||
return expr[0];
|
||||
}
|
||||
|
||||
return new KbAndExpression(expr);
|
||||
}
|
||||
|
||||
public serialize(): string {
|
||||
if (this.expr.length === 0) {
|
||||
return '';
|
||||
}
|
||||
if (this.expr.length === 1) {
|
||||
return this.normalize().serialize();
|
||||
}
|
||||
return this.expr.map(e => e.serialize()).join(' && ');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export var KbExpr = {
|
||||
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:KbExpr[]) => new KbAndExpression(expr),
|
||||
deserialize: (serialized:string): KbExpr => {
|
||||
if (!serialized) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let pieces = serialized.split('&&');
|
||||
let result = new KbAndExpression(pieces.map(p => KbExpr._deserializeOne(p)));
|
||||
return result.normalize();
|
||||
},
|
||||
|
||||
_deserializeOne: (serializedOne:string): KbExpr => {
|
||||
serializedOne = serializedOne.trim();
|
||||
|
||||
if (serializedOne.indexOf('!=') >= 0) {
|
||||
let pieces = serializedOne.split('!=');
|
||||
return new KbNotEqualsExpression(pieces[0].trim(), KbExpr._deserializeValue(pieces[1]));
|
||||
}
|
||||
|
||||
if (serializedOne.indexOf('==') >= 0) {
|
||||
let pieces = serializedOne.split('==');
|
||||
return new KbEqualsExpression(pieces[0].trim(), KbExpr._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;
|
||||
}
|
||||
|
||||
var m = /^'([^']*)'$/.exec(serializedValue);
|
||||
if (m) {
|
||||
return m[1].trim();
|
||||
}
|
||||
|
||||
return serializedValue;
|
||||
}
|
||||
}
|
||||
|
||||
export interface IKeybindingItem {
|
||||
keybinding: number;
|
||||
command: string;
|
||||
context: IKeybindingContextRule[];
|
||||
context: KbExpr;
|
||||
weight1: number;
|
||||
weight2: number;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import {Registry} from 'vs/platform/platform';
|
||||
import {TypeConstraint, validateConstraints} from 'vs/base/common/types';
|
||||
import {ICommandHandler, ICommandHandlerDescription, ICommandsMap, IKeybindingItem, IKeybindings, IKeybindingContextRule} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {ICommandHandler, ICommandHandlerDescription, ICommandsMap, IKeybindingItem, IKeybindings, KbExpr} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {KeybindingsUtils} from 'vs/platform/keybinding/common/keybindingsUtils';
|
||||
import {KeyMod, KeyCode, BinaryKeybindings} from 'vs/base/common/keyCodes';
|
||||
import Platform = require('vs/base/common/platform');
|
||||
|
@ -14,7 +14,7 @@ import Platform = require('vs/base/common/platform');
|
|||
export interface ICommandRule extends IKeybindings {
|
||||
id: string;
|
||||
weight: number;
|
||||
context: IKeybindingContextRule[];
|
||||
context: KbExpr;
|
||||
}
|
||||
|
||||
export interface ICommandDescriptor extends ICommandRule {
|
||||
|
@ -118,7 +118,7 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry {
|
|||
return this._commands;
|
||||
}
|
||||
|
||||
private registerDefaultKeybinding(keybinding: number, commandId:string, weight1: number, weight2:number, context:IKeybindingContextRule[]): void {
|
||||
private registerDefaultKeybinding(keybinding: number, commandId:string, weight1: number, weight2:number, context:KbExpr): void {
|
||||
if (Platform.isWindows) {
|
||||
if (BinaryKeybindings.hasCtrlCmd(keybinding) && !BinaryKeybindings.hasShift(keybinding) && BinaryKeybindings.hasAlt(keybinding) && !BinaryKeybindings.hasWinCtrl(keybinding)) {
|
||||
if (/^[A-Z0-9\[\]\|\;\'\,\.\/\`]$/.test(KeyCode.toString(BinaryKeybindings.extractKeyCode(keybinding)))) {
|
||||
|
|
|
@ -5,22 +5,18 @@
|
|||
'use strict';
|
||||
|
||||
import assert = require('assert');
|
||||
import {CommonKeybindingResolver} from 'vs/platform/keybinding/common/commonKeybindingResolver';
|
||||
import {CommonKeybindingResolver, IOSupport} from 'vs/platform/keybinding/common/commonKeybindingResolver';
|
||||
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import {KeybindingsUtils} from 'vs/platform/keybinding/common/keybindingsUtils';
|
||||
import Platform = require('vs/base/common/platform');
|
||||
import {IKeybindingContextRule, IKeybindingItem} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {KbExpr, KbAndExpression, IKeybindingItem} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {KeyMod, KeyCode, BinaryKeybindings} from 'vs/base/common/keyCodes';
|
||||
|
||||
suite('Keybinding Service', () => {
|
||||
|
||||
test('resolve key', function() {
|
||||
var keybinding = KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z;
|
||||
var contextRules = [{
|
||||
key: 'bar',
|
||||
operator: 'equal',
|
||||
operand: 'baz'
|
||||
}]
|
||||
var contextRules = KbExpr.equals('bar', 'baz');
|
||||
var keybindingItem: IKeybindingItem = {
|
||||
command: 'yes',
|
||||
context: contextRules,
|
||||
|
@ -37,49 +33,33 @@ suite('Keybinding Service', () => {
|
|||
assert.equal(resolver.resolve({ bar: 'bz' }, 0, keybinding), null);
|
||||
});
|
||||
|
||||
function createEqualContextRule(key: string, operand: any): IKeybindingContextRule {
|
||||
return {
|
||||
key: key,
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL,
|
||||
operand: operand
|
||||
};
|
||||
}
|
||||
|
||||
function createNotEqualContextRule(key: string, operand: any): IKeybindingContextRule {
|
||||
return {
|
||||
key: key,
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL,
|
||||
operand: operand
|
||||
};
|
||||
}
|
||||
|
||||
test('normalizeRule', function () {
|
||||
var key1IsTrue = createEqualContextRule('key1', true);
|
||||
var key1IsNotFalse = createNotEqualContextRule('key1', false);
|
||||
var key1IsFalse = createEqualContextRule('key1', false);
|
||||
var key1IsNotTrue = createNotEqualContextRule('key1', true);
|
||||
var key1IsTrue = KbExpr.equals('key1', true);
|
||||
var key1IsNotFalse = KbExpr.notEquals('key1', false);
|
||||
var key1IsFalse = KbExpr.equals('key1', false);
|
||||
var key1IsNotTrue = KbExpr.notEquals('key1', true);
|
||||
|
||||
assert.deepEqual(CommonKeybindingResolver.normalizeRule(key1IsTrue), key1IsTrue);
|
||||
assert.deepEqual(CommonKeybindingResolver.normalizeRule(key1IsNotFalse), key1IsTrue);
|
||||
assert.deepEqual(CommonKeybindingResolver.normalizeRule(key1IsFalse), key1IsFalse);
|
||||
assert.deepEqual(CommonKeybindingResolver.normalizeRule(key1IsNotTrue), key1IsFalse);
|
||||
assert.ok(key1IsTrue.normalize().equals(KbExpr.has('key1')));
|
||||
assert.ok(key1IsNotFalse.normalize().equals(KbExpr.has('key1')));
|
||||
assert.ok(key1IsFalse.normalize().equals(KbExpr.not('key1')));
|
||||
assert.ok(key1IsNotTrue.normalize().equals(KbExpr.not('key1')));
|
||||
});
|
||||
|
||||
test('contextIsEntirelyIncluded', function () {
|
||||
var assertIsIncluded = (a: IKeybindingContextRule[], b: IKeybindingContextRule[]) => {
|
||||
assert.equal(CommonKeybindingResolver.contextIsEntirelyIncluded(false, a, b), true);
|
||||
var assertIsIncluded = (a: KbExpr[], b: KbExpr[]) => {
|
||||
assert.equal(CommonKeybindingResolver.contextIsEntirelyIncluded(false, new KbAndExpression(a), new KbAndExpression(b)), true);
|
||||
};
|
||||
var assertIsNotIncluded = (a: IKeybindingContextRule[], b: IKeybindingContextRule[]) => {
|
||||
assert.equal(CommonKeybindingResolver.contextIsEntirelyIncluded(false, a, b), false);
|
||||
var assertIsNotIncluded = (a: KbExpr[], b: KbExpr[]) => {
|
||||
assert.equal(CommonKeybindingResolver.contextIsEntirelyIncluded(false, new KbAndExpression(a), new KbAndExpression(b)), false);
|
||||
};
|
||||
var key1IsTrue = createEqualContextRule('key1', true);
|
||||
var key1IsNotFalse = createNotEqualContextRule('key1', false);
|
||||
var key1IsFalse = createEqualContextRule('key1', false);
|
||||
var key1IsNotTrue = createNotEqualContextRule('key1', true);
|
||||
var key2IsTrue = createEqualContextRule('key2', true);
|
||||
var key2IsNotFalse = createNotEqualContextRule('key2', false);
|
||||
var key3IsTrue = createEqualContextRule('key3', true);
|
||||
var key4IsTrue = createEqualContextRule('key4', true);
|
||||
var key1IsTrue = KbExpr.equals('key1', true);
|
||||
var key1IsNotFalse = KbExpr.notEquals('key1', false);
|
||||
var key1IsFalse = KbExpr.equals('key1', false);
|
||||
var key1IsNotTrue = KbExpr.notEquals('key1', true);
|
||||
var key2IsTrue = KbExpr.equals('key2', true);
|
||||
var key2IsNotFalse = KbExpr.notEquals('key2', false);
|
||||
var key3IsTrue = KbExpr.equals('key3', true);
|
||||
var key4IsTrue = KbExpr.equals('key4', true);
|
||||
|
||||
assertIsIncluded([key1IsTrue], null);
|
||||
assertIsIncluded([key1IsTrue], []);
|
||||
|
@ -123,15 +103,10 @@ suite('Keybinding Service', () => {
|
|||
// This one will never match because its context is always overwritten by another one
|
||||
{
|
||||
keybinding: KeyCode.KEY_X,
|
||||
context: [{
|
||||
key: 'key1',
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL,
|
||||
operand: true
|
||||
}, {
|
||||
key: 'key2',
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL,
|
||||
operand: false
|
||||
}],
|
||||
context: KbExpr.and(
|
||||
KbExpr.equals('key1', true),
|
||||
KbExpr.notEquals('key2', false)
|
||||
),
|
||||
command: 'first',
|
||||
weight1: 1,
|
||||
weight2: 0
|
||||
|
@ -139,11 +114,7 @@ suite('Keybinding Service', () => {
|
|||
// This one always overwrites first
|
||||
{
|
||||
keybinding: KeyCode.KEY_X,
|
||||
context: [{
|
||||
key: 'key2',
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL,
|
||||
operand: true
|
||||
}],
|
||||
context: KbExpr.equals('key2', true),
|
||||
command: 'second',
|
||||
weight1: 2,
|
||||
weight2: 0
|
||||
|
@ -151,7 +122,7 @@ suite('Keybinding Service', () => {
|
|||
// This one is a secondary mapping for `second`
|
||||
{
|
||||
keybinding: KeyCode.KEY_Z,
|
||||
context: [],
|
||||
context: null,
|
||||
command: 'second',
|
||||
weight1: 2.5,
|
||||
weight2: 0
|
||||
|
@ -159,11 +130,7 @@ suite('Keybinding Service', () => {
|
|||
// This one sometimes overwrites first
|
||||
{
|
||||
keybinding: KeyCode.KEY_X,
|
||||
context: [{
|
||||
key: 'key3',
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL,
|
||||
operand: true
|
||||
}],
|
||||
context: KbExpr.equals('key3', true),
|
||||
command: 'third',
|
||||
weight1: 3,
|
||||
weight2: 0
|
||||
|
@ -171,11 +138,7 @@ suite('Keybinding Service', () => {
|
|||
// This one is always overwritten by another one
|
||||
{
|
||||
keybinding: KeyMod.CtrlCmd | KeyCode.KEY_Y,
|
||||
context: [{
|
||||
key: 'key4',
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_EQUAL,
|
||||
operand: true
|
||||
}],
|
||||
context: KbExpr.equals('key4', true),
|
||||
command: 'fourth',
|
||||
weight1: 4,
|
||||
weight2: 0
|
||||
|
@ -183,7 +146,7 @@ suite('Keybinding Service', () => {
|
|||
// This one overwrites with a chord the previous one
|
||||
{
|
||||
keybinding: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_Y, KeyCode.KEY_Z),
|
||||
context: [],
|
||||
context: null,
|
||||
command: 'fifth',
|
||||
weight1: 5,
|
||||
weight2: 0
|
||||
|
@ -191,49 +154,49 @@ suite('Keybinding Service', () => {
|
|||
// This one has no keybinding
|
||||
{
|
||||
keybinding: 0,
|
||||
context: [],
|
||||
context: null,
|
||||
command: 'sixth',
|
||||
weight1: 6,
|
||||
weight2: 0
|
||||
},
|
||||
{
|
||||
keybinding: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_U),
|
||||
context: [],
|
||||
context: null,
|
||||
command: 'seventh',
|
||||
weight1: 6.5,
|
||||
weight2: 0
|
||||
},
|
||||
{
|
||||
keybinding: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_K),
|
||||
context: [],
|
||||
context: null,
|
||||
command: 'seventh',
|
||||
weight1: 6.5,
|
||||
weight2: 0
|
||||
},
|
||||
{
|
||||
keybinding: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_U),
|
||||
context: [],
|
||||
context: null,
|
||||
command: 'uncomment lines',
|
||||
weight1: 7,
|
||||
weight2: 0
|
||||
},
|
||||
{
|
||||
keybinding: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_C),
|
||||
context: [],
|
||||
context: null,
|
||||
command: 'comment lines',
|
||||
weight1: 8,
|
||||
weight2: 0
|
||||
},
|
||||
{
|
||||
keybinding: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_G, KeyMod.CtrlCmd | KeyCode.KEY_C),
|
||||
context: [],
|
||||
context: null,
|
||||
command: 'unreachablechord',
|
||||
weight1: 10,
|
||||
weight2: 0
|
||||
},
|
||||
{
|
||||
keybinding: KeyMod.CtrlCmd | KeyCode.KEY_G,
|
||||
context: [],
|
||||
context: null,
|
||||
command: 'eleven',
|
||||
weight1: 11,
|
||||
weight2: 0
|
||||
|
@ -305,7 +268,38 @@ suite('Keybinding Service', () => {
|
|||
testResolve({}, KeyMod.CtrlCmd | KeyCode.KEY_G, 'eleven');
|
||||
|
||||
testKey('sixth', []);
|
||||
});
|
||||
|
||||
test('contextMatchesRules', function () {
|
||||
let context = {
|
||||
'a': true,
|
||||
'b': false,
|
||||
'c': '5'
|
||||
};
|
||||
function testExpression(expr:string, expected:boolean): void {
|
||||
let rules = IOSupport.readKeybindingContexts(expr);
|
||||
assert.equal(CommonKeybindingResolver.contextMatchesRules(context, rules), expected, expr);
|
||||
}
|
||||
function testBatch(expr:string, value:any): void {
|
||||
testExpression(expr, !!value);
|
||||
testExpression(expr + ' == true', !!value);
|
||||
testExpression(expr + ' != true', !value);
|
||||
testExpression(expr + ' == false', !value);
|
||||
testExpression(expr + ' != false', !!value);
|
||||
testExpression(expr + ' == 5', value == <any>'5');
|
||||
testExpression(expr + ' != 5', value != <any>'5');
|
||||
testExpression('!' + expr, !value);
|
||||
}
|
||||
|
||||
testExpression('', true);
|
||||
|
||||
testBatch('a', true);
|
||||
testBatch('b', false);
|
||||
testBatch('c', '5');
|
||||
testBatch('z', undefined);
|
||||
|
||||
testExpression('a && !b', true && !false);
|
||||
testExpression('a && b', true && false);
|
||||
testExpression('a && !b && c == 5', true && !false && '5' == '5');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ import {Action} from 'vs/base/common/actions';
|
|||
import {Promise} from 'vs/base/common/winjs.base';
|
||||
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
|
||||
import {IKeybindingService, IKeybindings} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {KbExpr, IKeybindingService, IKeybindings} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
|
||||
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
|
||||
|
||||
|
@ -163,5 +163,5 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(GlobalQuickOpenAction,
|
|||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousEditorAction, OpenPreviousEditorAction.ID, OpenPreviousEditorAction.LABEL, prevEditorKb));
|
||||
|
||||
// Contribute Quick Navigate in Quick Open
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenNavigateNextAction, QuickOpenNavigateNextAction.ID, QuickOpenNavigateNextAction.LABEL, navigateKeybinding(false), [{ key: 'inQuickOpen' }]));
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenNavigatePreviousAction, QuickOpenNavigatePreviousAction.ID, QuickOpenNavigatePreviousAction.LABEL, navigateKeybinding(true), [{ key: 'inQuickOpen' }], KeybindingsRegistry.WEIGHT.workbenchContrib(50)));
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenNavigateNextAction, QuickOpenNavigateNextAction.ID, QuickOpenNavigateNextAction.LABEL, navigateKeybinding(false), KbExpr.has('inQuickOpen')));
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenNavigatePreviousAction, QuickOpenNavigatePreviousAction.ID, QuickOpenNavigatePreviousAction.LABEL, navigateKeybinding(true), KbExpr.has('inQuickOpen'), KeybindingsRegistry.WEIGHT.workbenchContrib(50)));
|
|
@ -537,7 +537,7 @@ export class AdaptiveCollapsibleViewletView extends FixedCollapsibleView impleme
|
|||
) {
|
||||
super({
|
||||
expandedBodySize: initialBodySize,
|
||||
headerSize: 24,
|
||||
headerSize: 22,
|
||||
initialState: collapsed ? CollapsibleState.COLLAPSED : CollapsibleState.EXPANDED
|
||||
});
|
||||
|
||||
|
@ -656,7 +656,7 @@ export class CollapsibleViewletView extends CollapsibleView implements IViewletV
|
|||
@IContextMenuService protected contextMenuService: IContextMenuService
|
||||
) {
|
||||
super({
|
||||
minimumSize: 2 * 24,
|
||||
minimumSize: 2 * 22,
|
||||
initialState: collapsed ? CollapsibleState.COLLAPSED : CollapsibleState.EXPANDED
|
||||
});
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
'enableJavaScriptRewriting': true,
|
||||
'enableSendASmile' : !!configuration.sendASmile,
|
||||
'enableTypeScriptServiceMode': true || !process.env['VSCODE_TSWORKER'],
|
||||
'enableTypeScriptServiceModeForJS': !!process.env['CODE_TSJS']
|
||||
'enableTypeScriptServiceModeForJS': !!process.env['CODE_TSJS'] || !!process.env['VSCODE_TSJS']
|
||||
};
|
||||
|
||||
var programStart = remote.getGlobal('programStart');
|
||||
|
|
|
@ -12,6 +12,7 @@ import {IConfigurationRegistry, Extensions as ConfigurationExtensions} from 'vs/
|
|||
import {IWorkbenchActionRegistry, Extensions} from 'vs/workbench/browser/actionRegistry';
|
||||
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
|
||||
import platform = require('vs/base/common/platform');
|
||||
import {KbExpr} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {WorkbenchMessageService} from 'vs/workbench/services/message/browser/messageService';
|
||||
import {CloseEditorAction, ReloadWindowAction, ShowStartupPerformance, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleDevToolsAction, ToggleFullScreenAction, ToggleMenuBarAction, OpenRecentAction, CloseFolderAction, CloseWindowAction, NewWindowAction, CloseMessagesAction} from 'vs/workbench/electron-browser/actions';
|
||||
|
||||
|
@ -30,7 +31,7 @@ workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ZoomOu
|
|||
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ZoomResetAction, ZoomResetAction.ID, ZoomResetAction.LABEL), viewCategory);
|
||||
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowStartupPerformance, ShowStartupPerformance.ID, ShowStartupPerformance.LABEL), developerCategory);
|
||||
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ReloadWindowAction, ReloadWindowAction.ID, ReloadWindowAction.LABEL));
|
||||
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseMessagesAction, CloseMessagesAction.ID, CloseMessagesAction.LABEL, { primary: KeyCode.Escape }, [{ key: WorkbenchMessageService.GLOBAL_MESSAGES_SHOWING_CONTEXT }]));
|
||||
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseMessagesAction, CloseMessagesAction.ID, CloseMessagesAction.LABEL, { primary: KeyCode.Escape }, KbExpr.has(WorkbenchMessageService.GLOBAL_MESSAGES_SHOWING_CONTEXT)));
|
||||
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseEditorAction, CloseEditorAction.ID, CloseEditorAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_W, win: { primary: KeyMod.CtrlCmd | KeyCode.F4, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_W] } }), viewCategory);
|
||||
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleFullScreenAction, ToggleFullScreenAction.ID, ToggleFullScreenAction.LABEL, { primary: KeyCode.F11, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_F } }), viewCategory);
|
||||
if (platform.isWindows || platform.isLinux) {
|
||||
|
|
|
@ -17,7 +17,7 @@ import viewer = require('vs/workbench/parts/debug/browser/debugViewer');
|
|||
const $ = dom.emmet;
|
||||
const debugTreeOptions = {
|
||||
indentPixels: 8,
|
||||
twistiePixels: 20
|
||||
twistiePixels: 10
|
||||
};
|
||||
|
||||
export class DebugHoverWidget implements editorbrowser.IContentWidget {
|
||||
|
@ -40,7 +40,7 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
|
|||
this.treeContainer = dom.append(this.domNode, $('.debug-hover-tree'));
|
||||
this.tree = new Tree(this.treeContainer, {
|
||||
dataSource: new viewer.VariablesDataSource(this.debugService),
|
||||
renderer: this.instantiationService.createInstance(viewer.VariablesRenderer),
|
||||
renderer: this.instantiationService.createInstance(VariablesHoverRenderer),
|
||||
controller: new DebugHoverController()
|
||||
}, debugTreeOptions);
|
||||
this.valueContainer = dom.append(this.domNode, $('.debug-hover-value'));
|
||||
|
@ -179,3 +179,10 @@ class DebugHoverController extends DefaultController {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class VariablesHoverRenderer extends viewer.VariablesRenderer {
|
||||
|
||||
public getHeight(tree: ITree, element: any): number {
|
||||
return 18;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ export class CallStackRenderer implements tree.IRenderer {
|
|||
}
|
||||
|
||||
public getHeight(tree:tree.ITree, element:any): number {
|
||||
return 24;
|
||||
return 22;
|
||||
}
|
||||
|
||||
public getTemplateId(tree: tree.ITree, element: any): string {
|
||||
|
@ -380,8 +380,8 @@ export class VariablesRenderer implements tree.IRenderer {
|
|||
// noop
|
||||
}
|
||||
|
||||
public getHeight(tree:tree.ITree, element:any): number {
|
||||
return 24;
|
||||
public getHeight(tree: tree.ITree, element: any): number {
|
||||
return 22;
|
||||
}
|
||||
|
||||
public getTemplateId(tree: tree.ITree, element: any): string {
|
||||
|
@ -541,7 +541,7 @@ export class WatchExpressionsRenderer implements tree.IRenderer {
|
|||
}
|
||||
|
||||
public getHeight(tree:tree.ITree, element:any): number {
|
||||
return 24;
|
||||
return 22;
|
||||
}
|
||||
|
||||
public getTemplateId(tree: tree.ITree, element: any): string {
|
||||
|
@ -764,7 +764,7 @@ export class BreakpointsRenderer implements tree.IRenderer {
|
|||
}
|
||||
|
||||
public getHeight(tree:tree.ITree, element:any): number {
|
||||
return 24;
|
||||
return 22;
|
||||
}
|
||||
|
||||
public getTemplateId(tree: tree.ITree, element: any): string {
|
||||
|
|
|
@ -399,7 +399,7 @@ class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
|
|||
}
|
||||
|
||||
private static getExpandedBodySize(length: number): number {
|
||||
return Math.min(BreakpointsView.MAX_VISIBLE_FILES, length) * 24;
|
||||
return Math.min(BreakpointsView.MAX_VISIBLE_FILES, length) * 22;
|
||||
}
|
||||
|
||||
public shutdown(): void {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
-ms-animation-name: fadeIn;
|
||||
animation-duration: 0.15s;
|
||||
animation-name: fadeIn;
|
||||
word-wrap: break-word;
|
||||
|
||||
white-space: pre;
|
||||
|
||||
|
@ -31,9 +32,9 @@
|
|||
}
|
||||
|
||||
.monaco-editor .debug-hover-widget .debug-hover-tree {
|
||||
line-height: 24px;
|
||||
width: 350px;
|
||||
height: 300px;
|
||||
line-height: 18px;
|
||||
width: 330px;
|
||||
height: 288px;
|
||||
}
|
||||
|
||||
/* Disable tree hover highlight in debug hover tree. */
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
}
|
||||
|
||||
.debug-viewlet .monaco-tree .monaco-tree-row > .content {
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.monaco-workbench .debug-select {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
}
|
||||
|
||||
.monaco-workbench .repl .repl-tree {
|
||||
height: calc(100% - 24px);
|
||||
height: calc(100% - 22px);
|
||||
}
|
||||
|
||||
.monaco-workbench .repl .surveyor {
|
||||
|
@ -26,7 +26,7 @@
|
|||
}
|
||||
|
||||
.monaco-workbench .repl .repl-tree .monaco-tree .monaco-tree-row > .content {
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
word-wrap: break-word;
|
||||
-webkit-user-select: initial;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@
|
|||
padding: 0;
|
||||
outline: none;
|
||||
font-family: Monaco, Menlo, Consolas, "Droid Sans Mono", "Inconsolata", "Courier New", monospace, "Droid Sans Fallback";
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.monaco-workbench .repl .repl-tree .monaco-tree .monaco-tree-rows > .monaco-tree-row {
|
||||
|
@ -137,7 +137,7 @@
|
|||
.monaco-workbench .repl .repl-input-wrapper {
|
||||
border-top: 1px solid rgba(128, 128, 128, 0.35);
|
||||
box-sizing: border-box;
|
||||
height: 24px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.monaco-workbench .repl .repl-input-wrapper:before {
|
||||
|
@ -164,12 +164,12 @@
|
|||
|
||||
.monaco-workbench .repl .repl-input-wrapper.linux:before {
|
||||
content: '\276f';
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.monaco-workbench .repl .repl-input-wrapper.mac:before {
|
||||
content: '\276f';
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.monaco-workbench .repl .repl-input {
|
||||
|
|
|
@ -40,6 +40,7 @@ const HISTORY_STORAGE_KEY = 'debug.repl.history';
|
|||
export class Repl extends baseeditor.BaseEditor {
|
||||
|
||||
public static ID = 'workbench.editors.replEditor';
|
||||
private static HALF_WIDTH_TYPICAL = 'n';
|
||||
|
||||
private static HISTORY: replhistory.ReplHistory;
|
||||
private static REFRESH_DELAY = 500; // delay in ms to refresh the repl for new elements to show
|
||||
|
@ -122,7 +123,7 @@ export class Repl extends baseeditor.BaseEditor {
|
|||
});
|
||||
|
||||
this.characterWidthSurveyor = dom.append(container, $('.surveyor'));
|
||||
this.characterWidthSurveyor.textContent = 'a';
|
||||
this.characterWidthSurveyor.textContent = Repl.HALF_WIDTH_TYPICAL;
|
||||
for (let i = 0; i < 10; i++) {
|
||||
this.characterWidthSurveyor.textContent += this.characterWidthSurveyor.textContent;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
import nls = require('vs/nls');
|
||||
import { Promise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import actions = require('vs/base/common/actions');
|
||||
import strings = require('vs/base/common/strings');
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { isMacintosh, isLinux, isWindows } from 'vs/base/common/platform';
|
||||
import actionbar = require('vs/base/browser/ui/actionbar/actionbar');
|
||||
|
@ -119,10 +120,14 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
|
|||
|
||||
private getHeightForString(s: string): number {
|
||||
if (!s || !s.length || this.width <= 0 || this.characterWidth <= 0) {
|
||||
return 24;
|
||||
return 22;
|
||||
}
|
||||
let realLength = 0;
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
realLength += strings.isFullWidthCharacter(s.charCodeAt(i)) ? 2 : 1;
|
||||
}
|
||||
|
||||
return 24 * Math.ceil(s.length * this.characterWidth / this.width);
|
||||
return 22 * Math.ceil(realLength * this.characterWidth / this.width);
|
||||
}
|
||||
|
||||
public setWidth(fullWidth: number, characterWidth: number): void {
|
||||
|
|
|
@ -50,7 +50,14 @@ declare module DebugProtocol {
|
|||
//---- Events
|
||||
|
||||
/** Event message for "initialized" event type.
|
||||
The event indicates that the debugee is ready to accept SetBreakpoint calls.
|
||||
This event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest).
|
||||
A debug adapter is expected to send this event when it is ready to accept configuration requests.
|
||||
The sequence of events/requests is as follows:
|
||||
- adapters sends InitializedEvent (at any time)
|
||||
- frontend sends zero or more SetBreakpointsRequest
|
||||
- frontend sends one SetExceptionBreakpointsRequest (in the future 'zero or one')
|
||||
- frontend sends other configuration requests that are added in the future
|
||||
- frontend sends one ConfigurationDoneRequest
|
||||
*/
|
||||
export interface InitializedEvent extends Event {
|
||||
}
|
||||
|
@ -141,6 +148,20 @@ declare module DebugProtocol {
|
|||
export interface InitializeResponse extends Response {
|
||||
}
|
||||
|
||||
/** ConfigurationDone request; value of command field is "configurationDone".
|
||||
The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the InitializedEvent)
|
||||
*/
|
||||
export interface ConfigurationDoneRequest extends Request {
|
||||
arguments?: ConfigurationDoneArguments;
|
||||
}
|
||||
/** Arguments for "configurationDone" request. */
|
||||
export interface ConfigurationDoneArguments {
|
||||
/* The configurationDone request has no standardized attributes. */
|
||||
}
|
||||
/** Response to "configurationDone" request. This is just an acknowledgement, so no body field is required. */
|
||||
export interface ConfigurationDoneResponse extends Response {
|
||||
}
|
||||
|
||||
/** Launch request; value of command field is "launch".
|
||||
*/
|
||||
export interface LaunchRequest extends Request {
|
||||
|
|
|
@ -13,7 +13,7 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
|||
import platform = require('vs/platform/platform');
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { IKeybindings } from 'vs/platform/keybinding/common/keybindingService';
|
||||
import { KbExpr, IKeybindings } from 'vs/platform/keybinding/common/keybindingService';
|
||||
import { EditorBrowserRegistry } from 'vs/editor/browser/editorBrowserExtensions';
|
||||
import wbaregistry = require('vs/workbench/browser/actionRegistry');
|
||||
import actionbarregistry = require('vs/workbench/browser/actionBarRegistry');
|
||||
|
@ -88,13 +88,13 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDebugViewletAction
|
|||
|
||||
const debugCategory = nls.localize('debugCategory', "Debug");
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(
|
||||
dbgactions.StartDebugAction, dbgactions.StartDebugAction.ID, dbgactions.StartDebugAction.LABEL, { primary: KeyCode.F5 }, [{ key: debug.CONTEXT_IN_DEBUG_MODE, operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL, operand: true }]), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StepOverDebugAction, dbgactions.StepOverDebugAction.ID, dbgactions.StepOverDebugAction.LABEL, { primary: KeyCode.F10 }, [{ key: debug.CONTEXT_IN_DEBUG_MODE }]), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StepIntoDebugAction, dbgactions.StepIntoDebugAction.ID, dbgactions.StepIntoDebugAction.LABEL, { primary: KeyCode.F11 }, [{ key: debug.CONTEXT_IN_DEBUG_MODE }], KeybindingsRegistry.WEIGHT.workbenchContrib(1)), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StepOutDebugAction, dbgactions.StepOutDebugAction.ID, dbgactions.StepOutDebugAction.LABEL, { primary: KeyMod.Shift | KeyCode.F11 }, [{ key: debug.CONTEXT_IN_DEBUG_MODE }]), debugCategory);
|
||||
dbgactions.StartDebugAction, dbgactions.StartDebugAction.ID, dbgactions.StartDebugAction.LABEL, { primary: KeyCode.F5 }, KbExpr.not(debug.CONTEXT_IN_DEBUG_MODE)), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StepOverDebugAction, dbgactions.StepOverDebugAction.ID, dbgactions.StepOverDebugAction.LABEL, { primary: KeyCode.F10 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE)), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StepIntoDebugAction, dbgactions.StepIntoDebugAction.ID, dbgactions.StepIntoDebugAction.LABEL, { primary: KeyCode.F11 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE), KeybindingsRegistry.WEIGHT.workbenchContrib(1)), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StepOutDebugAction, dbgactions.StepOutDebugAction.ID, dbgactions.StepOutDebugAction.LABEL, { primary: KeyMod.Shift | KeyCode.F11 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE)), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.RestartDebugAction, dbgactions.RestartDebugAction.ID, dbgactions.RestartDebugAction.LABEL), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StopDebugAction, dbgactions.StopDebugAction.ID, dbgactions.StopDebugAction.LABEL, { primary: KeyMod.Shift | KeyCode.F5 }, [{ key: debug.CONTEXT_IN_DEBUG_MODE }]), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.ContinueAction, dbgactions.ContinueAction.ID, dbgactions.ContinueAction.LABEL, { primary: KeyCode.F5 }, [{ key: debug.CONTEXT_IN_DEBUG_MODE }]), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StopDebugAction, dbgactions.StopDebugAction.ID, dbgactions.StopDebugAction.LABEL, { primary: KeyMod.Shift | KeyCode.F5 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE)), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.ContinueAction, dbgactions.ContinueAction.ID, dbgactions.ContinueAction.LABEL, { primary: KeyCode.F5 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE)), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.PauseAction, dbgactions.PauseAction.ID, dbgactions.PauseAction.LABEL), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.ConfigureAction, dbgactions.ConfigureAction.ID, dbgactions.ConfigureAction.LABEL), debugCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.OpenReplAction, dbgactions.OpenReplAction.ID, dbgactions.OpenReplAction.LABEL), debugCategory);
|
||||
|
|
|
@ -224,6 +224,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
|
|||
this.toDispose.push(this.session.addListener2(debug.SessionEvents.INITIALIZED, (event: DebugProtocol.InitializedEvent) => {
|
||||
this.sendAllBreakpoints().done(null, errors.onUnexpectedError);
|
||||
this.sendExceptionBreakpoints().done(null, errors.onUnexpectedError);
|
||||
this.session.configurationDone().done(null, errors.onUnexpectedError);
|
||||
}));
|
||||
|
||||
this.toDispose.push(this.session.addListener2(debug.SessionEvents.STOPPED, (event: DebugProtocol.StoppedEvent) => {
|
||||
|
|
|
@ -136,6 +136,10 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
|
|||
return this.send('setExceptionBreakpoints', args);
|
||||
}
|
||||
|
||||
public configurationDone(): TPromise<DebugProtocol.ConfigurationDoneResponse> {
|
||||
return this.send('configurationDone', null);
|
||||
}
|
||||
|
||||
public stackTrace(args: DebugProtocol.StackTraceArguments): TPromise<DebugProtocol.StackTraceResponse> {
|
||||
return this.send('stackTrace', args);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import editorCommon = require('vs/editor/common/editorCommon');
|
|||
import {ExpandAbbreviationAction} from './emmetActions';
|
||||
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import {KeyCode} from 'vs/base/common/keyCodes';
|
||||
import {KbExpr} from 'vs/platform/keybinding/common/keybindingService';
|
||||
|
||||
CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(ExpandAbbreviationAction,
|
||||
ExpandAbbreviationAction.ID,
|
||||
|
@ -19,20 +20,11 @@ CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(ExpandAbbre
|
|||
KeybindingsRegistry.registerCommandRule({
|
||||
id: ExpandAbbreviationAction.ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.editorContrib(),
|
||||
context: [{
|
||||
key: editorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
|
||||
}, {
|
||||
key: editorCommon.KEYBINDING_CONTEXT_EDITOR_HAS_NON_EMPTY_SELECTION,
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL,
|
||||
operand: true
|
||||
}, {
|
||||
key: editorCommon.KEYBINDING_CONTEXT_EDITOR_HAS_MULTIPLE_SELECTIONS,
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL,
|
||||
operand: true
|
||||
}, {
|
||||
key: editorCommon.KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS,
|
||||
operator: KeybindingsRegistry.KEYBINDING_CONTEXT_OPERATOR_NOT_EQUAL,
|
||||
operand: true
|
||||
}],
|
||||
context: KbExpr.and(
|
||||
KbExpr.has(editorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS),
|
||||
KbExpr.not(editorCommon.KEYBINDING_CONTEXT_EDITOR_HAS_NON_EMPTY_SELECTION),
|
||||
KbExpr.not(editorCommon.KEYBINDING_CONTEXT_EDITOR_HAS_MULTIPLE_SELECTIONS),
|
||||
KbExpr.not(editorCommon.KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS)
|
||||
),
|
||||
primary: KeyCode.Tab
|
||||
});
|
|
@ -228,6 +228,7 @@ class Renderer implements IRenderer<IExtensionEntry> {
|
|||
data.disposables.push(this.extensionsService.onDidUninstallExtension(e => onExtensionStateChange(e, ExtensionState.Uninstalled)));
|
||||
|
||||
data.displayName.set(extension.displayName, entry.highlights.displayName);
|
||||
data.displayName.element.title = extension.name;
|
||||
data.version.textContent = extension.version;
|
||||
data.since.textContent = date ? since(new Date(date)) : '';
|
||||
data.author.textContent = publisher;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
|
||||
.explorer-viewlet .explorer-item, .explorer-viewlet .working-files-item {
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.explorer-viewlet .explorer-item-label, .explorer-viewlet .working-files-item-label {
|
||||
|
|
|
@ -22,7 +22,7 @@ export class EmptyView extends CollapsibleView {
|
|||
|
||||
constructor(@IInstantiationService private instantiationService: IInstantiationService) {
|
||||
super({
|
||||
minimumSize: 2 * 24
|
||||
minimumSize: 2 * 22
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ export class FileRenderer extends ActionsRenderer implements Tree.IRenderer {
|
|||
}
|
||||
|
||||
public getContentHeight(tree: Tree.ITree, element: any): number {
|
||||
return 24;
|
||||
return 22;
|
||||
}
|
||||
|
||||
public renderContents(tree: Tree.ITree, stat: FileStat, domElement: HTMLElement, previousCleanupFn: Tree.IElementCallback): Tree.IElementCallback {
|
||||
|
|
|
@ -78,7 +78,7 @@ export class WorkingFilesSorter implements tree.ISorter {
|
|||
|
||||
export class WorkingFilesRenderer extends ActionsRenderer {
|
||||
|
||||
public static FILE_ITEM_HEIGHT = 24;
|
||||
public static FILE_ITEM_HEIGHT = 22;
|
||||
|
||||
constructor(
|
||||
model: WorkingFilesModel,
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
/* Status view */
|
||||
|
||||
.git-viewlet > .changes-view > .status-view > .monaco-tree .monaco-tree-row .content {
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.git-viewlet > .changes-view > .status-view > .monaco-tree .monaco-tree-row .content .monaco-action-bar {
|
||||
|
|
|
@ -232,7 +232,7 @@ export class Renderer implements tree.IRenderer {
|
|||
}
|
||||
|
||||
public getHeight(tree:tree.ITree, element:any): number {
|
||||
return 24;
|
||||
return 22;
|
||||
}
|
||||
|
||||
public getTemplateId(tree: tree.ITree, element: any): string {
|
||||
|
@ -671,7 +671,7 @@ export class Controller extends treedefaults.DefaultController {
|
|||
if (event.shiftKey) {
|
||||
var focus = tree.getFocus();
|
||||
|
||||
if (!focus || focus instanceof gitmodel.StatusGroup) {
|
||||
if (!(focus instanceof gitmodel.FileStatus) || !(element instanceof gitmodel.FileStatus)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class HelpEntry extends QuickOpenEntryItem {
|
|||
}
|
||||
|
||||
public getHeight(): number {
|
||||
return 24;
|
||||
return 22;
|
||||
}
|
||||
|
||||
public getGroupLabel(): string {
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
}
|
||||
|
||||
.quick-open-widget.marker-handler .row {
|
||||
height: 24px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.quick-open-widget.marker-handler .severity {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 24px;
|
||||
height: 22px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
|
||||
.search-viewlet .filematch {
|
||||
position: relative;
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@
|
|||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
position: relative;
|
||||
line-height: 24px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.search-viewlet .linematch.changedOrRemoved {
|
||||
|
|
|
@ -22,7 +22,7 @@ import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegi
|
|||
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {AsyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
|
||||
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
||||
import {IKeybindings} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {KbExpr, IKeybindings} from 'vs/platform/keybinding/common/keybindingService';
|
||||
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
|
||||
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
|
||||
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
|
||||
|
@ -33,7 +33,7 @@ export const VIEWLET_ID = 'workbench.view.search';
|
|||
KeybindingsRegistry.registerCommandDesc({
|
||||
id: 'workbench.action.search.toggleQueryDetails',
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
|
||||
context: [{ key: 'searchViewletVisible' }],
|
||||
context: KbExpr.has('searchViewletVisible'),
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_J,
|
||||
handler: accessor => {
|
||||
let viewletService = accessor.get(IViewletService);
|
||||
|
|
|
@ -210,7 +210,7 @@ class SearchRenderer extends ActionsRenderer {
|
|||
}
|
||||
|
||||
public getContentHeight(tree: ITree, element: any): number {
|
||||
return 24;
|
||||
return 22;
|
||||
}
|
||||
|
||||
public renderContents(tree: ITree, element: FileMatchOrMatch, domElement: HTMLElement, previousCleanupFn: IElementCallback): IElementCallback {
|
||||
|
|
20
test/all.js
20
test/all.js
|
@ -178,16 +178,18 @@ function main() {
|
|||
});
|
||||
|
||||
// replace the default unexpected error handler to be useful during tests
|
||||
loader('vs/base/common/errors').setUnexpectedErrorHandler(function (err) {
|
||||
try {
|
||||
throw new Error('oops');
|
||||
} catch (e) {
|
||||
unexpectedErrors.push((err && err.message ? err.message : err) + '\n' + e.stack);
|
||||
}
|
||||
});
|
||||
loader(['vs/base/common/errors'], function(errors) {
|
||||
errors.setUnexpectedErrorHandler(function (err) {
|
||||
try {
|
||||
throw new Error('oops');
|
||||
} catch (e) {
|
||||
unexpectedErrors.push((err && err.message ? err.message : err) + '\n' + e.stack);
|
||||
}
|
||||
});
|
||||
|
||||
// fire up mocha
|
||||
run();
|
||||
// fire up mocha
|
||||
run();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue