Leading whitespace fixes

This commit is contained in:
Alex Dima 2015-11-19 12:56:08 +01:00
parent f4d81bc7e1
commit 8883fcd03b
84 changed files with 639 additions and 626 deletions

View file

@ -15,7 +15,6 @@ module.exports = function (opts) {
if (opts.whitespace) {
var lines = contents.split(/\r\n|\r|\n/);
var hadErrorLineNumber = 0;
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i];
if (line.length === 0) {
@ -33,15 +32,9 @@ module.exports = function (opts) {
// empty line
continue;
} else {
// console.log(file.path + '(' + hadErrorLineNumber + ',1): Mixed whitespace indentation');
hadErrorLineNumber = i + 1;
break;
console.log(file.path + '(' + (i + 1) + ',1): Mixed whitespace indentation');
}
}
if (hadErrorLineNumber) {
console.log(file.path + '(' + hadErrorLineNumber + ',1): Mixed whitespace indentation');
}
}
} else {
var lines = contents.split(/\r\n|\r|\n/);

View file

@ -188,9 +188,9 @@ export abstract class OmnisharpServer {
ret = Promise.resolve(undefined);
} else if (/^win/.test(process.platform)) {
// when killing a process in windows its child
// processes are *not* killed but become root
// processes. Therefore we use TASKKILL.EXE
// when killing a process in windows its child
// processes are *not* killed but become root
// processes. Therefore we use TASKKILL.EXE
ret = new Promise<OmnisharpServer>((resolve, reject) => {
var killer = exec(`taskkill /F /T /PID ${this._serverProcess.pid}`, function (err, stdout, stderr) {
if (err) {

View file

@ -35,7 +35,7 @@ export default function launch(cwd: string, args: string[]):Promise < { process:
} catch (err) {
reject(err);
}
});
});
}
function launchWindows(cwd: string, args: string[]): Promise<{ process: ChildProcess, command: string }> {

View file

@ -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 { workspace, TextDocument, TextDocumentChangeEvent, TextDocumentContentChangeEvent, Disposable } from 'vscode';
import * as Proto from '../protocol';

View file

@ -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 { workspace } from 'vscode';

View file

@ -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 { workspace, DefinitionProvider, TextDocument, Position, Range, CancellationToken, Location } from 'vscode';

View file

@ -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 { workspace, DocumentHighlightProvider, DocumentHighlight, DocumentHighlightKind, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -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 { workspace, DocumentSymbolProvider, SymbolInformation, SymbolKind, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -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 { workspace, DocumentRangeFormattingEditProvider, OnTypeFormattingEditProvider, FormattingOptions, TextDocument, Position, Range, CancellationToken, TextEdit } from 'vscode';

View file

@ -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 { workspace, HoverProvider, Hover, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -2,7 +2,8 @@
* 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 * as Proto from '../protocol';

View file

@ -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 { workspace, ReferenceProvider, Location, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -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 { workspace, RenameProvider, WorkspaceEdit, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -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 { workspace, SignatureHelpProvider, SignatureHelp, SignatureInformation, ParameterInformation, TextDocument, Position, CancellationToken } from 'vscode';

View file

@ -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 { workspace, Uri, WorkspaceSymbolProvider, SymbolInformation, SymbolKind, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -134,13 +134,32 @@ gulp.task('fix-eol-style', function() {
return gulp.src(LINE_FEED_FILES, { base: '.' }).pipe(style({})).pipe(gulp.dest('.'));
});
var WHITESPACE_FILES = LINE_FEED_FILES.concat([
'!**/lib/**'
'!**/lib/**',
'!**/*.d.ts',
'!extensions/typescript/server/**',
'!test/assert.js',
'!**/octicons/**',
'!**/vs/languages/sass/test/common/example.scss',
'!**/vs/languages/less/common/parser/less.grammar.txt',
'!**/vs/languages/css/common/buildscripts/css-schema.xml',
'!**/vs/languages/markdown/common/raw.marked.js',
'!**/vs/base/common/winjs.base.raw.js',
'!**/vs/base/node/terminateProcess.sh',
'!extensions/csharp-o/gulpfile.js',
'!**/vs/base/node/terminateProcess.sh',
'!**/vs/text.js',
'!**/vs/nls.js',
'!**/vs/css.js',
'!**/vs/loader.js',
'!extensions/**/snippets/**',
'!extensions/**/syntaxes/**',
'!extensions/**/themes/**',
]);
gulp.task('whitespace-style', function() {
return gulp.src(LINE_FEED_FILES).pipe(style({complain:true, whitespace:true}));
return gulp.src(WHITESPACE_FILES).pipe(style({complain:true, whitespace:true}));
});
gulp.task('fix-whitespace-style', function() {
return gulp.src(LINE_FEED_FILES, { base: '.' }).pipe(style({whitespace:true})).pipe(gulp.dest('.'));
return gulp.src(WHITESPACE_FILES, { base: '.' }).pipe(style({whitespace:true})).pipe(gulp.dest('.'));
});
gulp.task('copyrights', function() {

View file

@ -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.
*--------------------------------------------------------------------------------------------*/
.monaco-button {
-moz-box-sizing: border-box;
box-sizing: border-box;

View file

@ -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.
*--------------------------------------------------------------------------------------------*/
.context-view {
position: absolute;
z-index: 1000;
@ -15,7 +15,7 @@
margin-top: 4px;
margin-right: 4px;
max-width: 350px;
-webkit-animation: fadeIn 0.15s linear;
-o-animation: fadeIn 0.15s linear;
-moz-animation: fadeIn 0.15s linear;
@ -30,7 +30,7 @@
border-color: transparent;
border-style: solid;
}
.context-view.bottom.right .tooltip:before {
top: -12px;
right: 12px;

View file

@ -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.
*--------------------------------------------------------------------------------------------*/
.global-message-list {
font-size: 12px;
position: absolute;

View file

@ -3,21 +3,21 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-resource-viewer img {
border: 1px solid;
max-width: 100%;
max-height: 100%;
}
.monaco-resource-viewer img {
border: 1px solid;
max-width: 100%;
max-height: 100%;
}
.vs .monaco-resource-viewer img {
border-color: #F3F3F3;
}
.vs .monaco-resource-viewer img {
border-color: #F3F3F3;
}
.vs-dark .monaco-resource-viewer img {
border-color: #252526;
}
.vs-dark .monaco-resource-viewer img {
border-color: #252526;
}
.monaco-resource-viewer video {
max-width: 100%;
max-height: 100%;
}
.monaco-resource-viewer video {
max-width: 100%;
max-height: 100%;
}

View file

@ -15,26 +15,26 @@ export function toHexString(value: number, bitsize: number = 32): string {
export function leftRotate(value: number, bits: number, totalBits: number = 32): number {
// delta + bits = totalBits
var delta = totalBits - bits;
// All ones, expect `delta` zeros aligned to the right
var mask = ~((1 << delta) - 1);
// Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits)
return ((value << bits) | ((mask & value) >>> delta)) >>> 0;
}
export function multiply64(a: number, b: number): number[] {
/* A1 A0 => A
B1 B0 => B
B0 * A1 B0 * A0
B1 * A1 B1 * A0
C3 C2 C1 C0 => C
* B1 B0 => B
* B0 * A1 B0 * A0
* B1 * A1 B1 * A0
* C3 C2 C1 C0 => C
*/
var a0 = a & 0xffff, a1 = a >>> 16;
var b0 = b & 0xffff, b1 = b >>> 16;
var c0 = 0, c1 = 0, c2 = 0, c3 = 0;
var x = b0 * a0;
c0 += x & 0xffff;
c1 += x >>> 16;
@ -42,20 +42,20 @@ export function multiply64(a: number, b: number): number[] {
x = b0 * a1;
c1 += x & 0xffff;
c2 += x >>> 16;
x = b1 * a0;
c1 += x & 0xffff;
c2 += x >>> 16;
c2 += c1 >>> 16;
c1 = c1 & 0xffff;
x = b1 * a1;
c2 += x & 0xffff;
c3 += x >>> 16;
c3 += c2 >>> 16;
c2 = c2 & 0xffff;
return [(c3 << 16 | c2) >>> 0, (c1 << 16 | c0) >>> 0];
}

View file

@ -121,23 +121,23 @@ export class Emitter<T> {
* Creates an Event which is backed-up by the event emitter. This allows
* to use the existing eventing pattern and is likely using less memeory.
* Sample:
class Document {
private _eventbus = new EventEmitter();
public onDidChange = fromEventEmitter(this._eventbus, 'changed');
// getter-style
// get onDidChange(): Event<(value:string)=>any> {
// cache fromEventEmitter result and return
// }
private _doIt() {
// ...
this._eventbus.emit('changed', value)
}
}
*
* class Document {
*
* private _eventbus = new EventEmitter();
*
* public onDidChange = fromEventEmitter(this._eventbus, 'changed');
*
* // getter-style
* // get onDidChange(): Event<(value:string)=>any> {
* // cache fromEventEmitter result and return
* // }
*
* private _doIt() {
* // ...
* this._eventbus.emit('changed', value)
* }
* }
*/
export function fromEventEmitter<T>(emitter: EventEmitter, eventType: string): Event<T> {
return function (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[]): IDisposable {

View file

@ -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';
export interface IIterator<T> {

View file

@ -86,7 +86,7 @@ export function createScanner(text:string, ignoreTrivia:boolean = false):JSONSca
pos++;
} else {
pos++;
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
pos++;
}
}

View file

@ -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';
import types = require('vs/base/common/types');
@ -13,7 +13,7 @@ export function count(to: number, callback: NumberCallback): void;
export function count(from: number, to: number, callback: NumberCallback): void;
export function count(fromOrTo: number, toOrCallback?: NumberCallback | number, callback?: NumberCallback): any {
var from: number, to: number;
if (types.isNumber(toOrCallback)) {
from = fromOrTo;
to = <number> toOrCallback;
@ -22,10 +22,10 @@ export function count(fromOrTo: number, toOrCallback?: NumberCallback | number,
to = fromOrTo;
callback = <NumberCallback> toOrCallback;
}
var op = from <= to ? (i: number) => i + 1 : (i: number) => i - 1;
var cmp = from <= to ? (a: number, b: number) => a < b : (a: number, b: number) => a > b;
for (var i = from; cmp(i, to); i = op(i)) {
callback(i);
}
@ -36,12 +36,12 @@ export function countToArray(from: number, to: number): number[];
export function countToArray(fromOrTo: number, to?: number): number[] {
var result: number[] = [];
var fn = (i: number) => result.push(i);
if (types.isUndefined(to)) {
count(fromOrTo, fn);
} else {
count(fromOrTo, to, fn);
}
return result;
}

View file

@ -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 NLS = require('vs/nls');

View file

@ -23,60 +23,60 @@ export interface ISortedList<TKey, TValue> extends IIterable<KeyValue<TKey, TVal
* Number of elements in a sorted list.
* O(1)
*/
count: number;
count: number;
/**
* Gets the value associated with the specified key.
* Returns null if there is no value asociated with the key.
* O(log n)
*/
getValue(key: TKey): TValue;
getValue(key: TKey): TValue;
/**
/**
* Gets an iterator over values.
* O(1)
*/
getValues(): IIterator<TValue>;
getValues(): IIterator<TValue>;
/**
* Gets the value at the specified index.
* Returns null if index is out of bounds.
* O(1)
*/
getValueByIndex(index: number): TValue;
getValueByIndex(index: number): TValue;
/**
* Gets the key at the specified index.
* Returns null if index is out of bounds.
* O(1)
*/
getKey(index: number): TKey;
getKey(index: number): TKey;
/**
* Gets an iterator over keys.
* O(1)
*/
getKeys(): IIterator<TKey>;
getKeys(): IIterator<TKey>;
/**
* Returns the zero-based index of the specified key in a SortedList object.
* Returns -1 if the key is not found.
* O(log n)
*/
indexOfKey(key: TKey): number;
/**
* Returns the zero-based index of the specified key in a SortedList object.
* Returns -1 if the key is not found.
* O(log n)
*/
indexOfKey(key: TKey): number;
/**
* Adds the specified key and value to the sorted list.
* O(n)
*/
add(key: TKey, value: TValue): void;
add(key: TKey, value: TValue): void;
/**
* Removes a value from the sorted list.
* Returns true if the value got removed, false otherwise.
* O(n)
*/
remove(key: TKey): boolean;
remove(key: TKey): boolean;
}
export interface KeyValue<TKey, TValue> {
@ -130,7 +130,7 @@ export class SortedList<TKey, TValue> implements ISortedList<TKey, TValue> {
}
var indexOfKey = this.indexOfKey(key);
if (indexOfKey >= 0) {
return this.values[indexOfKey];
return this.values[indexOfKey];
}
return null;
@ -154,7 +154,7 @@ export class SortedList<TKey, TValue> implements ISortedList<TKey, TValue> {
var position = 0;
while (position < this.keys.length && this.comparator(key, this.keys[position]) > 0) {
position++;
position++;
}
this.keys.splice(position, 0, key);
@ -167,8 +167,8 @@ export class SortedList<TKey, TValue> implements ISortedList<TKey, TValue> {
}
var indexOfKey = this.indexOfKey(key);
if (indexOfKey >= 0) {
this.values.splice(indexOfKey, 1);
this.keys.splice(indexOfKey, 1);
this.values.splice(indexOfKey, 1);
this.keys.splice(indexOfKey, 1);
}
return indexOfKey >= 0;
@ -210,7 +210,7 @@ class SortedListIterator<TKey, TValue> implements IIterator<KeyValue<TKey, TValu
return this.index + 1 < this.keys.length;
}
public reset(): void {
public reset(): void {
this.index = -1;
}
@ -246,7 +246,7 @@ class ListIterator<TValue> implements IIterator<TValue> {
return this.index + 1 < this.values.length;
}
public reset(): void {
public reset(): void {
this.index = -1;
}

View file

@ -405,7 +405,7 @@ export function configureMode(modeId: string, options: any): void {
export function registerWorkerParticipant(modeId:string, moduleName:string, ctorName:string): void {
var modeRegistry = <IEditorModesRegistry> Registry.as(Extensions.EditorModes);
modeRegistry.registerWorkerParticipant(modeId, createAsyncDescriptor0<Modes.IWorkerParticipant>(moduleName, ctorName));
modeRegistry.registerWorkerParticipant(modeId, createAsyncDescriptor0<Modes.IWorkerParticipant>(moduleName, ctorName));
}
export function getAPI(): typeof vscode {

View file

@ -9,10 +9,10 @@
line-height: 19px;
color: #333;
/*
WORKAROUND:
Because of bug https://monacotools.visualstudio.com/DefaultCollection/Monaco/_workitems/edit/13254
we are *not* using the color white (or #ffffff, rgba(255,255,255)) but something very close to white.
*/
* WORKAROUND:
* Because of bug https://monacotools.visualstudio.com/DefaultCollection/Monaco/_workitems/edit/13254
* we are *not* using the color white (or #ffffff, rgba(255,255,255)) but something very close to white.
*/
background: #fffffe;
}

View file

@ -99,7 +99,7 @@
}
/* Dark theme */
.monaco-editor.vs-dark .quickfix-widget {
.monaco-editor.vs-dark .quickfix-widget {
background-color: #2D2D30;
border: 1px solid rgb(69, 69, 69);
}
@ -110,7 +110,7 @@
/* High Contrast Theming */
.monaco-editor.hc-black .quickfix-widget {
.monaco-editor.hc-black .quickfix-widget {
background-color: #0C141F;
border: 2px solid #6FC3DF;
}

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
/* Suggest */
.monaco-editor .suggest-widget {
.monaco-editor .suggest-widget {
background-color: #F3F3F3;
font-size: 12px;
border: 1px solid rgb(200, 200, 200);
@ -145,7 +145,7 @@
}
/* Dark theme */
.monaco-editor.vs-dark .suggest-widget {
.monaco-editor.vs-dark .suggest-widget {
background-color: #2D2D30;
border: 1px solid rgb(69, 69, 69);
}
@ -190,7 +190,7 @@
/* High Contrast Theming */
.monaco-editor.hc-black .suggest-widget {
.monaco-editor.hc-black .suggest-widget {
background-color: #0C141F;
border: 2px solid #6FC3DF;
}

View file

@ -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.
*--------------------------------------------------------------------------------------------*/
.monaco-editor .peekview-widget .head {
background-color: #fff;
border-top: 1px solid #007ACC;

View file

@ -8,9 +8,9 @@
import {ILanguage} from './types';
export var language = <ILanguage> {
displayName: 'Jade',
name: 'jade',
defaultToken: '',
displayName: 'Jade',
name: 'jade',
defaultToken: '',
ignoreCase: true,
@ -76,7 +76,7 @@ export var language = <ILanguage> {
{ include: '@whitespace' },
// keywords
[/[a-zA-Z_$][\w$]*/, { cases: { '@keywords': {token:'keyword.$0'},
[/[a-zA-Z_$][\w$]*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': '' } }],
// delimiters and operators

View file

@ -44,7 +44,7 @@ export var language = <ILanguage> {
'@selector',
'@synthesize',
'__declspec',
'__declspec',
'assign',
'auto',
@ -138,7 +138,7 @@ export var language = <ILanguage> {
[/[{}\[\]()<>]/, '@brackets'],
[/[a-zA-Z@#]\w*/, { cases: { '@keywords': 'keyword',
'@default': 'identifier' } }],
'@default': 'identifier' } }],
[/[<>=\\+\\-\\*\\/\\^\\|\\~,]|and\\b|or\\b|not\\b]/, 'operator'],
],
@ -158,11 +158,11 @@ export var language = <ILanguage> {
],
numbers: [
[/0[xX][0-9a-fA-F]*(_?[0-9a-fA-F])*/, 'number.hex'],
[/0[xX][0-9a-fA-F]*(_?[0-9a-fA-F])*/, 'number.hex'],
[/@decimal((\.@decpart)?([eE][\-+]?@decpart)?)[fF]*/, {
cases: { '(\\d)*': 'number',
'$0':'number.float' }} ]
],
],
// Recognize strings, including those broken across lines with \ (but not without)
strings: [

View file

@ -56,7 +56,7 @@ export var language = <ILanguage> {
root: [
// commands and keywords
[/[a-zA-Z_][\w-]*/, { cases: { '@keywords': {token:'keyword.$0'},
[/[a-zA-Z_][\w-]*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': '' } }],
// whitespace
@ -100,7 +100,7 @@ export var language = <ILanguage> {
[/\$[\w]+/, { cases: { '$S2=="': 'variable', '@default': 'string' }}],
[/["']/, { cases: { '$#==$S2' : { token: 'string', next: '@pop' },
'@default': { cases: { '@eos': {token:'string', next:'@popall'}, '@default': 'string' }} }} ],
'@default': { cases: { '@eos': {token:'string', next:'@popall'}, '@default': 'string' }} }} ],
],
herestring: [
@ -111,7 +111,7 @@ export var language = <ILanguage> {
[/\$[\w]+/, { cases: { '$S2=="': 'variable', '@default': 'string' } }],
],
comment: [
comment: [
[/[^#\.]+/, 'comment' ],
[/#>/, 'comment', '@pop'],
[/(\.)(@helpKeywords)(?!\w)/, { token: 'comment.keyword.$2' } ],

View file

@ -169,7 +169,7 @@ export var language = <ILanguage> {
[/@[a-zA-Z]\w*/, 'tag'],
[/[a-zA-Z]\w*/, { cases: { '@keywords': 'keyword',
'@default': 'identifier' } }]
'@default': 'identifier' } }]
],
// Deal with white space, including single and multi-line comments

View file

@ -8,376 +8,376 @@
import {ILanguage} from './types';
/*
Ruby language definition
Quite a complex language due to elaborate escape sequences
and quoting of literate strings/regular expressions, and
an 'end' keyword that does not always apply to modifiers like until and while,
and a 'do' keyword that sometimes starts a block, but sometimes is part of
another statement (like 'while').
(1) end blocks:
'end' may end declarations like if or until, but sometimes 'if' or 'until'
are modifiers where there is no 'end'. Also, 'do' sometimes starts a block
that is ended by 'end', but sometimes it is part of a 'while', 'for', or 'until'
To do proper brace matching we do some elaborate state manipulation.
some examples:
until bla do
work until tired
list.each do
something if test
end
end
or
if test
something (if test then x end)
bar if bla
end
or, how about using class as a property..
class Test
def endpoint
self.class.endpoint || routes
end
end
(2) quoting:
there are many kinds of strings and escape sequences. But also, one can
start many string-like things as '%qx' where q specifies the kind of string
(like a command, escape expanded, regular expression, symbol etc.), and x is
some character and only another 'x' ends the sequence. Except for brackets
where the closing bracket ends the sequence.. and except for a nested bracket
inside the string like entity. Also, such strings can contain interpolated
ruby expressions again (and span multiple lines). Moreover, expanded
regular expression can also contain comments.
*/
* Ruby language definition
*
* Quite a complex language due to elaborate escape sequences
* and quoting of literate strings/regular expressions, and
* an 'end' keyword that does not always apply to modifiers like until and while,
* and a 'do' keyword that sometimes starts a block, but sometimes is part of
* another statement (like 'while').
*
* (1) end blocks:
* 'end' may end declarations like if or until, but sometimes 'if' or 'until'
* are modifiers where there is no 'end'. Also, 'do' sometimes starts a block
* that is ended by 'end', but sometimes it is part of a 'while', 'for', or 'until'
* To do proper brace matching we do some elaborate state manipulation.
* some examples:
*
* until bla do
* work until tired
* list.each do
* something if test
* end
* end
*
* or
*
* if test
* something (if test then x end)
* bar if bla
* end
*
* or, how about using class as a property..
*
* class Test
* def endpoint
* self.class.endpoint || routes
* end
* end
*
* (2) quoting:
* there are many kinds of strings and escape sequences. But also, one can
* start many string-like things as '%qx' where q specifies the kind of string
* (like a command, escape expanded, regular expression, symbol etc.), and x is
* some character and only another 'x' ends the sequence. Except for brackets
* where the closing bracket ends the sequence.. and except for a nested bracket
* inside the string like entity. Also, such strings can contain interpolated
* ruby expressions again (and span multiple lines). Moreover, expanded
* regular expression can also contain comments.
*/
export var language = <ILanguage> {
displayName: '',
name: 'ruby',
displayName: '',
name: 'ruby',
lineComment: '#',
blockCommentStart: '=begin',
blockCommentEnd: '=end',
lineComment: '#',
blockCommentStart: '=begin',
blockCommentEnd: '=end',
keywords: [
'__LINE__', '__ENCODING__', '__FILE__', 'BEGIN', 'END', 'alias', 'and', 'begin',
'break', 'case', 'class', 'def', 'defined?', 'do', 'else', 'elsif', 'end',
'ensure', 'for', 'false', 'if', 'in', 'module', 'next', 'nil', 'not', 'or', 'redo',
'rescue', 'retry', 'return', 'self', 'super', 'then', 'true', 'undef', 'unless',
'until', 'when', 'while', 'yield',
],
keywords: [
'__LINE__', '__ENCODING__', '__FILE__', 'BEGIN', 'END', 'alias', 'and', 'begin',
'break', 'case', 'class', 'def', 'defined?', 'do', 'else', 'elsif', 'end',
'ensure', 'for', 'false', 'if', 'in', 'module', 'next', 'nil', 'not', 'or', 'redo',
'rescue', 'retry', 'return', 'self', 'super', 'then', 'true', 'undef', 'unless',
'until', 'when', 'while', 'yield',
],
keywordops: [
'::', '..', '...', '?', ':', '=>'
],
keywordops: [
'::', '..', '...', '?', ':', '=>'
],
builtins: [
'require', 'public', 'private', 'include', 'extend', 'attr_reader',
'protected', 'private_class_method', 'protected_class_method', 'new'
],
builtins: [
'require', 'public', 'private', 'include', 'extend', 'attr_reader',
'protected', 'private_class_method', 'protected_class_method', 'new'
],
// these are closed by 'end' (if, while and until are handled separately)
declarations: [
'module','class','def','case','do','begin','for','if','while','until','unless'
],
// these are closed by 'end' (if, while and until are handled separately)
declarations: [
'module','class','def','case','do','begin','for','if','while','until','unless'
],
linedecls: [
'def','case','do','begin','for','if','while','until','unless'
],
linedecls: [
'def','case','do','begin','for','if','while','until','unless'
],
operators: [
'^', '&', '|', '<=>', '==', '===', '!~', '=~', '>', '>=', '<', '<=', '<<', '>>', '+',
'-', '*', '/', '%', '**', '~', '+@', '-@', '[]', '[]=', '`',
'+=', '-=', '*=', '**=', '/=', '^=', '%=', '<<=', '>>=', '&=', '&&=', '||=', '|='
],
operators: [
'^', '&', '|', '<=>', '==', '===', '!~', '=~', '>', '>=', '<', '<=', '<<', '>>', '+',
'-', '*', '/', '%', '**', '~', '+@', '-@', '[]', '[]=', '`',
'+=', '-=', '*=', '**=', '/=', '^=', '%=', '<<=', '>>=', '&=', '&&=', '||=', '|='
],
brackets: [
{ open: '(', close: ')', token: 'delimiter.parenthesis'},
{ open: '{', close: '}', token: 'delimiter.curly'},
{ open: '[', close: ']', token: 'delimiter.square'}
],
brackets: [
{ open: '(', close: ')', token: 'delimiter.parenthesis'},
{ open: '{', close: '}', token: 'delimiter.curly'},
{ open: '[', close: ']', token: 'delimiter.square'}
],
// trigger outdenting on 'end'
outdentTriggers: 'd',
// trigger outdenting on 'end'
outdentTriggers: 'd',
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\/\^%\.]+/,
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\/\^%\.]+/,
// escape sequences
escape: /(?:[abefnrstv\\"'\n\r]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4})/,
escapes: /\\(?:C\-(@escape|.)|c(@escape|.)|@escape)/,
// escape sequences
escape: /(?:[abefnrstv\\"'\n\r]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4})/,
escapes: /\\(?:C\-(@escape|.)|c(@escape|.)|@escape)/,
decpart: /\d(_?\d)*/,
decimal: /0|@decpart/,
decpart: /\d(_?\d)*/,
decimal: /0|@decpart/,
delim: /[^a-zA-Z0-9\s\n\r]/,
heredelim: /(?:\w+|'[^']*'|"[^"]*"|`[^`]*`)/,
delim: /[^a-zA-Z0-9\s\n\r]/,
heredelim: /(?:\w+|'[^']*'|"[^"]*"|`[^`]*`)/,
regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
regexpesc: /\\(?:[AzZbBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})?/,
regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
regexpesc: /\\(?:[AzZbBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})?/,
// The main tokenizer for our languages
tokenizer: {
// Main entry.
// root.<decl> where decl is the current opening declaration (like 'class')
root: [
// identifiers and keywords
// most complexity here is due to matching 'end' correctly with declarations.
// We distinguish a declaration that comes first on a line, versus declarations further on a line (which are most likey modifiers)
[/^(\s*)([a-z_]\w*[!?=]?)/, ['white',
{ cases: { 'for|until|while': { token: 'keyword.$2', bracket: '@open', next: '@dodecl.$2' },
'@declarations': { token: 'keyword.$2', bracket: '@open', next: '@root.$2' },
'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' },
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }]],
[/[a-z_]\w*[!?=]?/,
{ cases: { 'if|unless|while|until': { token: 'keyword.$0x', bracket: '@open', next: '@modifier.$0x' },
'for': { token: 'keyword.$2', bracket: '@open', next: '@dodecl.$2' },
'@linedecls': { token: 'keyword.$0', bracket: '@open', next: '@root.$0' },
'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' },
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }],
// The main tokenizer for our languages
tokenizer: {
// Main entry.
// root.<decl> where decl is the current opening declaration (like 'class')
root: [
// identifiers and keywords
// most complexity here is due to matching 'end' correctly with declarations.
// We distinguish a declaration that comes first on a line, versus declarations further on a line (which are most likey modifiers)
[/^(\s*)([a-z_]\w*[!?=]?)/, ['white',
{ cases: { 'for|until|while': { token: 'keyword.$2', bracket: '@open', next: '@dodecl.$2' },
'@declarations': { token: 'keyword.$2', bracket: '@open', next: '@root.$2' },
'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' },
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }]],
[/[a-z_]\w*[!?=]?/,
{ cases: { 'if|unless|while|until': { token: 'keyword.$0x', bracket: '@open', next: '@modifier.$0x' },
'for': { token: 'keyword.$2', bracket: '@open', next: '@dodecl.$2' },
'@linedecls': { token: 'keyword.$0', bracket: '@open', next: '@root.$0' },
'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' },
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }],
[/[A-Z][\w]*[!?=]?/, 'constructor.identifier' ], // constant
[/\$[\w]*/, 'global.constant' ], // global
[/@[\w]*/, 'namespace.instance.identifier' ], // instance
[/@@[\w]*/, 'namespace.class.identifier' ], // class
[/[A-Z][\w]*[!?=]?/, 'constructor.identifier' ], // constant
[/\$[\w]*/, 'global.constant' ], // global
[/@[\w]*/, 'namespace.instance.identifier' ], // instance
[/@@[\w]*/, 'namespace.class.identifier' ], // class
// here document
[/<<-(@heredelim).*/, { token: 'string.heredoc.delimiter', bracket: '@open', next: '@heredoc.$1' } ],
[/[ \t\r\n]+<<(@heredelim).*/, { token: 'string.heredoc.delimiter', bracket: '@open', next: '@heredoc.$1' } ],
[/^<<(@heredelim).*/, { token: 'string.heredoc.delimiter', bracket: '@open', next: '@heredoc.$1' } ],
// here document
[/<<-(@heredelim).*/, { token: 'string.heredoc.delimiter', bracket: '@open', next: '@heredoc.$1' } ],
[/[ \t\r\n]+<<(@heredelim).*/, { token: 'string.heredoc.delimiter', bracket: '@open', next: '@heredoc.$1' } ],
[/^<<(@heredelim).*/, { token: 'string.heredoc.delimiter', bracket: '@open', next: '@heredoc.$1' } ],
// whitespace
{ include: '@whitespace' },
// whitespace
{ include: '@whitespace' },
// strings
[/"/, { token: 'string.d.delim', bracket: '@open', next: '@dstring.d."'} ],
[/'/, { token: 'string.sq.delim', bracket: '@open', next: '@sstring.sq' } ],
// strings
[/"/, { token: 'string.d.delim', bracket: '@open', next: '@dstring.d."'} ],
[/'/, { token: 'string.sq.delim', bracket: '@open', next: '@sstring.sq' } ],
// % literals. For efficiency, rematch in the 'pstring' state
[/%([rsqxwW]|Q?)/, { token: '@rematch', next: 'pstring' } ],
// % literals. For efficiency, rematch in the 'pstring' state
[/%([rsqxwW]|Q?)/, { token: '@rematch', next: 'pstring' } ],
// commands and symbols
[/`/, { token: 'string.x.delim', bracket: '@open', next: '@dstring.x.`' } ],
[/:(\w|[$@])\w*[!?=]?/, 'string.s'],
[/:"/, { token: 'string.s.delim', bracket: '@open', next: '@dstring.s."' } ],
[/:'/, { token: 'string.s.delim', bracket: '@open', next: '@sstring.s' } ],
// commands and symbols
[/`/, { token: 'string.x.delim', bracket: '@open', next: '@dstring.x.`' } ],
[/:(\w|[$@])\w*[!?=]?/, 'string.s'],
[/:"/, { token: 'string.s.delim', bracket: '@open', next: '@dstring.s."' } ],
[/:'/, { token: 'string.s.delim', bracket: '@open', next: '@sstring.s' } ],
// regular expressions. Lookahead for a (not escaped) closing forwardslash on the same line
[/\/(?=(\\\/|[^\/\n])+\/)/, { token: 'regexp.delim', bracket: '@open', next: '@regexp' } ],
// regular expressions. Lookahead for a (not escaped) closing forwardslash on the same line
[/\/(?=(\\\/|[^\/\n])+\/)/, { token: 'regexp.delim', bracket: '@open', next: '@regexp' } ],
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/@symbols/, { cases: { '@keywordops': 'keyword',
'@operators' : 'operator',
'@default' : '' } } ],
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/@symbols/, { cases: { '@keywordops': 'keyword',
'@operators' : 'operator',
'@default' : '' } } ],
[/[;,]/, 'delimiter'],
[/[;,]/, 'delimiter'],
// numbers
[/0[xX][0-9a-fA-F](_?[0-9a-fA-F])*/, 'number.hex'],
[/0[_oO][0-7](_?[0-7])*/, 'number.octal'],
[/0[bB][01](_?[01])*/, 'number.binary'],
[/0[dD]@decpart/, 'number'],
[/@decimal((\.@decpart)?([eE][\-+]?@decpart)?)/, { cases: { '$1': 'number.float',
'@default': 'number' }}],
// numbers
[/0[xX][0-9a-fA-F](_?[0-9a-fA-F])*/, 'number.hex'],
[/0[_oO][0-7](_?[0-7])*/, 'number.octal'],
[/0[bB][01](_?[01])*/, 'number.binary'],
[/0[dD]@decpart/, 'number'],
[/@decimal((\.@decpart)?([eE][\-+]?@decpart)?)/, { cases: { '$1': 'number.float',
'@default': 'number' }}],
],
],
// used to not treat a 'do' as a block opener if it occurs on the same
// line as a 'do' statement: 'while|until|for'
// dodecl.<decl> where decl is the declarations started, like 'while'
dodecl: [
[/^/, { token: '', switchTo: '@root.$S2' }], // get out of do-skipping mode on a new line
[/[a-z_]\w*[!?=]?/, { cases: { 'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' }, // end on same line
'do' : { token: 'keyword', switchTo: '@root.$S2' }, // do on same line: not an open bracket here
'@linedecls': { token: '@rematch', switchTo: '@root.$S2' }, // other declaration on same line: rematch
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }],
{ include: '@root' }
],
// used to not treat a 'do' as a block opener if it occurs on the same
// line as a 'do' statement: 'while|until|for'
// dodecl.<decl> where decl is the declarations started, like 'while'
dodecl: [
[/^/, { token: '', switchTo: '@root.$S2' }], // get out of do-skipping mode on a new line
[/[a-z_]\w*[!?=]?/, { cases: { 'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' }, // end on same line
'do' : { token: 'keyword', switchTo: '@root.$S2' }, // do on same line: not an open bracket here
'@linedecls': { token: '@rematch', switchTo: '@root.$S2' }, // other declaration on same line: rematch
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }],
{ include: '@root' }
],
// used to prevent potential modifiers ('if|until|while|unless') to match
// with 'end' keywords.
// modifier.<decl>x where decl is the declaration starter, like 'if'
modifier: [
[/^/, '', '@pop'], // it was a modifier: get out of modifier mode on a new line
[/[a-z_]\w*[!?=]?/, { cases: { 'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' }, // end on same line
'then|else|elsif|do': { token: 'keyword', switchTo: '@root.$S2' }, // real declaration and not a modifier
'@linedecls': { token: '@rematch', switchTo: '@root.$S2' }, // other declaration => not a modifier
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }],
{ include: '@root' }
],
// used to prevent potential modifiers ('if|until|while|unless') to match
// with 'end' keywords.
// modifier.<decl>x where decl is the declaration starter, like 'if'
modifier: [
[/^/, '', '@pop'], // it was a modifier: get out of modifier mode on a new line
[/[a-z_]\w*[!?=]?/, { cases: { 'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' }, // end on same line
'then|else|elsif|do': { token: 'keyword', switchTo: '@root.$S2' }, // real declaration and not a modifier
'@linedecls': { token: '@rematch', switchTo: '@root.$S2' }, // other declaration => not a modifier
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }],
{ include: '@root' }
],
// single quote strings (also used for symbols)
// sstring.<kind> where kind is 'sq' (single quote) or 's' (symbol)
sstring: [
[/[^\\']+/, 'string.$S2' ],
[/\\\\|\\'|\\$/, 'string.$S2.escape'],
[/\\./, 'string.$S2.invalid'],
[/'/, { token: 'string.$S2.delim', bracket: '@close', next: '@pop'} ]
],
// single quote strings (also used for symbols)
// sstring.<kind> where kind is 'sq' (single quote) or 's' (symbol)
sstring: [
[/[^\\']+/, 'string.$S2' ],
[/\\\\|\\'|\\$/, 'string.$S2.escape'],
[/\\./, 'string.$S2.invalid'],
[/'/, { token: 'string.$S2.delim', bracket: '@close', next: '@pop'} ]
],
// double quoted "string".
// dstring.<kind>.<delim> where kind is 'd' (double quoted), 'x' (command), or 's' (symbol)
// and delim is the ending delimiter (" or `)
dstring: [
[/[^\\`"#]+/, 'string.$S2'],
[/#/, 'string.$S2.escape', '@interpolated' ],
[/\\$/, 'string.$S2.escape' ],
[/@escapes/, 'string.$S2.escape'],
[/\\./, 'string.$S2.escape.invalid'],
[/[`"]/, { cases: { '$#==$S3': { token: 'string.$S2.delim', bracket: '@close', next: '@pop'},
'@default': 'string.$S2' } } ]
],
// double quoted "string".
// dstring.<kind>.<delim> where kind is 'd' (double quoted), 'x' (command), or 's' (symbol)
// and delim is the ending delimiter (" or `)
dstring: [
[/[^\\`"#]+/, 'string.$S2'],
[/#/, 'string.$S2.escape', '@interpolated' ],
[/\\$/, 'string.$S2.escape' ],
[/@escapes/, 'string.$S2.escape'],
[/\\./, 'string.$S2.escape.invalid'],
[/[`"]/, { cases: { '$#==$S3': { token: 'string.$S2.delim', bracket: '@close', next: '@pop'},
'@default': 'string.$S2' } } ]
],
// literal documents
// heredoc.<close> where close is the closing delimiter
heredoc: [
[/^(\s*)(@heredelim)$/, { cases: { '$2==$S2': ['string.heredoc', { token: 'string.heredoc.delimiter', bracket: '@close', next: '@pop' }],
'@default': ['string.heredoc','string.heredoc'] }}],
[/.*/, 'string.heredoc' ],
],
// literal documents
// heredoc.<close> where close is the closing delimiter
heredoc: [
[/^(\s*)(@heredelim)$/, { cases: { '$2==$S2': ['string.heredoc', { token: 'string.heredoc.delimiter', bracket: '@close', next: '@pop' }],
'@default': ['string.heredoc','string.heredoc'] }}],
[/.*/, 'string.heredoc' ],
],
// interpolated sequence
interpolated: [
[/\$\w*/, 'global.constant', '@pop' ],
[/@\w*/, 'namespace.class.identifier', '@pop' ],
[/@@\w*/, 'namespace.instance.identifier', '@pop' ],
[/[{]/, { token: 'string.escape.curly', bracket: '@open', switchTo: '@interpolated_compound' }],
['', '', '@pop' ], // just a # is interpreted as a #
],
// interpolated sequence
interpolated: [
[/\$\w*/, 'global.constant', '@pop' ],
[/@\w*/, 'namespace.class.identifier', '@pop' ],
[/@@\w*/, 'namespace.instance.identifier', '@pop' ],
[/[{]/, { token: 'string.escape.curly', bracket: '@open', switchTo: '@interpolated_compound' }],
['', '', '@pop' ], // just a # is interpreted as a #
],
// any code
interpolated_compound: [
[/[}]/, { token: 'string.escape.curly', bracket: '@close', next: '@pop'} ],
{ include: '@root' },
],
// any code
interpolated_compound: [
[/[}]/, { token: 'string.escape.curly', bracket: '@close', next: '@pop'} ],
{ include: '@root' },
],
// %r quoted regexp
// pregexp.<open>.<close> where open/close are the open/close delimiter
pregexp: [
{ include: '@whitespace' },
// turns out that you can quote using regex control characters, aargh!
// for example; %r|kgjgaj| is ok (even though | is used for alternation)
// so, we need to match those first
[/[^\(\{\[\\]/, { cases: { '$#==$S3' : { token: 'regexp.delim', bracket: '@close', next: '@pop' },
'$#==$S2' : { token: 'regexp.delim', bracket: '@open', next: '@push' }, // nested delimiters are allowed..
'~[)}\\]]' : '@brackets.regexp.escape.control',
'~@regexpctl': 'regexp.escape.control',
'@default': 'regexp' }}],
{ include: '@regexcontrol' },
],
// %r quoted regexp
// pregexp.<open>.<close> where open/close are the open/close delimiter
pregexp: [
{ include: '@whitespace' },
// turns out that you can quote using regex control characters, aargh!
// for example; %r|kgjgaj| is ok (even though | is used for alternation)
// so, we need to match those first
[/[^\(\{\[\\]/, { cases: { '$#==$S3' : { token: 'regexp.delim', bracket: '@close', next: '@pop' },
'$#==$S2' : { token: 'regexp.delim', bracket: '@open', next: '@push' }, // nested delimiters are allowed..
'~[)}\\]]' : '@brackets.regexp.escape.control',
'~@regexpctl': 'regexp.escape.control',
'@default': 'regexp' }}],
{ include: '@regexcontrol' },
],
// We match regular expression quite precisely
regexp: [
{ include: '@regexcontrol' },
[/[^\\\/]/, 'regexp' ],
['/[ixmp]*', { token: 'regexp.delim', bracket: '@close'}, '@pop' ],
],
// We match regular expression quite precisely
regexp: [
{ include: '@regexcontrol' },
[/[^\\\/]/, 'regexp' ],
['/[ixmp]*', { token: 'regexp.delim', bracket: '@close'}, '@pop' ],
],
regexcontrol: [
[/(\{)(\d+(?:,\d*)?)(\})/, ['@brackets.regexp.escape.control', 'regexp.escape.control', '@brackets.regexp.escape.control'] ],
[/(\[)(\^?)/, ['@brackets.regexp.escape.control',{ token: 'regexp.escape.control', next: '@regexrange'}]],
[/(\()(\?[:=!])/, ['@brackets.regexp.escape.control', 'regexp.escape.control'] ],
[/\(\?#/, { token: 'regexp.escape.control', bracket: '@open', next: '@regexpcomment' }],
[/[()]/, '@brackets.regexp.escape.control'],
[/@regexpctl/, 'regexp.escape.control'],
[/\\$/, 'regexp.escape' ],
[/@regexpesc/, 'regexp.escape' ],
[/\\\./, 'regexp.invalid' ],
[/#/, 'regexp.escape', '@interpolated' ],
],
regexcontrol: [
[/(\{)(\d+(?:,\d*)?)(\})/, ['@brackets.regexp.escape.control', 'regexp.escape.control', '@brackets.regexp.escape.control'] ],
[/(\[)(\^?)/, ['@brackets.regexp.escape.control',{ token: 'regexp.escape.control', next: '@regexrange'}]],
[/(\()(\?[:=!])/, ['@brackets.regexp.escape.control', 'regexp.escape.control'] ],
[/\(\?#/, { token: 'regexp.escape.control', bracket: '@open', next: '@regexpcomment' }],
[/[()]/, '@brackets.regexp.escape.control'],
[/@regexpctl/, 'regexp.escape.control'],
[/\\$/, 'regexp.escape' ],
[/@regexpesc/, 'regexp.escape' ],
[/\\\./, 'regexp.invalid' ],
[/#/, 'regexp.escape', '@interpolated' ],
],
regexrange: [
[/-/, 'regexp.escape.control'],
[/\^/, 'regexp.invalid'],
[/\\$/, 'regexp.escape' ],
[/@regexpesc/, 'regexp.escape'],
[/[^\]]/, 'regexp'],
[/\]/, '@brackets.regexp.escape.control', '@pop'],
],
regexrange: [
[/-/, 'regexp.escape.control'],
[/\^/, 'regexp.invalid'],
[/\\$/, 'regexp.escape' ],
[/@regexpesc/, 'regexp.escape'],
[/[^\]]/, 'regexp'],
[/\]/, '@brackets.regexp.escape.control', '@pop'],
],
regexpcomment: [
[ /[^)]+/, 'comment' ],
[ /\)/, { token: 'regexp.escape.control', bracket: '@close', next: '@pop' } ]
],
regexpcomment: [
[ /[^)]+/, 'comment' ],
[ /\)/, { token: 'regexp.escape.control', bracket: '@close', next: '@pop' } ]
],
// % quoted strings
// A bit repetitive since we need to often special case the kind of ending delimiter
pstring: [
[/%([qws])\(/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.(.)' } ],
[/%([qws])\[/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.[.]' } ],
[/%([qws])\{/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.{.}' } ],
[/%([qws])</, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.<.>' } ],
[/%([qws])(@delim)/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.$2.$2' } ],
// % quoted strings
// A bit repetitive since we need to often special case the kind of ending delimiter
pstring: [
[/%([qws])\(/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.(.)' } ],
[/%([qws])\[/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.[.]' } ],
[/%([qws])\{/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.{.}' } ],
[/%([qws])</, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.<.>' } ],
[/%([qws])(@delim)/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.$2.$2' } ],
[/%r\(/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.(.)' } ],
[/%r\[/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.[.]' } ],
[/%r\{/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.{.}' } ],
[/%r</, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.<.>' } ],
[/%r(@delim)/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.$1.$1' } ],
[/%r\(/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.(.)' } ],
[/%r\[/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.[.]' } ],
[/%r\{/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.{.}' } ],
[/%r</, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.<.>' } ],
[/%r(@delim)/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.$1.$1' } ],
[/%(x|W|Q?)\(/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.(.)' } ],
[/%(x|W|Q?)\[/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.[.]' } ],
[/%(x|W|Q?)\{/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.{.}' } ],
[/%(x|W|Q?)</, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.<.>' } ],
[/%(x|W|Q?)(@delim)/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.$2.$2' } ],
[/%(x|W|Q?)\(/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.(.)' } ],
[/%(x|W|Q?)\[/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.[.]' } ],
[/%(x|W|Q?)\{/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.{.}' } ],
[/%(x|W|Q?)</, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.<.>' } ],
[/%(x|W|Q?)(@delim)/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.$2.$2' } ],
[/%([rqwsxW]|Q?)./, { token: 'invalid', next: '@pop' } ], // recover
[/./, { token: 'invalid', next: '@pop' } ], // recover
],
[/%([rqwsxW]|Q?)./, { token: 'invalid', next: '@pop' } ], // recover
[/./, { token: 'invalid', next: '@pop' } ], // recover
],
// non-expanded quoted string.
// qstring.<kind>.<open>.<close>
// kind = q|w|s (single quote, array, symbol)
// open = open delimiter
// close = close delimiter
qstring: [
[/\\$/, 'string.$S2.escape' ],
[/\\./, 'string.$S2.escape' ],
[/./, { cases: { '$#==$S4' : { token: 'string.$S2.delim', bracket: '@close', next: '@pop' },
'$#==$S3' : { token: 'string.$S2.delim', bracket: '@open', next: '@push' }, // nested delimiters are allowed..
'@default': 'string.$S2' }}],
],
// non-expanded quoted string.
// qstring.<kind>.<open>.<close>
// kind = q|w|s (single quote, array, symbol)
// open = open delimiter
// close = close delimiter
qstring: [
[/\\$/, 'string.$S2.escape' ],
[/\\./, 'string.$S2.escape' ],
[/./, { cases: { '$#==$S4' : { token: 'string.$S2.delim', bracket: '@close', next: '@pop' },
'$#==$S3' : { token: 'string.$S2.delim', bracket: '@open', next: '@push' }, // nested delimiters are allowed..
'@default': 'string.$S2' }}],
],
// expanded quoted string.
// qqstring.<kind>.<open>.<close>
// kind = Q|W|x (double quote, array, command)
// open = open delimiter
// close = close delimiter
qqstring: [
[/#/, 'string.$S2.escape', '@interpolated' ],
{ include: '@qstring' }
],
// expanded quoted string.
// qqstring.<kind>.<open>.<close>
// kind = Q|W|x (double quote, array, command)
// open = open delimiter
// close = close delimiter
qqstring: [
[/#/, 'string.$S2.escape', '@interpolated' ],
{ include: '@qstring' }
],
// whitespace & comments
whitespace: [
[/[ \t\r\n]+/, ''],
[/^\s*=begin\b/, 'comment', '@comment' ],
[/#.*$/, 'comment'],
],
// whitespace & comments
whitespace: [
[/[ \t\r\n]+/, ''],
[/^\s*=begin\b/, 'comment', '@comment' ],
[/#.*$/, 'comment'],
],
comment: [
[/[^=]+/, 'comment' ],
[/^\s*=begin\b/, 'comment.invalid' ], // nested comment
[/^\s*=end\b.*/, 'comment', '@pop' ],
[/[=]/, 'comment' ]
],
}
comment: [
[/[^=]+/, 'comment' ],
[/^\s*=begin\b/, 'comment.invalid' ], // nested comment
[/^\s*=end\b.*/, 'comment', '@pop' ],
[/[=]/, 'comment' ]
],
}
};

View file

@ -539,7 +539,7 @@ export class Parser {
// media_query : [ONLY | NOT]? S* IDENT S* [ AND S* expression ]* | expression [ AND S* expression ]*
// expression : '(' S* IDENT S* [ ':' S* expr ]? ')' S*
var node = <nodes.MediaQuery> this.create(nodes.MediaQuery);
var node = <nodes.MediaQuery> this.create(nodes.MediaQuery);
var parseExpression= true;
var hasContent = false;

View file

@ -69,7 +69,7 @@ suite('Validation - CSS', () => {
return { worker: worker, model: model, markers: markers };
};
var testSuggestionsFor = function(value:string, stringBefore:string):WinJS.TPromise<Modes.ISuggestions> {
var testSuggestionsFor = function(value:string, stringBefore:string):WinJS.TPromise<Modes.ISuggestions> {
var url = new Network.URL('test://1');
var env = mockCSSWorkerEnv(url, value);
@ -78,7 +78,7 @@ suite('Validation - CSS', () => {
return env.worker.suggest(url, position).then(result => result[0]);
};
var testValueSetFor = function(value:string, selection:string, selectionLength: number, up: boolean):WinJS.TPromise<Modes.IInplaceReplaceSupportResult> {
var testValueSetFor = function(value:string, selection:string, selectionLength: number, up: boolean):WinJS.TPromise<Modes.IInplaceReplaceSupportResult> {
var url = new Network.URL('test://1');
var env = mockCSSWorkerEnv(url, value);
@ -114,7 +114,7 @@ suite('Validation - CSS', () => {
return suggestion.label === label && (!type || suggestion.type === type);
});
if (proposalsFound.length != 1) {
assert.fail("Suggestion not found: " + label + ", has " + completion.suggestions.map(s => s.label).join(', '));
assert.fail("Suggestion not found: " + label + ", has " + completion.suggestions.map(s => s.label).join(', '));
}
};

View file

@ -102,7 +102,7 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
style: ['media', 'type', 'scoped:v'],
script: ['src', 'async:v', 'defer:v', 'type', 'charset'],
body: ['onafterprint', 'onbeforeprint', 'onbeforeunload', 'onblur', 'onerror', 'onfocus', 'onhashchange', 'onload', 'onmessage',
'onoffline', 'ononline', 'onpagehide', 'onpageshow', 'onpopstate', 'onresize', 'onscroll', 'onstorage', 'onunload'],
'onoffline', 'ononline', 'onpagehide', 'onpageshow', 'onpopstate', 'onresize', 'onscroll', 'onstorage', 'onunload'],
table: none,
caption: none,
colgroup: ['span'],

View file

@ -50,7 +50,7 @@ suite('HTML - worker', () => {
return { worker: worker, model: model, markers: markers };
};
var testSuggestionsFor = function(value:string):WinJS.TPromise<Modes.ISuggestions> {
var testSuggestionsFor = function(value:string):WinJS.TPromise<Modes.ISuggestions> {
var idx = value.indexOf('|');
var content = value.substr(0, idx) + value.substr(idx + 1);
@ -62,13 +62,13 @@ suite('HTML - worker', () => {
return env.worker.suggest(url, position).then(result => result[0]);
};
var assertSuggestion = function(completion: Modes.ISuggestions, label: string, type?: string, codeSnippet?: string) {
var proposalsFound = completion.suggestions.filter(function(suggestion: Modes.ISuggestion) {
return suggestion.label === label && (!type || suggestion.type === type) && (!codeSnippet || suggestion.codeSnippet === codeSnippet);
});
if (proposalsFound.length != 1) {
assert.fail("Suggestion not found: " + label + ", has " + completion.suggestions.map(s => s.label).join(', '));
}
var assertSuggestion = function(completion: Modes.ISuggestions, label: string, type?: string, codeSnippet?: string) {
var proposalsFound = completion.suggestions.filter(function(suggestion: Modes.ISuggestion) {
return suggestion.label === label && (!type || suggestion.type === type) && (!codeSnippet || suggestion.codeSnippet === codeSnippet);
});
if (proposalsFound.length != 1) {
assert.fail("Suggestion not found: " + label + ", has " + completion.suggestions.map(s => s.label).join(', '));
}
};
test('Intellisense', function(testDone): any {

View file

@ -44,7 +44,7 @@ export class BowerJSONContribution implements JSONWorker.IJSONWorkerContribution
public collectPropertySuggestions(contributionId: string, currentWord: string, addValue: boolean, isLast:boolean, result: JSONWorker.ISuggestionsCollector) : WinJS.Promise {
if (contributionId === 'bower-packages') {
if (currentWord.length > 0) {
if (currentWord.length > 0) {
var queryUrl = 'https://bower.herokuapp.com/packages/search/' + encodeURIComponent(currentWord);
return this.requestService.makeRequest({
@ -80,7 +80,7 @@ export class BowerJSONContribution implements JSONWorker.IJSONWorkerContribution
result.error(nls.localize('json.bower.error.repoaccess', 'Request to the bower repository failed: {0}', error.responseText));
return 0;
});
} else {
} else {
this.topRanked.forEach((name) => {
var codeSnippet = JSON.stringify(name);
if (addValue) {
@ -90,9 +90,9 @@ export class BowerJSONContribution implements JSONWorker.IJSONWorkerContribution
}
}
result.add({ type: 'property', label: name, codeSnippet: codeSnippet, documentationLabel: '' });
});
result.setAsIncomplete();
}
});
result.setAsIncomplete();
}
}
return WinJS.Promise.as(0);
}

View file

@ -15,11 +15,11 @@ var LIMIT = 40;
export class PackageJSONContribution implements JSONWorker.IJSONWorkerContribution {
private mostDependedOn = [ 'lodash', 'async', 'underscore', 'request', 'commander', 'express', 'debug', 'chalk', 'colors', 'q', 'coffee-script',
'mkdirp', 'optimist', 'through2', 'yeoman-generator', 'moment', 'bluebird', 'glob', 'gulp-util', 'minimist', 'cheerio', 'jade', 'redis', 'node-uuid',
'socket', 'io', 'uglify-js', 'winston', 'through', 'fs-extra', 'handlebars', 'body-parser', 'rimraf', 'mime', 'semver', 'mongodb', 'jquery',
'grunt', 'connect', 'yosay', 'underscore', 'string', 'xml2js', 'ejs', 'mongoose', 'marked', 'extend', 'mocha', 'superagent', 'js-yaml', 'xtend',
'shelljs', 'gulp', 'yargs', 'browserify', 'minimatch', 'react', 'less', 'prompt', 'inquirer', 'ws', 'event-stream', 'inherits', 'mysql', 'esprima',
'jsdom', 'stylus', 'when', 'readable-stream', 'aws-sdk', 'concat-stream', 'chai', 'promise', 'wrench'];
'mkdirp', 'optimist', 'through2', 'yeoman-generator', 'moment', 'bluebird', 'glob', 'gulp-util', 'minimist', 'cheerio', 'jade', 'redis', 'node-uuid',
'socket', 'io', 'uglify-js', 'winston', 'through', 'fs-extra', 'handlebars', 'body-parser', 'rimraf', 'mime', 'semver', 'mongodb', 'jquery',
'grunt', 'connect', 'yosay', 'underscore', 'string', 'xml2js', 'ejs', 'mongoose', 'marked', 'extend', 'mocha', 'superagent', 'js-yaml', 'xtend',
'shelljs', 'gulp', 'yargs', 'browserify', 'minimatch', 'react', 'less', 'prompt', 'inquirer', 'ws', 'event-stream', 'inherits', 'mysql', 'esprima',
'jsdom', 'stylus', 'when', 'readable-stream', 'aws-sdk', 'concat-stream', 'chai', 'promise', 'wrench'];
private requestService : IRequestService;
@ -45,7 +45,7 @@ export class PackageJSONContribution implements JSONWorker.IJSONWorkerContributi
public collectPropertySuggestions(contributionId: string, currentWord: string, addValue: boolean, isLast:boolean, result: JSONWorker.ISuggestionsCollector) : WinJS.Promise {
if (contributionId === 'npm-packages') {
var queryUrl : string;
if (currentWord.length > 0) {
if (currentWord.length > 0) {
queryUrl = 'https://skimdb.npmjs.com/registry/_design/app/_view/browseAll?group_level=1&limit=' + LIMIT + '&start_key=%5B%22' + encodeURIComponent(currentWord) + '%22%5D&end_key=%5B%22'+ encodeURIComponent(currentWord + 'z') + '%22,%7B%7D%5D';
return this.requestService.makeRequest({
@ -95,9 +95,9 @@ export class PackageJSONContribution implements JSONWorker.IJSONWorkerContributi
}
}
result.add({ type: 'property', label: name, codeSnippet: codeSnippet, documentationLabel: '' });
});
result.setAsIncomplete();
}
});
result.setAsIncomplete();
}
}
return WinJS.Promise.as(0);
}

View file

@ -38,7 +38,7 @@ export class ProjectJSONContribution implements JSONWorker.IJSONWorkerContributi
public collectPropertySuggestions(contributionId: string, currentWord: string, addValue: boolean, isLast:boolean, result: JSONWorker.ISuggestionsCollector) : WinJS.Promise {
if (contributionId === 'nugget-packages') {
var queryUrl : string;
if (currentWord.length > 0) {
if (currentWord.length > 0) {
queryUrl = 'https://www.nuget.org/api/v2/Packages?'
+ '$filter=Id%20ge%20\''
+ encodeURIComponent(currentWord)

View file

@ -1321,18 +1321,18 @@ export class JSONSchemaService implements IJSONSchemaService {
'type': 'object',
'description': nls.localize('global.json.sdk', 'The runtime to use.'),
'properties': {
'version': {
'version': {
'type': 'string',
'description': nls.localize('global.json.sdk.version', 'The runtime version to use.')
},
'runtime': {
},
'runtime': {
'type': 'string',
'description': nls.localize('global.json.sdk.runtime', 'The runtime to use, e.g. coreclr'),
},
'architecture': {
},
'architecture': {
'type': 'string',
'description': nls.localize('global.json.sdk.architecture', 'The runtime architecture to use, e.g. x64.')
}
}
}
}
}
@ -1479,11 +1479,11 @@ export class JSONSchemaService implements IJSONSchemaService {
'experimentalDecorators': {
'description': nls.localize('tsconfig.json.compilerOptions.experimentalDecorators', 'Enables experimental support for ES7 decorators.'),
'type': 'boolean'
},
},
'experimentalAsyncFunctions': {
'description': nls.localize('tsconfig.json.compilerOptions.experimentalAsynFunctions', 'Enables experimental support for async functions (requires TypeScript 1.6).'),
'type': 'boolean'
}
}
}
},
'files': {

View file

@ -55,7 +55,7 @@ suite('JSON - Worker', () => {
}
}
var testSuggestionsFor = function(value:string, stringAfter:string, schema?:jsonSchema.IJSONSchema):WinJS.TPromise<Modes.ISuggestions> {
var testSuggestionsFor = function(value:string, stringAfter:string, schema?:jsonSchema.IJSONSchema):WinJS.TPromise<Modes.ISuggestions> {
var url = new network.URL('test://test.json');
var env = mockWorkerEnv(url, value);
prepareSchemaServer(schema, env.worker);
@ -72,7 +72,7 @@ suite('JSON - Worker', () => {
return env.worker.computeInfo(url, position);
}
var testValueSetFor = function(value:string, schema:jsonSchema.IJSONSchema, selection:string, selectionLength: number, up: boolean):WinJS.TPromise<Modes.IInplaceReplaceSupportResult> {
var testValueSetFor = function(value:string, schema:jsonSchema.IJSONSchema, selection:string, selectionLength: number, up: boolean):WinJS.TPromise<Modes.IInplaceReplaceSupportResult> {
var url = new network.URL('test://test.json');
var env = mockWorkerEnv(url, value);
prepareSchemaServer(schema, env.worker);

View file

@ -340,8 +340,8 @@ suite('JSON - schema', () => {
var service : SchemaService.IJSONSchemaService = new SchemaService.JSONSchemaService(requestServiceMock);
var input = {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "SQLServer",
@ -383,8 +383,8 @@ suite('JSON - schema', () => {
var service : SchemaService.IJSONSchemaService = new SchemaService.JSONSchemaService(requestServiceMock);
var input = {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "foo",

View file

@ -49,7 +49,7 @@ export class LessParser extends cssParser.Parser {
}
public _parseMediaQuery(resyncStopToken: scanner.TokenType[]): nodes.Node {
var node = <nodes.MediaQuery> super._parseMediaQuery(resyncStopToken);
var node = <nodes.MediaQuery> super._parseMediaQuery(resyncStopToken);
if (!node) {
var node = <nodes.MediaQuery> this.create(nodes.MediaQuery);
if (node.addChild(this._parseVariable())) {

View file

@ -26,7 +26,7 @@ suite('LESS-tokenization', () => {
});
test('', () => {
modesUtil.executeTests(tokenizationSupport, [
modesUtil.executeTests(tokenizationSupport, [
// Keywords
[{
line: 'isnumber(10);',

View file

@ -48,7 +48,7 @@ suite('LESS - Intellisense', () => {
return suggestion.label === label;
});
if (proposalsFound.length != 1) {
assert.fail("Suggestion not found: " + label + ", has " + completion.suggestions.map(s => s.label).join(', '));
assert.fail("Suggestion not found: " + label + ", has " + completion.suggestions.map(s => s.label).join(', '));
}
};

View file

@ -150,6 +150,6 @@ code > div {
}
.hc-black blockquote {
background: transparent;
border-color: #fff;
background: transparent;
border-color: #fff;
}

View file

@ -22,7 +22,7 @@ suite('Markdown - tokenization', () => {
});
test('', () => {
modesUtil.executeTests(tokenizationSupport, [
modesUtil.executeTests(tokenizationSupport, [
// HTML and embedded content - bug 16912
[{
line: '<b>foo</b>*bar*',

View file

@ -32,7 +32,7 @@ suite('Syntax Highlighting - PHP', () => {
});
test('', () => {
modesUtil.executeTests(tokenizationSupport, [
modesUtil.executeTests(tokenizationSupport, [
// Bug 13596:[ErrorTelemetry] Stream did not advance while tokenizing. Mode id is php (stuck)
// We're testing the fact that tokenize does not throw
@ -1916,7 +1916,7 @@ suite('Syntax Highlighting - PHP', () => {
{ startIndex:17, type: '' },
{ startIndex:18, type: 'metatag.php', bracket: Modes.Bracket.Close }
]}]
]);
]);
});
test('Word definition', function() {

View file

@ -21,7 +21,7 @@ suite('Syntax Highlighting - Plain Text', () => {
});
test('', () => {
modesUtil.executeTests(tokenizationSupport, [
modesUtil.executeTests(tokenizationSupport, [
// One line text file
[{
line: 'a simple text file',

View file

@ -23,7 +23,7 @@ suite('Syntax Highlighting - Razor', () => {
});
test('', () => {
modesUtil.executeTests(tokenizationSupport,[
modesUtil.executeTests(tokenizationSupport,[
// Embedding - embedded html
[{
line: '@{ var x; <b>x</b> }',

View file

@ -75,7 +75,7 @@ export var language = <Types.ILanguage>{
['[@](extend)', { token: 'keyword.control.at-rule', next: '@extendbody'}], // sass: extend other selectors
['[@](return)', { token: 'keyword.control.at-rule', next: '@declarationbody'}],
['}', { token: 'punctuation.curly', bracket: '@close', next: '@pop'}],
],
],
selectorname: [
['#{', { token: 'support.function.interpolation', bracket: '@open', next: '@variableinterpolation' }], // sass: interpolation
@ -125,7 +125,7 @@ export var language = <Types.ILanguage>{
],
variabledeclaration: [ // sass variables
['\\$@identifier@ws:', 'variable.decl', '@declarationbody'],
['\\$@identifier@ws:', 'variable.decl', '@declarationbody'],
],
urldeclaration: [
@ -153,9 +153,9 @@ export var language = <Types.ILanguage>{
],
variablereference: [ // sass variable reference
['\\$@identifier', 'variable.ref'],
['\\.\\.\\.', 'keyword.operator'], // var args in reference
['#{', { token: 'support.function.interpolation', bracket: '@open', next: '@variableinterpolation' }], // sass var resolve
['\\$@identifier', 'variable.ref'],
['\\.\\.\\.', 'keyword.operator'], // var args in reference
['#{', { token: 'support.function.interpolation', bracket: '@open', next: '@variableinterpolation' }], // sass var resolve
],
variableinterpolation: [
@ -227,7 +227,7 @@ export var language = <Types.ILanguage>{
],
controlstatement: [
['[@](if|else|for|while|each|media)', { token: 'keyword.flow.control.at-rule', next: '@controlstatementdeclaration'}],
['[@](if|else|for|while|each|media)', { token: 'keyword.flow.control.at-rule', next: '@controlstatementdeclaration'}],
],
controlstatementdeclaration: [

View file

@ -86,12 +86,12 @@ suite('Sass - Sass Parser', () => {
test('Sass Parser - SassOperator', function() {
var parser = new _parser.SassParser();
assertNode('>=', parser, parser._parseOperator.bind(parser));
assertNode('>', parser, parser._parseOperator.bind(parser));
assertNode('<', parser, parser._parseOperator.bind(parser));
assertNode('<=', parser, parser._parseOperator.bind(parser));
assertNode('==', parser, parser._parseOperator.bind(parser));
assertNode('!=', parser, parser._parseOperator.bind(parser));
assertNode('>=', parser, parser._parseOperator.bind(parser));
assertNode('>', parser, parser._parseOperator.bind(parser));
assertNode('<', parser, parser._parseOperator.bind(parser));
assertNode('<=', parser, parser._parseOperator.bind(parser));
assertNode('==', parser, parser._parseOperator.bind(parser));
assertNode('!=', parser, parser._parseOperator.bind(parser));
assertNode('and', parser, parser._parseOperator.bind(parser));
assertNode('+', parser, parser._parseOperator.bind(parser));
assertNode('-', parser, parser._parseOperator.bind(parser));

View file

@ -30,7 +30,7 @@ suite('SASS - Worker', () => {
return { worker: worker, model: model };
};
var testSuggestionsFor = function(value:string, stringBefore:string):WinJS.TPromise<Modes.ISuggestions> {
var testSuggestionsFor = function(value:string, stringBefore:string):WinJS.TPromise<Modes.ISuggestions> {
var url = new Network.URL('test://1');
var env = mockSASSWorkerEnv(url, value);
@ -39,7 +39,7 @@ suite('SASS - Worker', () => {
return env.worker.suggest(url, position).then(result => result[0]);
};
var testValueSetFor = function(value:string, selection:string, selectionLength: number, up: boolean):WinJS.TPromise<Modes.IInplaceReplaceSupportResult> {
var testValueSetFor = function(value:string, selection:string, selectionLength: number, up: boolean):WinJS.TPromise<Modes.IInplaceReplaceSupportResult> {
var url = new Network.URL('test://1');
var env = mockSASSWorkerEnv(url, value);
@ -49,7 +49,7 @@ suite('SASS - Worker', () => {
return env.worker.inplaceReplaceSupport.navigateValueSet(url, range, up);
};
var testOccurrences = function(value:string, tokenBefore:string):WinJS.TPromise<{ occurrences: Modes.IOccurence[]; model: mm.MirrorModel }> {
var testOccurrences = function(value:string, tokenBefore:string):WinJS.TPromise<{ occurrences: Modes.IOccurence[]; model: mm.MirrorModel }> {
var url = new Network.URL('test://1');
var env = mockSASSWorkerEnv(url, value);
@ -63,7 +63,7 @@ suite('SASS - Worker', () => {
return suggestion.label === label && (!type || suggestion.type === type);
});
if (proposalsFound.length != 1) {
assert.fail("Suggestion not found: " + label + ", has " + completion.suggestions.map(s => s.label).join(', '));
assert.fail("Suggestion not found: " + label + ", has " + completion.suggestions.map(s => s.label).join(', '));
}
};

View file

@ -23,7 +23,7 @@ suite('Sass Colorizer', () => {
});
test('', () => {
modesUtil.executeTests(tokenizationSupport, [
modesUtil.executeTests(tokenizationSupport, [
// Nested Rules
[{
line: '#main {\n width: 97%;\n p, div {\n font-size: 2em;\n a { font-weight: bold; }\n }\n pre { font-size: 3em; }\n}',
@ -1819,7 +1819,7 @@ suite('Sass Colorizer', () => {
{ startIndex: 13, type: 'string.punctuation.sass' },
{ startIndex: 14, type: 'punctuation.sass' }
]}]
]);
]);
});
test('identifier escaping', function() {

View file

@ -104,24 +104,24 @@ function computeRenameProposals(languageService:ts.LanguageService, resource:URI
}
switch (entry.kind) {
case ts.ScriptElementKind.classElement:
case ts.ScriptElementKind.interfaceElement:
case ts.ScriptElementKind.typeElement:
case ts.ScriptElementKind.enumElement:
case ts.ScriptElementKind.variableElement:
case ts.ScriptElementKind.localVariableElement:
case ts.ScriptElementKind.functionElement:
case ts.ScriptElementKind.localFunctionElement:
case ts.ScriptElementKind.memberFunctionElement:
case ts.ScriptElementKind.memberGetAccessorElement:
case ts.ScriptElementKind.memberSetAccessorElement:
case ts.ScriptElementKind.memberVariableElement:
case ts.ScriptElementKind.constructorImplementationElement:
case ts.ScriptElementKind.callSignatureElement:
case ts.ScriptElementKind.indexSignatureElement:
case ts.ScriptElementKind.constructSignatureElement:
case ts.ScriptElementKind.parameterElement:
case ts.ScriptElementKind.primitiveType:
case ts.ScriptElementKind.classElement:
case ts.ScriptElementKind.interfaceElement:
case ts.ScriptElementKind.typeElement:
case ts.ScriptElementKind.enumElement:
case ts.ScriptElementKind.variableElement:
case ts.ScriptElementKind.localVariableElement:
case ts.ScriptElementKind.functionElement:
case ts.ScriptElementKind.localFunctionElement:
case ts.ScriptElementKind.memberFunctionElement:
case ts.ScriptElementKind.memberGetAccessorElement:
case ts.ScriptElementKind.memberSetAccessorElement:
case ts.ScriptElementKind.memberVariableElement:
case ts.ScriptElementKind.constructorImplementationElement:
case ts.ScriptElementKind.callSignatureElement:
case ts.ScriptElementKind.indexSignatureElement:
case ts.ScriptElementKind.constructSignatureElement:
case ts.ScriptElementKind.parameterElement:
case ts.ScriptElementKind.primitiveType:
var score = strings.difference(currentWord, entry.name);
if (score < currentWord.length / 2 /*score_lim*/) {

View file

@ -35,7 +35,7 @@ function rename(project: projectService.IProject, resource: URI, position: Edito
.filter(location => {
return !typescript.isDefaultLib(location.fileName)
})
.map(location => {
.map(location => {
return {
resource: URI.parse(location.fileName),
newText: newName,

View file

@ -231,7 +231,7 @@ export class UnusedFunctions implements rules.IStyleRule2<ts.FunctionDeclaration
}
var position = ts.getTokenPosOfNode(node.name),
entries = context.languageService().getOccurrencesAtPosition(context.filename(), position);
entries = context.languageService().getOccurrencesAtPosition(context.filename(), position);
if(entries && entries.length <= 1) {
context.reportError(node.name, this.name, this.code, position);

View file

@ -63,7 +63,7 @@ suite('JS* - Require Rewriter', () => {
' (<typeof _$steroids$_45_48>require("a")).b',
'});',
]);
});
});
test('require, strip .js-extname', function () {
assertTranslation([

View file

@ -55,7 +55,7 @@ suite('TS/JS - syntax highlighting', () => {
});
test('', () => {
modesUtil.executeTests(tokenizationSupport, [
modesUtil.executeTests(tokenizationSupport, [
// Keywords
[{

View file

@ -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.
*--------------------------------------------------------------------------------------------*/
.context-view .monaco-menu {
min-width: 130px;
}

View file

@ -245,9 +245,9 @@ class ServicesMap {
if (actualFirstServiceIndex !== Number.MAX_VALUE
&& actualFirstServiceIndex !== expectedFirstServiceIndex) {
let msg = `[createInstance] constructor '${descriptor.ctor.name}' has first\
service dependency at position ${actualFirstServiceIndex + 1} but is called with\
${expectedFirstServiceIndex - 1} static arguments that are expected to come first`;
let msg = `[createInstance] constructor '${descriptor.ctor.name}' has first` +
` service dependency at position ${actualFirstServiceIndex + 1} but is called with` +
` ${expectedFirstServiceIndex - 1} static arguments that are expected to come first`;
// throw new Error(msg);
console.warn(msg);

View file

@ -15,26 +15,26 @@ 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 keybindingItem: IKeybindingItem = {
command: 'yes',
context: contextRules,
keybinding: keybinding,
weight1: 0,
weight2: 0
};
var keybinding = KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z;
var contextRules = [{
key: 'bar',
operator: 'equal',
operand: 'baz'
}]
var keybindingItem: IKeybindingItem = {
command: 'yes',
context: contextRules,
keybinding: keybinding,
weight1: 0,
weight2: 0
};
assert.equal(CommonKeybindingResolver.contextMatchesRules({ bar: 'baz' }, contextRules), true);
assert.equal(CommonKeybindingResolver.contextMatchesRules({ bar: 'bz' }, contextRules), false);
assert.equal(CommonKeybindingResolver.contextMatchesRules({ bar: 'baz' }, contextRules), true);
assert.equal(CommonKeybindingResolver.contextMatchesRules({ bar: 'bz' }, contextRules), false);
var resolver = new CommonKeybindingResolver([keybindingItem], []);
assert.equal(resolver.resolve({ bar: 'baz' }, 0, keybinding).commandId, 'yes');
assert.equal(resolver.resolve({ bar: 'bz' }, 0, keybinding), null);
var resolver = new CommonKeybindingResolver([keybindingItem], []);
assert.equal(resolver.resolve({ bar: 'baz' }, 0, keybinding).commandId, 'yes');
assert.equal(resolver.resolve({ bar: 'bz' }, 0, keybinding), null);
});
function createEqualContextRule(key: string, operand: any): IKeybindingContextRule {

View file

@ -2,8 +2,8 @@
* 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 Errors = require('vs/base/common/errors');
import Types = require('vs/base/common/types');
import Platform = require('vs/base/common/platform');
@ -278,7 +278,7 @@ export abstract class AbstractTelemetryService implements ITelemetryService {
}
export var Extenstions = {
TelemetryAppenders : 'telemetry.appenders'
TelemetryAppenders : 'telemetry.appenders'
};
export interface ITelemetryAppendersRegistry {

View file

@ -76,12 +76,12 @@ class ErrorTestingSettings {
' at t.AllWorkers (a/path/that/doesnt/contain/code/names.js:6:8844)',
' at e.(anonymous function) [as _modelEvents] (a/path/that/doesnt/contain/code/names.js:5:29552)',
' at Function.<anonymous> (a/path/that/doesnt/contain/code/names.js:6:8272)',
' at e.dispatch (a/path/that/doesnt/contain/code/names.js:5:26931)',
' at e.request (a/path/that/doesnt/contain/code/names.js:14:1745)',
' at t._handleMessage (another/path/that/doesnt/contain/code/names.js:14:17447)',
' at t._onmessage (another/path/that/doesnt/contain/code/names.js:14:16976)',
' at t.onmessage (another/path/that/doesnt/contain/code/names.js:14:15854)',
' at DedicatedWorkerGlobalScope.self.onmessage',
' at e.dispatch (a/path/that/doesnt/contain/code/names.js:5:26931)',
' at e.request (a/path/that/doesnt/contain/code/names.js:14:1745)',
' at t._handleMessage (another/path/that/doesnt/contain/code/names.js:14:17447)',
' at t._onmessage (another/path/that/doesnt/contain/code/names.js:14:16976)',
' at t.onmessage (another/path/that/doesnt/contain/code/names.js:14:15854)',
' at DedicatedWorkerGlobalScope.self.onmessage',
this.dangerousPathWithImportantInfo,
this.dangerousPathWithoutImportantInfo,
this.missingModelMessage,
@ -378,7 +378,7 @@ suite('TelemetryService', () => {
(<any>window.onerror)('Error Message', 'file.js', 2, 42, testError);
this.clock.tick(AbstractTelemetryService.AbstractTelemetryService.ERROR_FLUSH_TIMEOUT);
assert.equal(errorStub.alwaysCalledWithExactly('Error Message', 'file.js', 2, 42, testError), true);
assert.equal(errorStub.alwaysCalledWithExactly('Error Message', 'file.js', 2, 42, testError), true);
assert.equal(errorStub.callCount, 1);
assert.equal(testAppender.getEventsCount(), 1);

View file

@ -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.
*--------------------------------------------------------------------------------------------*/
/* General Theme Colors */
.monaco-workbench.vs-dark { background-color: #252526; color: #CCC; }
@ -19,7 +19,7 @@
/* Input Fields */
.monaco-workbench.vs-dark input,
.monaco-workbench.vs-dark textarea {
background-color: #3C3C3C;
background-color: #3C3C3C;
}
.monaco-workbench.vs-dark input:disabled {

View file

@ -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.
*--------------------------------------------------------------------------------------------*/
/* General Theme Colors */
.monaco-workbench { background-color: #F3F3F3; }

View file

@ -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.
*--------------------------------------------------------------------------------------------*/
.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item {
display: block;
position: relative;
@ -70,12 +70,12 @@
.monaco-workbench > .activitybar > .content .monaco-action-bar .badge .badge-content {
position: absolute;
top: 20px;
right: 8px;
right: 8px;
font-size: 11px;
min-width: 8px;
height: 18px;
line-height: 18px;
padding: 0 5px;
padding: 0 5px;
border-radius: 20px;
text-align: center;
color: white;
@ -92,8 +92,8 @@
position: absolute;
top: 15px;
right: 0;
width: 0;
height: 0;
width: 0;
height: 0;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-right: 5px solid #F6F6F6;
@ -104,8 +104,8 @@
position: absolute;
top: 15px;
right: 0;
width: 0;
height: 0;
width: 0;
height: 0;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-right: 5px solid #252526;
@ -116,8 +116,8 @@
position: absolute;
top: 15px;
left: 0;
width: 0;
height: 0;
width: 0;
height: 0;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid #F6F6F6;
@ -128,8 +128,8 @@
position: absolute;
top: 15px;
left: 0;
width: 0;
height: 0;
width: 0;
height: 0;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid #252526;
@ -154,7 +154,7 @@
.monaco-workbench > .activitybar.right > .content .monaco-action-bar .badge {
left: auto;
right: 0;
right: 0;
}
/* High Contrast Theming */

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* Editor Container Styles */
/* Editor Container Styles */
.monaco-workbench.vs .editor > .content.dragged {
background-color: #F3F3F3;
@ -17,7 +17,7 @@
border-right: 1px solid #444;
}
.monaco-workbench .editor > .content > .one-editor-container {
.monaco-workbench .editor > .content > .one-editor-container {
position: absolute;
/* use border box to be able to draw a border as separator between editors */

View file

@ -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.
*--------------------------------------------------------------------------------------------*/
.monaco-workbench > .sidebar > .title {
display: block !important; /* Enable Title visibility */
}
@ -81,11 +81,11 @@
}
/* High Contrast Theming */
.monaco-workbench.hc-black > .sidebar.left {
.monaco-workbench.hc-black > .sidebar.left {
border-right: 1px solid #6FC3DF;
}
.monaco-workbench.hc-black > .sidebar.right {
.monaco-workbench.hc-black > .sidebar.right {
border-left: 1px solid #6FC3DF;
}

View file

@ -50,8 +50,8 @@ app.once('ready', function() {
var loader = require('../../loader');
loader.config({
nodeRequire: require,
nodeMain: __filename,
nodeRequire: require,
nodeMain: __filename,
baseUrl: uriFromPath(path.dirname(path.dirname(path.dirname((__dirname)))))
});

View file

@ -56,7 +56,7 @@
.vs-dark.monaco-workbench .debug-select {
background-color: #3C3C3C;
border-color: #3C3C3C;
border-color: #3C3C3C;
color: rgb(204, 204, 204);
}

View file

@ -91,9 +91,9 @@
}
.quick-open-widget .extension .actions .action-item.disabled .action-label {
animation: move-background 0.5s linear infinite;
background-color: rgba(132, 132, 132, 0.5);
background-size: 8px;
animation: move-background 0.5s linear infinite;
background-color: rgba(132, 132, 132, 0.5);
background-size: 8px;
background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.5) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.5) 75%, transparent 75%, transparent);
color: rgb(0, 0, 0);
border-color: rgb(0, 0, 0);

View file

@ -392,15 +392,15 @@ export class ChangesView extends EventEmitter.EventEmitter implements GitView.IV
if (input instanceof GitEditorInputs.GitDiffEditorInput) {
return (<GitEditorInputs.GitDiffEditorInput> input).getFileStatus();
}
}
if (input instanceof GitEditorInputs.GitIndexEditorInput) {
return (<GitEditorInputs.GitIndexEditorInput> input).getFileStatus() || null;
}
}
if (input instanceof GitEditorInputs.NativeGitIndexStringEditorInput) {
return (<GitEditorInputs.NativeGitIndexStringEditorInput> input).getFileStatus() || null;
}
}
if (input instanceof Files.FileEditorInput) {
var fileInput = <Files.FileEditorInput> input;
@ -419,7 +419,7 @@ export class ChangesView extends EventEmitter.EventEmitter implements GitView.IV
if (status) {
return status;
}
}
}
return null;
}

View file

@ -112,7 +112,7 @@ function fileExists(path: string): winjs.TPromise<boolean> {
function createFile(path: string, content: string): winjs.Promise {
return new winjs.Promise((c, e, p) => {
fs.writeFile(path, content, function(err) {
if(err) {
if(err) {
e(err);
}
c(true);

View file

@ -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 * as nls from 'vs/nls';
import * as Objects from 'vs/base/common/objects';

View file

@ -433,9 +433,9 @@ suite('Tasks Configuration parsing tests', () => {
showOutput(Platform.isWindows ? TaskSystem.ShowOutput.Always : TaskSystem.ShowOutput.Never).
suppressTaskName(true);
let external: ExternalTaskRunnerConfiguration = {
version: '0.1.0',
command: 'tsc',
showOutput: 'never',
version: '0.1.0',
command: 'tsc',
showOutput: 'never',
windows: {
showOutput: 'always'
}
@ -450,8 +450,8 @@ suite('Tasks Configuration parsing tests', () => {
echoCommand(Platform.isWindows ? false : true).
suppressTaskName(true);
let external: ExternalTaskRunnerConfiguration = {
version: '0.1.0',
command: 'tsc',
version: '0.1.0',
command: 'tsc',
echoCommand: true,
windows: {
echoCommand: false

View file

@ -67,11 +67,11 @@ export class NodeAppInsightsTelemetryAppender implements ITelemetryAppender {
if (key) {
this.appInsights = appInsights.setup(key)
.setAutoCollectRequests(false)
.setAutoCollectPerformance(false)
.setAutoCollectExceptions(false)
.setAutoCollectRequests(false)
.setAutoCollectPerformance(false)
.setAutoCollectExceptions(false)
.setOfflineMode(true)
.start()
.start()
.client;
this.setupAIClient(this.appInsights);
@ -91,7 +91,7 @@ export class NodeAppInsightsTelemetryAppender implements ITelemetryAppender {
if (client && client.context &&
client.context.keys && client.context.tags) {
var machineNameKey = client.context.keys.deviceMachineName;
client.context.tags[machineNameKey] = '';
client.context.tags[machineNameKey] = '';
}
}

View file

@ -77,8 +77,8 @@ function main() {
});
var loaderConfig = {
nodeRequire: require,
nodeMain: __filename,
nodeRequire: require,
nodeMain: __filename,
baseUrl: path.join(path.dirname(__dirname)),
paths: {
'vs': out + '/vs',

View file

@ -1,16 +1,16 @@
<html>
<head>
<meta charset="utf-8">
<title>VSCode Tests</title>
<link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet" />
<meta charset="utf-8">
<title>VSCode Tests</title>
<link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet" />
</head>
<body>
<div id="mocha"></div>
<div id="mocha"></div>
<!--<script src="https://cdn.rawgit.com/jquery/jquery/2.1.4/dist/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/Automattic/expect.js/0.3.1/index.js"></script>-->
<script src="/out/vs/loader.js"></script>
<script src="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.js"></script>
<!--<script src="https://cdn.rawgit.com/jquery/jquery/2.1.4/dist/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/Automattic/expect.js/0.3.1/index.js"></script>-->
<script src="/out/vs/loader.js"></script>
<script src="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.js"></script>
<script>
mocha.setup('tdd');