提交 e2e8c2a3 编写于 作者: A Alex Dima

tslint

上级 202a726e
......@@ -75,7 +75,7 @@ let _disablePushState = false;
*/
export function canPushState() {
return (!_disablePushState && globals.history && globals.history.pushState);
};
}
/**
* Helpful when we detect that pushing state does not work for some reason (e.g. FF prevents pushState for security reasons in some cases)
......
......@@ -63,21 +63,21 @@ export class HighlightedLabel implements IDisposable {
continue;
}
if (pos < highlight.start) {
htmlContent.push('<span>')
htmlContent.push('<span>');
htmlContent.push(expandOcticons(escape(this.text.substring(pos, highlight.start))));
htmlContent.push('</span>')
htmlContent.push('</span>');
pos = highlight.end;
}
htmlContent.push('<span class="highlight">')
htmlContent.push('<span class="highlight">');
htmlContent.push(expandOcticons(escape(this.text.substring(highlight.start, highlight.end))));
htmlContent.push('</span>')
htmlContent.push('</span>');
pos = highlight.end;
}
if (pos < this.text.length) {
htmlContent.push('<span>')
htmlContent.push('<span>');
htmlContent.push(expandOcticons(escape(this.text.substring(pos))));
htmlContent.push('</span>')
htmlContent.push('</span>');
}
this.domNode.innerHTML = htmlContent.join('');
......
......@@ -8,7 +8,7 @@ import * as DomUtils from 'vs/base/browser/dom';
import {Gesture} from 'vs/base/browser/touch';
import {Disposable, IDisposable} from 'vs/base/common/lifecycle';
import {IScrollable} from 'vs/base/common/scrollable';
import Event, {Emitter} from 'vs/base/common/event';
import {Emitter} from 'vs/base/common/event';
export class DomNodeScrollable extends Disposable implements IScrollable {
......
......@@ -208,7 +208,7 @@ export enum Visibility {
Auto,
Hidden,
Visible
};
}
export function visibilityFromString(visibility: string): Visibility {
switch (visibility) {
......
......@@ -130,10 +130,6 @@ export class ScrollableElement extends Widget implements IScrollableElement {
};
}
private _getVerticalSliderDomNode(): HTMLElement {
return this._verticalScrollbar.slider;
}
public delegateVerticalScrollbarMouseDown(browserEvent: MouseEvent): void {
this._verticalScrollbar.delegateMouseDown(browserEvent);
}
......
......@@ -251,7 +251,7 @@ export class TimeKeeperRenderer {
}
private _render(): void {
let allEvents = this.timeKeeper.getCollectedEvents(), didSomething = false;;
let allEvents = this.timeKeeper.getCollectedEvents(), didSomething = false;
for (let i = this.lastEventIndex; i < allEvents.length; i++) {
let ev = allEvents[i];
......
......@@ -157,15 +157,25 @@ export function substituteMatches(lexer: ILexerMin, str: string, id: string, mat
var re = /\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g;
var stateMatches: string[] = null;
return str.replace(re, function(full, sub?, dollar?, hash?, n?, s?, attr?, ofs?, total?) {
if (!empty(dollar)) return '$'; // $$
if (!empty(hash)) return fixCase(lexer, id); // default $#
if (!empty(n) && n < matches.length) return fixCase(lexer, matches[n]); // $n
if (!empty(attr) && lexer && typeof (lexer[attr]) === 'string') return lexer[attr]; //@attribute
if (!empty(dollar)) {
return '$'; // $$
}
if (!empty(hash)) {
return fixCase(lexer, id); // default $#
}
if (!empty(n) && n < matches.length) {
return fixCase(lexer, matches[n]); // $n
}
if (!empty(attr) && lexer && typeof (lexer[attr]) === 'string') {
return lexer[attr]; //@attribute
}
if (stateMatches === null) { // split state on demand
stateMatches = state.split('.');
stateMatches.unshift(state);
}
if (!empty(s) && s < stateMatches.length) return fixCase(lexer, stateMatches[s]); //$Sn
if (!empty(s) && s < stateMatches.length) {
return fixCase(lexer, stateMatches[s]); //$Sn
}
return '';
});
}
......@@ -176,11 +186,16 @@ export function substituteMatches(lexer: ILexerMin, str: string, id: string, mat
export function findRules(lexer: ILexer, state: string): IRule[] {
while (state && state.length > 0) {
var rules = lexer.tokenizer[state];
if (rules) return rules;
if (rules) {
return rules;
}
var idx = state.lastIndexOf('.');
if (idx < 0) state = null; // no further parent
else state = state.substr(0, idx);
if (idx < 0) {
state = null; // no further parent
} else {
state = state.substr(0, idx);
}
}
return null;
}
......@@ -193,11 +208,16 @@ export function findRules(lexer: ILexer, state: string): IRule[] {
export function stateExists(lexer: ILexerMin, state: string): boolean {
while (state && state.length > 0) {
var exist = lexer.stateNames[state];
if (exist) return true;
if (exist) {
return true;
}
var idx = state.lastIndexOf('.');
if (idx < 0) state = null; // no further parent
else state = state.substr(0, idx);
if (idx < 0) {
state = null; // no further parent
} else {
state = state.substr(0, idx);
}
}
return false;
}
......@@ -24,49 +24,44 @@ import Objects = require('vs/base/common/objects');
*/
function isArrayOf(elemType: (x: any) => boolean, obj: any): boolean {
if (!obj) return false;
if (!(Array.isArray(obj))) return false;
if (!obj) {
return false;
}
if (!(Array.isArray(obj))) {
return false;
}
var idx: any;
for (idx in obj) {
if (obj.hasOwnProperty(idx)) {
if (!(elemType(obj[idx]))) return false;
if (!(elemType(obj[idx]))) {
return false;
}
}
}
return true;
}
function bool(prop: any, def?: boolean, onerr?: () => void ): boolean {
if (typeof (prop) === 'boolean') return prop;
if (onerr && (prop || def === undefined)) onerr(); // type is wrong, or there is no default
if (typeof (prop) === 'boolean') {
return prop;
}
if (onerr && (prop || def === undefined)) {
onerr(); // type is wrong, or there is no default
}
return (def === undefined ? null : def);
}
function string(prop: any, def?: string, onerr?: () => void ): string {
if (typeof (prop) === 'string') return prop;
if (onerr && (prop || def === undefined)) onerr(); // type is wrong, or there is no default
return (def === undefined ? null : def);
}
function regExString(prop: any, def?: string, onerr?: () => void ): string {
// for now just a string
return string(prop, def, onerr);
}
function number(prop: any, def?: number, onerr?: () => void ): number {
if (typeof (prop) === 'number') return prop;
if (onerr && (prop || def === undefined)) onerr(); // type is wrong, or there is no default
if (typeof (prop) === 'string') {
return prop;
}
if (onerr && (prop || def === undefined)) {
onerr(); // type is wrong, or there is no default
}
return (def === undefined ? null : def);
}
function stringArray(prop: any, def?: string[], onerr?: () => void ): string[] {
if (isArrayOf(function(elem) { return (typeof (elem) === 'string'); }, prop)) return prop.slice(0);
if (typeof (prop) === 'string') return [prop];
if (onerr && (prop || def === undefined)) onerr(); // type is wrong, or there is no default
return (def === undefined ? null : def);
}
// Lexer helpers
/**
......@@ -74,7 +69,9 @@ function stringArray(prop: any, def?: string[], onerr?: () => void ): string[] {
* Also replaces @\w+ or sequences with the content of the specified attribute
*/
function compileRegExp(lexer: MonarchCommonTypes.ILexerMin, str: string): RegExp {
if (typeof (str) !== 'string') return null;
if (typeof (str) !== 'string') {
return null;
}
var n = 0;
while (str.indexOf('@') >= 0 && n < 5) { // at most 5 expansions
......@@ -83,13 +80,14 @@ function compileRegExp(lexer: MonarchCommonTypes.ILexerMin, str: string): RegExp
var sub = '';
if (typeof (lexer[attr]) === 'string') {
sub = lexer[attr];
}
else if (lexer[attr] && lexer[attr] instanceof RegExp) {
} else if (lexer[attr] && lexer[attr] instanceof RegExp) {
sub = lexer[attr].source;
}
else {
if (lexer[attr] === undefined) MonarchCommonTypes.throwError(lexer, 'language definition does not contain attribute \'' + attr + '\', used at: ' + str);
else MonarchCommonTypes.throwError(lexer, 'attribute reference \'' + attr + '\' must be a string, used at: ' + str);
} else {
if (lexer[attr] === undefined) {
MonarchCommonTypes.throwError(lexer, 'language definition does not contain attribute \'' + attr + '\', used at: ' + str);
} else {
MonarchCommonTypes.throwError(lexer, 'attribute reference \'' + attr + '\' must be a string, used at: ' + str);
}
}
return (MonarchCommonTypes.empty(sub) ? '' : '(?:' + sub + ')');
});
......@@ -104,13 +102,19 @@ function compileRegExp(lexer: MonarchCommonTypes.ILexerMin, str: string): RegExp
*
*/
function selectScrutinee(id: string, matches: string[], state: string, num: number): string {
if (num < 0) return id;
if (num < matches.length) return matches[num];
if (num < 0) {
return id;
}
if (num < matches.length) {
return matches[num];
}
if (num >= 100) {
num = num - 100;
var parts = state.split('.');
parts.unshift(state);
if (num < parts.length) return parts[num];
if (num < parts.length) {
return parts[num];
}
}
return null;
}
......@@ -123,7 +127,9 @@ function createGuard(lexer: MonarchCommonTypes.ILexerMin, ruleName: string, tkey
if (matches) {
if (matches[3]) { // if digits
scrut = parseInt(matches[3]);
if (matches[2]) scrut = scrut + 100; // if [sS] present
if (matches[2]) {
scrut = scrut + 100; // if [sS] present
}
}
oppat = matches[4];
}
......@@ -236,9 +242,11 @@ function compileAction(lexer: MonarchCommonTypes.ILexerMin, ruleName: string, ac
newAction.tokenSubst = true;
}
if (typeof (action.bracket) === 'string') {
if (action.bracket === '@open') newAction.bracket = Modes.Bracket.Open;
else if (action.bracket === '@close') newAction.bracket = Modes.Bracket.Close;
else {
if (action.bracket === '@open') {
newAction.bracket = Modes.Bracket.Open;
} else if (action.bracket === '@close') {
newAction.bracket = Modes.Bracket.Close;
} else {
MonarchCommonTypes.throwError(lexer, 'a \'bracket\' attribute must be either \'@open\' or \'@close\', in rule: ' + ruleName);
}
}
......@@ -249,7 +257,9 @@ function compileAction(lexer: MonarchCommonTypes.ILexerMin, ruleName: string, ac
else {
var next: string = action.next;
if (!/^(@pop|@push|@popall)$/.test(next)) {
if (next[0] === '@') next = next.substr(1); // peel off starting @ sign
if (next[0] === '@') {
next = next.substr(1); // peel off starting @ sign
}
if (next.indexOf('$') < 0) { // no dollar substitution, we can check if the state exists
if (!MonarchCommonTypes.stateExists(lexer, MonarchCommonTypes.substituteMatches(lexer, next, '', [], ''))) {
MonarchCommonTypes.throwError(lexer, 'the next state \'' + action.next + '\' is not defined in rule: ' + ruleName);
......@@ -259,9 +269,15 @@ function compileAction(lexer: MonarchCommonTypes.ILexerMin, ruleName: string, ac
newAction.next = next;
}
}
if (typeof (action.goBack) === 'number') newAction.goBack = action.goBack;
if (typeof (action.switchTo) === 'string') newAction.switchTo = action.switchTo;
if (typeof (action.log) === 'string') newAction.log = action.log;
if (typeof (action.goBack) === 'number') {
newAction.goBack = action.goBack;
}
if (typeof (action.switchTo) === 'string') {
newAction.switchTo = action.switchTo;
}
if (typeof (action.log) === 'string') {
newAction.log = action.log;
}
if (typeof (action.nextEmbedded) === 'string') {
newAction.nextEmbedded = action.nextEmbedded;
lexer.usesEmbedded = true;
......@@ -349,7 +365,7 @@ class Rule implements MonarchCommonTypes.IRule {
sregex = (<RegExp>re).source;
}
else {
MonarchCommonTypes.throwError(lexer, 'rules must start with a match string or regular expression: ' + this.name)
MonarchCommonTypes.throwError(lexer, 'rules must start with a match string or regular expression: ' + this.name);
}
this.matchOnlyAtLineStart = (sregex.length > 0 && sregex[0] === '^');
......@@ -470,7 +486,9 @@ export function compile(json: MonarchTypes.ILanguage): MonarchCommonTypes.ILexer
if (typeof (include) !== 'string') {
MonarchCommonTypes.throwError(lexer, 'an \'include\' attribute must be a string at: ' + state);
}
if (include[0] === '@') include = include.substr(1); // peel off starting @
if (include[0] === '@') {
include = include.substr(1); // peel off starting @
}
if (!json.tokenizer[include]) {
MonarchCommonTypes.throwError(lexer, 'include target \'' + include + '\' is not defined at: ' + state);
}
......@@ -504,8 +522,12 @@ export function compile(json: MonarchTypes.ILanguage): MonarchCommonTypes.ILexer
if (!rule.regex) {
MonarchCommonTypes.throwError(lexer, 'a rule must either be an array, or an object with a \'regex\' or \'include\' field at: ' + state);
}
if (rule.name) newrule.name = string(rule.name);
if (rule.matchOnlyAtStart) newrule.matchOnlyAtLineStart = bool(rule.matchOnlyAtLineStart);
if (rule.name) {
newrule.name = string(rule.name);
}
if (rule.matchOnlyAtStart) {
newrule.matchOnlyAtLineStart = bool(rule.matchOnlyAtLineStart);
}
newrule.setRegex(lexerMin, rule.regex);
newrule.setAction(lexerMin, rule.action);
}
......@@ -525,7 +547,9 @@ export function compile(json: MonarchTypes.ILanguage): MonarchCommonTypes.ILexer
var key: string;
for (key in json.tokenizer) {
if (json.tokenizer.hasOwnProperty(key)) {
if (!lexer.start) lexer.start = key;
if (!lexer.start) {
lexer.start = key;
}
var rules = json.tokenizer[key];
lexer.tokenizer[key] = new Array();
......
......@@ -69,7 +69,9 @@ export class MonarchLexer extends AbstractState {
if (!super.equals(other)) {
return false;
}
if (!(other instanceof MonarchLexer)) return false;
if (!(other instanceof MonarchLexer)) {
return false;
}
var otherm: MonarchLexer = <MonarchLexer>other;
if ((this.stack.length !== otherm.stack.length) || (this.lexer.name !== otherm.lexer.name) ||
(this.embeddedMode !== otherm.embeddedMode)) {
......@@ -78,7 +80,9 @@ export class MonarchLexer extends AbstractState {
var idx: string;
for (idx in this.stack) {
if (this.stack.hasOwnProperty(idx)) {
if (this.stack[idx] !== otherm.stack[idx]) return false;
if (this.stack[idx] !== otherm.stack[idx]) {
return false;
}
}
}
return true;
......@@ -132,7 +136,9 @@ export class MonarchLexer extends AbstractState {
// get the rules for this state
var rules = this.lexer.tokenizer[state];
if (!rules) rules = MonarchCommonTypes.findRules(this.lexer, state); // do parent matching
if (!rules) {
rules = MonarchCommonTypes.findRules(this.lexer, state); // do parent matching
}
if (!rules) {
MonarchCommonTypes.throwError(this.lexer, 'tokenizer state is not defined: ' + state);
......@@ -228,7 +234,9 @@ export class MonarchLexer extends AbstractState {
}
if (action.switchTo && typeof action.switchTo === 'string') {
var nextState = MonarchCommonTypes.substituteMatches(this.lexer, action.switchTo, matched, matches, state); // switch state without a push...
if (nextState[0] === '@') nextState = nextState.substr(1); // peel off starting '@'
if (nextState[0] === '@') {
nextState = nextState.substr(1); // peel off starting '@'
}
if (!MonarchCommonTypes.findRules(this.lexer, nextState)) {
MonarchCommonTypes.throwError(this.lexer, 'trying to switch to a state \'' + nextState + '\' that is undefined in rule: ' + rule.name);
}
......@@ -261,11 +269,15 @@ export class MonarchLexer extends AbstractState {
}
}
else if (action.next === '@popall') {
if (this.stack.length > 1) this.stack = [this.stack[this.stack.length - 1]];
if (this.stack.length > 1) {
this.stack = [this.stack[this.stack.length - 1]];
}
}
else {
var nextState = MonarchCommonTypes.substituteMatches(this.lexer, action.next, matched, matches, state);
if (nextState[0] === '@') nextState = nextState.substr(1); // peel off starting '@'
if (nextState[0] === '@') {
nextState = nextState.substr(1); // peel off starting '@'
}
if (!MonarchCommonTypes.findRules(this.lexer, nextState)) {
MonarchCommonTypes.throwError(this.lexer, 'trying to set a next state \'' + nextState + '\' that is undefined in rule: ' + rule.name);
......@@ -357,14 +369,16 @@ export class MonarchLexer extends AbstractState {
* Searches for a bracket in the 'brackets' attribute that matches the input.
*/
function findBracket(lexer: MonarchCommonTypes.ILexer, matched: string) {
if (!matched) return null;
if (!matched) {
return null;
}
matched = MonarchCommonTypes.fixCase(lexer, matched);
var brackets = lexer.brackets;
for (var i = 0; i < brackets.length; i++) {
var bracket = brackets[i];
if (bracket.open === matched) {
return { token: bracket.token, bracketType: Modes.Bracket.Open }
return { token: bracket.token, bracketType: Modes.Bracket.Open };
}
else if (bracket.close === matched) {
return { token: bracket.token, bracketType: Modes.Bracket.Close };
......@@ -420,7 +434,9 @@ export function createTokenizationSupport(modeService:IModeService, mode:Modes.I
while (!stream.eos() && mstate.embeddedMode) {
mstate.tokenize(stream, true); // allow no consumption for @rematch
}
if (mstate.embeddedMode) return null; // don't leave yet
if (mstate.embeddedMode) {
return null; // don't leave yet
}
var end = stream.pos();
return {
......
......@@ -13,7 +13,7 @@ import EditorCommon = require('vs/editor/common/editorCommon');
import Modes = require('vs/editor/common/modes');
import {IResourceService} from 'vs/editor/common/services/resourceService';
import {IModelService} from 'vs/editor/common/services/modelService';
import {Remotable, IThreadService, ThreadAffinity, IThreadSynchronizableObject} from 'vs/platform/thread/common/thread';
import {Remotable, IThreadService, ThreadAffinity} from 'vs/platform/thread/common/thread';
import {IHTMLContentElement} from 'vs/base/common/htmlContent';
import Event, {Emitter} from 'vs/base/common/event';
import URI from 'vs/base/common/uri';
......
......@@ -23,7 +23,7 @@ export interface ILinePreflightData {
commentStr: string;
commentStrOffset: number;
commentStrLength: number;
};
}
export interface IPreflightData {
supported: boolean;
......
......@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import EditorCommon = require('vs/editor/common/editorCommon');
import Modes = require('vs/editor/common/modes');
import supports = require('vs/editor/common/modes/supports');
import htmlMode = require('vs/languages/html/common/html');
......
......@@ -190,7 +190,7 @@ export class Writer<T> {
'\r\n\r\n',
json,
'\r\n'
]
];
this.writable.write(buffer.join(''), 'utf8');
}
}
\ No newline at end of file
......@@ -5,17 +5,11 @@
'use strict';
import WinJS = require('vs/base/common/winjs.base');
import Network = require('vs/base/common/network');
import objects = require('vs/base/common/objects');
import supports = require('vs/editor/common/modes/supports');
import platform = require('vs/platform/platform');
import Arrays = require('vs/base/common/arrays');
import EditorCommon = require('vs/editor/common/editorCommon');
import Modes = require('vs/editor/common/modes');
import {AbstractMode, isDigit, createWordRegExp} from 'vs/editor/common/modes/abstractMode';
import {AbstractState} from 'vs/editor/common/modes/abstractState';
import {OneWorkerAttr} from 'vs/platform/thread/common/threadService';
import {AsyncDescriptor2, createAsyncDescriptor2} from 'vs/platform/instantiation/common/descriptors';
import {IModeService} from 'vs/editor/common/services/modeService';
import {OnEnterSupport} from 'vs/editor/common/modes/supports/onEnter';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
......@@ -54,10 +48,10 @@ var brackets = (function() {
return !!MAP[text];
},
tokenTypeFromString: (text:string): string => {
return MAP[text].tokenType
return MAP[text].tokenType;
},
bracketTypeFromString: (text:string): Modes.Bracket => {
return MAP[text].bracketType
return MAP[text].bracketType;
}
};
})();
......@@ -273,9 +267,13 @@ export class PHPNumber extends PHPState {
}
}
var tokenType = 'number';
if (base === 16) tokenType += '.hex';
else if (base === 8) tokenType += '.octal';
else if (base === 2) tokenType += '.binary';
if (base === 16) {
tokenType += '.hex';
} else if (base === 8) {
tokenType += '.octal';
} else if (base === 2) {
tokenType += '.binary';
}
return { type: tokenType + '.php', nextState: this.parent };
}
}
......
......@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import EditorCommon = require('vs/editor/common/editorCommon');
import Modes = require('vs/editor/common/modes');
import supports = require('vs/editor/common/modes/supports');
import {AbstractMode} from 'vs/editor/common/modes/abstractMode';
......
......@@ -5,9 +5,7 @@
'use strict';
import objects = require('vs/base/common/objects');
import EditorCommon = require('vs/editor/common/editorCommon');
import Modes = require('vs/editor/common/modes');
import modesExtensions = require('vs/editor/common/modes/modesRegistry');
import htmlMode = require('vs/languages/html/common/html');
import VSXML = require('vs/languages/vsxml/common/vsxml');
import {AbstractState} from 'vs/editor/common/modes/abstractState';
......@@ -53,10 +51,10 @@ var brackets = (function() {
return !!MAP[text];
},
tokenTypeFromString: (text:string): string => {
return MAP[text].tokenType
return MAP[text].tokenType;
},
bracketTypeFromString: (text:string): Modes.Bracket => {
return MAP[text].bracketType
return MAP[text].bracketType;
}
};
})();
......
......@@ -4,12 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import EditorCommon = require('vs/editor/common/editorCommon');
import Modes = require('vs/editor/common/modes');
import supports = require('vs/editor/common/modes/supports');
import htmlMode = require('vs/languages/html/common/html');
import csharpTokenization = require('vs/languages/razor/common/csharpTokenization');
import {AbstractMode, createWordRegExp} from 'vs/editor/common/modes/abstractMode';
import {createWordRegExp} from 'vs/editor/common/modes/abstractMode';
import {AsyncDescriptor2, createAsyncDescriptor2} from 'vs/platform/instantiation/common/descriptors';
import {OnEnterSupport} from 'vs/editor/common/modes/supports/onEnter';
import razorTokenTypes = require('vs/languages/razor/common/razorTokenTypes');
......
......@@ -4,8 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import htmlWorker = require('vs/languages/html/common/htmlWorker');
import EditorCommon = require('vs/editor/common/editorCommon');
import Modes = require('vs/editor/common/modes');
import htmlTags = require('vs/languages/html/common/htmlTags');
export function getRazorTagProvider() : htmlTags.IHTMLTagProvider {
......
......@@ -13,7 +13,6 @@
import objects = require('vs/base/common/objects');
import errors = require('vs/base/common/errors');
import EditorCommon = require('vs/editor/common/editorCommon');
import Modes = require('vs/editor/common/modes');
import {AbstractState} from 'vs/editor/common/modes/abstractState';
import vsxmlTokenTypes = require('vs/languages/vsxml/common/vsxmlTokenTypes');
......
......@@ -6,7 +6,7 @@
import * as defaultPlatform from 'vs/base/common/platform';
import {IKeybindingItem, KbExpr, IUserFriendlyKeybinding} from 'vs/platform/keybinding/common/keybindingService';
import {KeyMod, KeyCode, BinaryKeybindings, Keybinding, ISimplifiedPlatform} from 'vs/base/common/keyCodes';
import {BinaryKeybindings, Keybinding, ISimplifiedPlatform} from 'vs/base/common/keyCodes';
export interface IResolveResult {
enterChord: number;
......@@ -197,7 +197,7 @@ export class KeybindingResolver {
}
public lookupKeybinding(commandId: string): Keybinding[] {
let rawPossibleTriggers = this._lookupMap[commandId]
let rawPossibleTriggers = this._lookupMap[commandId];
if (!rawPossibleTriggers) {
return [];
}
......
......@@ -76,6 +76,7 @@ export class KbEqualsExpression implements KbExpr {
}
public evaluate(context:any): boolean {
// Intentional ==
return (context[this.key] == this.value);
}
......@@ -110,6 +111,7 @@ export class KbNotEqualsExpression implements KbExpr {
}
public evaluate(context:any): boolean {
// Intentional !=
return (context[this.key] != this.value);
}
......@@ -275,7 +277,7 @@ export let KbExpr = {
return serializedValue;
}
}
};
export interface IKeybindingItem {
keybinding: number;
......@@ -297,7 +299,7 @@ export interface ICommandHandlerDescription {
}
export interface ICommandsMap {
[id: string]: ICommandHandler
[id: string]: ICommandHandler;
}
export interface IKeybindingContextKey<T> {
......
......@@ -7,7 +7,7 @@
import {Registry} from 'vs/platform/platform';
import {TypeConstraint, validateConstraints} from 'vs/base/common/types';
import {ICommandHandler, ICommandHandlerDescription, ICommandsMap, IKeybindingItem, IKeybindings, KbExpr} from 'vs/platform/keybinding/common/keybindingService';
import {KeyMod, KeyCode, BinaryKeybindings} from 'vs/base/common/keyCodes';
import {KeyCode, BinaryKeybindings} from 'vs/base/common/keyCodes';
import Platform = require('vs/base/common/platform');
export interface ICommandRule extends IKeybindings {
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IKeybindingService, IKeybindingContextKey, IKeybindingItem} from 'vs/platform/keybinding/common/keybindingService';
import {IKeybindingService, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybindingService';
import {Keybinding} from 'vs/base/common/keyCodes';
import {IHTMLContentElement} from 'vs/base/common/htmlContent';
import {TPromise} from 'vs/base/common/winjs.base';
......
......@@ -5,16 +5,13 @@
'use strict';
import nls = require('vs/nls');
import {IPluginDescription, IPluginService, IMessage, IPointListener, IActivationEventListener, IPluginStatus } from 'vs/platform/plugins/common/plugins';
import {IPluginDescription, IPluginService, IMessage, IActivationEventListener, IPluginStatus } from 'vs/platform/plugins/common/plugins';
import WinJS = require('vs/base/common/winjs.base');
import {IDisposable} from 'vs/base/common/lifecycle';
import Errors = require('vs/base/common/errors');
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {PluginsRegistry} from 'vs/platform/plugins/common/pluginsRegistry';
import Severity from 'vs/base/common/severity';
var hasOwnProperty = Object.hasOwnProperty;
var global = this;
export interface IPluginContext {
subscriptions: IDisposable[];
......@@ -33,7 +30,7 @@ export abstract class ActivatedPlugin {
activationFailed: boolean;
constructor(activationFailed: boolean) {
this.activationFailed = activationFailed
this.activationFailed = activationFailed;
}
}
......
......@@ -51,7 +51,7 @@ function createRPC(serializeAndSend:(obj:any)=>void): IRPCFunc {
return r;
};
};
}
export interface IPluginsIPC extends remote.IRemoteCom {
handle(msg: string): void;
......@@ -145,5 +145,5 @@ export function create(send: (obj: string) => void): IPluginsIPC {
}
return r;
};
}
......@@ -15,7 +15,7 @@ import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {PluginHostStorage} from 'vs/platform/storage/common/remotable.storage';
import * as paths from 'vs/base/common/paths';
import {IWorkspaceContextService, IConfiguration} from 'vs/platform/workspace/common/workspace';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {disposeAll} from 'vs/base/common/lifecycle';
var hasOwnProperty = Object.hasOwnProperty;
......@@ -25,8 +25,8 @@ class PluginMemento implements IPluginMemento {
private _shared: boolean;
private _storage: PluginHostStorage;
private _init:WinJS.TPromise<PluginMemento>
private _value: { [n: string]: any;}
private _init:WinJS.TPromise<PluginMemento>;
private _value: { [n: string]: any;};
constructor(id: string, global:boolean, storage: PluginHostStorage) {
this._id = id;
......@@ -44,7 +44,7 @@ class PluginMemento implements IPluginMemento {
}
get<T>(key: string, defaultValue: T): T {
let value = this._value[key]
let value = this._value[key];
if (typeof value === 'undefined') {
value = defaultValue;
}
......@@ -320,7 +320,7 @@ export class PluginHostPluginService extends AbstractPluginService<ExtHostPlugin
// clean up subscriptions
try {
disposeAll(plugin.subscriptions)
disposeAll(plugin.subscriptions);
} catch(err) {
// TODO: Do something with err if this is not the shutdown case
}
......@@ -355,7 +355,7 @@ export class PluginHostPluginService extends AbstractPluginService<ExtHostPlugin
globalState,
workspaceState,
subscriptions: [],
get extensionPath() { return pluginDescription.extensionFolderPath },
get extensionPath() { return pluginDescription.extensionFolderPath; },
asAbsolutePath: (relativePath:string) => { return paths.normalize(paths.join(pluginDescription.extensionFolderPath, relativePath), true); }
});
});
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {createDecorator, ServiceIdentifier, IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
import {TPromise} from 'vs/base/common/winjs.base';
import Severity from 'vs/base/common/severity';
......
......@@ -7,7 +7,6 @@
import {IPluginDescription, IPointListener, IActivationEventListener, IMessage} from 'vs/platform/plugins/common/plugins';
import {Registry} from 'vs/platform/platform';
import Errors = require('vs/base/common/errors');
import env = require('vs/base/common/flags');
import * as JSONContributionRegistry from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import {IJSONSchema} from 'vs/base/common/jsonSchema';
import nls = require('vs/nls');
......@@ -289,7 +288,7 @@ class PluginsRegistryImpl implements IPluginsRegistry {
private _pluginsArr: IPluginDescription[];
private _activationMap: {[activationEvent:string]:IPluginDescription[];};
private _pointListeners: IPointListenerEntry[];
private _oneTimeActivationEventListeners: { [activationEvent:string]: IActivationEventListener[]; }
private _oneTimeActivationEventListeners: { [activationEvent:string]: IActivationEventListener[]; };
private _extensionPoints: { [extPoint: string]: ExtensionPoint<any>; };
constructor() {
......@@ -526,7 +525,7 @@ var schema : IJSONSchema = {
type: 'boolean'
}
}
}
};
schemaRegistry.registerSchema(schemaId, schema);
schemaRegistry.addSchemaFileAssociation('/package.json', schemaId);
\ No newline at end of file
......@@ -5,7 +5,7 @@
'use strict';
import nls = require('vs/nls');
import {IPluginDescription, IPointListener, IActivationEventListener, IMessage} from 'vs/platform/plugins/common/plugins';
import {IPluginDescription} from 'vs/platform/plugins/common/plugins';
import {isValidPluginDescription as baseIsValidPluginDescription} from 'vs/platform/plugins/common/pluginsRegistry';
import * as semver from 'semver';
......
......@@ -6,11 +6,10 @@
import {TPromise} from 'vs/base/common/winjs.base';
import remote = require('vs/base/common/remote');
import Types = require('vs/base/common/types');
import {IThreadServiceStatusListener, ThreadAffinity, Remotable, IRemotableCtorMap, IThreadSynchronizableObject, IDynamicProxy} from 'vs/platform/thread/common/thread';
import {ThreadAffinity, Remotable, IThreadSynchronizableObject, IDynamicProxy} from 'vs/platform/thread/common/thread';
import {THREAD_SERVICE_PROPERTY_NAME} from 'vs/platform/thread/common/threadService';
import instantiation = require('vs/platform/instantiation/common/instantiation');
import {SyncDescriptor, SyncDescriptor0, createSyncDescriptor, AsyncDescriptor0, AsyncDescriptor1, AsyncDescriptor2, AsyncDescriptor3} from 'vs/platform/instantiation/common/descriptors';
import {SyncDescriptor0, createSyncDescriptor, AsyncDescriptor0, AsyncDescriptor1, AsyncDescriptor2, AsyncDescriptor3} from 'vs/platform/instantiation/common/descriptors';
export interface IThreadServiceData {
[id:string]:any;
......@@ -37,11 +36,6 @@ class DynamicProxy<T> implements IDynamicProxy<T> {
export abstract class AbstractThreadService implements remote.IManyHandler {
private static _LAST_DYNAMIC_PROXY_ID:number = 0;
private static generateDynamicProxyId(): string {
return String(++this._LAST_DYNAMIC_PROXY_ID);
}
public isInMainThread:boolean;
protected _instantiationService: instantiation.IInstantiationService;
......
......@@ -11,7 +11,6 @@ import Env = require('vs/base/common/flags');
import Platform = require('vs/base/common/platform');
import errors = require('vs/base/common/errors');
import Timer = require('vs/base/common/timer');
import {IPluginDescription} from 'vs/platform/plugins/common/plugins';
import remote = require('vs/base/common/remote');
import {readThreadSynchronizableObjects} from 'vs/platform/thread/common/threadService';
import {SyncDescriptor0} from 'vs/platform/instantiation/common/descriptors';
......
......@@ -9,7 +9,6 @@ import remote = require('vs/base/common/remote');
import descriptors = require('vs/platform/instantiation/common/descriptors');
import abstractThreadService = require('./abstractThreadService');
import threadService = require('./threadService');
import {readThreadSynchronizableObjects} from 'vs/platform/thread/common/threadService';
import {IThreadService, IThreadSynchronizableObject, ThreadAffinity, IThreadServiceStatusListener} from 'vs/platform/thread/common/thread';
......
......@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict'
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import descriptors = require('vs/platform/instantiation/common/descriptors');
......@@ -81,7 +81,7 @@ export class Remotable {
Remotable._ensureUnique(identifier);
Remotable.Registry.MainContext[identifier] = target;
target[Remotable.PROP_NAME] = identifier;
}
};
}
public static PluginHostContext(identifier: string) {
......@@ -89,7 +89,7 @@ export class Remotable {
Remotable._ensureUnique(identifier);
Remotable.Registry.PluginHostContext[identifier] = target;
target[Remotable.PROP_NAME] = identifier;
}
};
}
public static WorkerContext(identifier: string, whichWorker:ThreadAffinity) {
......@@ -100,7 +100,7 @@ export class Remotable {
affinity: whichWorker
};
target[Remotable.PROP_NAME] = identifier;
}
};
}
private static _ensureUnique(identifier:string): void {
......
......@@ -2,10 +2,9 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict'
'use strict';
import Platform = require('vs/platform/platform');
import types = require('vs/base/common/types');
import {TPromise} from 'vs/base/common/winjs.base';
import thread = require('./thread');
......@@ -109,7 +108,7 @@ export var Extensions = {
SynchronizableObjects: 'SynchronizableObjects'
};
Platform.Registry.add(Extensions.SynchronizableObjects, new SynchronizableObjectsRegistry())
Platform.Registry.add(Extensions.SynchronizableObjects, new SynchronizableObjectsRegistry());
export function registerThreadSynchronizableObject(obj: thread.IThreadSynchronizableObject<any>): void {
var registry = <SynchronizableObjectsRegistry>Platform.Registry.as(Extensions.SynchronizableObjects);
......
......@@ -8,7 +8,6 @@ import {TPromise} from 'vs/base/common/winjs.base';
import {readThreadSynchronizableObjects} from './threadService';
import abstractThreadService = require('vs/platform/thread/common/abstractThreadService');
import remote = require('vs/base/common/remote');
import types = require('vs/base/common/types');
import {SyncDescriptor0} from 'vs/platform/instantiation/common/descriptors';
import {IThreadService, IThreadServiceStatusListener, IThreadSynchronizableObject, ThreadAffinity} from 'vs/platform/thread/common/thread';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册