提交 a47f6766 编写于 作者: J Johannes Rieken

:liptsick: tslint here and there

上级 b3f65f61
......@@ -57,7 +57,6 @@ export function register(what: string, fn: Function): (...args: any[]) => void {
data[idx + 1] = [];
}
var backInTime = allArgs.length > 1;
var doIt:()=>void = function() {
var thisArguments = allArgs.shift();
fn.apply(fn, thisArguments);
......
......@@ -185,10 +185,10 @@ function isCamelCaseWord(word: string): boolean {
for (let i = 0; i < word.length; i++) {
code = word.charCodeAt(i);
if (isUpper(code)) upper++;
if (isLower(code)) lower++;
if (isAlphanumeric(code)) alpha++;
if (isNumber(code)) numeric++;
if (isUpper(code)) { upper++; }
if (isLower(code)) { lower++; }
if (isAlphanumeric(code)) { alpha++; }
if (isNumber(code)) { numeric++; }
}
let upperPercent = upper / word.length;
......@@ -207,9 +207,9 @@ function isCamelCasePattern(word: string): boolean {
for (let i = 0; i < word.length; i++) {
code = word.charCodeAt(i);
if (isUpper(code)) upper++;
if (isLower(code)) lower++;
if (isWhitespace(code)) whitespace++;
if (isUpper(code)) { upper++; }
if (isLower(code)) { lower++; }
if (isWhitespace(code)) { whitespace++; }
}
if ((upper === 0 || lower === 0) && whitespace === 0) {
......
......@@ -11,7 +11,7 @@ export function stringify(obj: any): string {
}
export function parse(text: string): any {
return JSON.parse(text, reviver)
return JSON.parse(text, reviver);
}
interface MarshalledObject {
......@@ -25,7 +25,7 @@ function replacer(key: string, value: any): any {
$mid: 2,
source: (<RegExp>value).source,
flags: ((<RegExp>value).global ? 'g' : '') + ((<RegExp>value).ignoreCase ? 'i' : '') + ((<RegExp>value).multiline ? 'm' : ''),
}
};
}
return value;
}
......
......@@ -90,7 +90,7 @@ export function dirnames(path: string): { next: () => { done: boolean; value: st
return {
value,
done
}
};
}
return {
next
......
......@@ -18,8 +18,6 @@ export interface IRemoteCom extends IProxyHelper {
registerBigHandler(handler:IManyHandler): void;
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
export function createProxyFromCtor(remote:IProxyHelper, id:string, ctor:Function): any {
var result: any = {
$__IS_REMOTE_OBJ: true
......
......@@ -302,7 +302,7 @@ export function assertRegExp(pattern: string, modifiers: string): void {
export function colorize(code: number, value: string): string {
return '\x1b[' + code + 'm' + value + '\x1b[0m';
};
}
/**
* Returns first index of the string that is not whitespace.
......
......@@ -4,10 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import nls = require('vs/nls');
import Platform = require('vs/base/common/platform');
import EventEmitter = require('vs/base/common/eventEmitter');
import Schedulers = require('vs/base/common/async');
import errors = require('vs/base/common/errors');
import precision = require('vs/base/common/stopwatch');
......
......@@ -194,7 +194,7 @@ export default class URI {
ret._path = match[5] || ret._path;
ret._query = match[7] || ret._query;
ret._fragment = match[9] || ret._fragment;
};
}
URI._validate(ret);
return ret;
}
......@@ -284,7 +284,7 @@ export default class URI {
}
public toJSON(): any {
return <_ISerializedURI> {
return <URIComponents> {
scheme: this.scheme,
authority: this.authority,
path: this.path,
......@@ -298,19 +298,19 @@ export default class URI {
static revive(data: any): URI {
let result = new URI();
result._scheme = (<_ISerializedURI> data).scheme;
result._authority = (<_ISerializedURI> data).authority;
result._path = (<_ISerializedURI> data).path;
result._query = (<_ISerializedURI> data).query;
result._fragment = (<_ISerializedURI> data).fragment;
result._fsPath = (<_ISerializedURI> data).fsPath;
result._formatted = (<_ISerializedURI>data).external;
result._scheme = (<URIComponents> data).scheme;
result._authority = (<URIComponents> data).authority;
result._path = (<URIComponents> data).path;
result._query = (<URIComponents> data).query;
result._fragment = (<URIComponents> data).fragment;
result._fsPath = (<URIComponents> data).fsPath;
result._formatted = (<URIComponents>data).external;
URI._validate(result);
return result;
}
}
interface _ISerializedURI {
interface URIComponents {
$mid: number;
scheme: string;
authority: string;
......
......@@ -302,7 +302,7 @@ let findReferencesCommand: ICommandHandler = (accessor, args) => {
throw new Error('illegal argument, uri');
}
if (!position) {
throw new Error('illega argument, position')
throw new Error('illega argument, position');
}
return accessor.get(IEditorService).openEditor({ resource }).then(editor => {
......@@ -317,7 +317,7 @@ let findReferencesCommand: ICommandHandler = (accessor, args) => {
let range = new Range(position.lineNumber, position.column, position.lineNumber, position.column);
return TPromise.as(controller.processRequest(range, request));
});
}
};
let showReferencesCommand: ICommandHandler = (accessor, args:[URI, EditorCommon.IPosition, Modes.IReference[]]) => {
if (!(args[0] instanceof URI)) {
......
......@@ -75,10 +75,6 @@ export class FilePreview {
this._lineStarts = strings.computeLineStarts(value);
}
private _getOffsetFromPosition(line: number, column: number): number {
return this._lineStarts[line - 1] + column - 1;
}
public preview(range: IRange, n: number = 8): { before: string; inside: string; after: string } {
var lineStart = this._lineStarts[range.startLineNumber - 1],
......
......@@ -128,9 +128,9 @@ export interface CreateSyncFunc {
<A1, A2, A3, A4, A5, A6, A7, A8, T>(ctor:instantiation.INewConstructorSignature8<A1, A2, A3, A4, A5, A6, A7, A8, T>, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7): SyncDescriptor1<A8, T>;
<A1, A2, A3, A4, A5, A6, A7, A8, T>(ctor:instantiation.INewConstructorSignature8<A1, A2, A3, A4, A5, A6, A7, A8, T>, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8): SyncDescriptor0<T>;
}
export var createSyncDescriptor:CreateSyncFunc = <T>(ctor:any, ...staticArguments:any[]): any => {
export var createSyncDescriptor: CreateSyncFunc = <T>(ctor: any, ...staticArguments: any[]): any => {
return new SyncDescriptor<T>(ctor, ...staticArguments);
}
};
export interface SyncDescriptor0<T> {
ctor:any;
......@@ -310,9 +310,9 @@ export interface CreateAsyncFunc8 {
<A1, A2, A3, A4, A5, A6, A7, A8, T>(moduleName:string, ctorName:string): AsyncDescriptor8<A1, A2, A3, A4, A5, A6, A7, A8, T>;
}
var _createAsyncDescriptor = <T>(moduleName:string, ctorName:string, ...staticArguments:any[]): any => {
var _createAsyncDescriptor = <T>(moduleName: string, ctorName: string, ...staticArguments: any[]): any => {
return new AsyncDescriptor<T>(moduleName, ctorName, ...staticArguments);
}
};
export var createAsyncDescriptor0:CreateAsyncFunc0 = _createAsyncDescriptor;
export var createAsyncDescriptor1:CreateAsyncFunc1 = _createAsyncDescriptor;
export var createAsyncDescriptor2:CreateAsyncFunc2 = _createAsyncDescriptor;
......
......@@ -6,8 +6,6 @@
import {SyncDescriptor} from './descriptors';
import {ServiceIdentifier, INewConstructorSignature0} from './instantiation';
import {Graph} from 'vs/base/common/graph';
import {Registry} from 'vs/platform/platform';
export const Services = 'di.services';
......
......@@ -11,7 +11,7 @@ import * as descriptors from './descriptors';
export namespace _util {
export const DI_TARGET = '$di$target'
export const DI_TARGET = '$di$target';
export const DI_DEPENDENCIES = '$di$dependencies';
export const DI_PROVIDES = '$di$provides_service';
......@@ -307,7 +307,7 @@ export function createDecorator<T>(serviceId: string): { (...args: any[]): void;
target[_util.DI_DEPENDENCIES] = [{ serviceId, index }];
target[_util.DI_TARGET] = target;
}
}
};
ret[_util.DI_PROVIDES] = serviceId;
// ret['type'] = undefined;
......
......@@ -154,7 +154,7 @@ class ServicesMap {
let value = instantiation._util.getServiceId(id);
return <T>this[value];
}
}
};
return fn.apply(undefined, [accessor].concat(args));
});
......
......@@ -13,8 +13,7 @@ import Event, {Emitter} from 'vs/base/common/event';
import Severity from 'vs/base/common/severity';
import {IThreadService, IThreadSynchronizableObject} from 'vs/platform/thread/common/thread';
import {MainThreadAttr} from 'vs/platform/thread/common/threadService';
import {IMarkerService, IMarkerData, MarkerType, IResourceMarker, IMarker, MarkerStatistics} from './markers';
import {IMarkerService, IMarkerData, IResourceMarker, IMarker, MarkerStatistics} from './markers';
interface Key {
owner: string;
......@@ -47,7 +46,7 @@ module Key {
}
export interface MarkerData {
[k: string]: IMarkerData[]
[k: string]: IMarkerData[];
}
export class MarkerService implements IMarkerService, IThreadSynchronizableObject<MarkerData> {
......@@ -297,7 +296,7 @@ export class MarkerService implements IMarkerService, IThreadSynchronizableObjec
default:
toUpdate.unknwons++;
break;
};
}
}
private static _sanitize(data: IMarkerData): void {
......
......@@ -20,7 +20,7 @@ export interface IMarkerService {
changeAll(owner: string, data: IResourceMarker[]): void;
remove(owner: string, resources: URI[]): void
remove(owner: string, resources: URI[]): void;
read(filter?: { owner?: string; resource?: URI; selector?: RegExp, take?: number; }): IMarker[];
......
......@@ -17,9 +17,6 @@ import URI from 'vs/base/common/uri';
import { ValidationStatus, ValidationState, ILogger, Parser } from 'vs/base/common/parsers';
import { IStringDictionary } from 'vs/base/common/collections';
import { IPluginDescription } from 'vs/platform/plugins/common/plugins';
import { PluginsRegistry } from 'vs/platform/plugins/common/pluginsRegistry';
import { IMarkerData } from 'vs/platform/markers/common/markers';
export enum FileLocationKind {
......@@ -934,7 +931,7 @@ export class ProblemMatcherParser extends Parser {
if (!(file && message && (location || line))) {
this.status.state = ValidationState.Error;
this.log(NLS.localize('ProblemMatcherParser.problemPattern.missingProperty', 'The problem pattern is invalid. It must have at least a file, message and line or location match group.'));
};
}
}
private addWatchingMatcher(external: Config.ProblemMatcher, internal: ProblemMatcher): void {
......@@ -945,7 +942,7 @@ export class ProblemMatcherParser extends Parser {
activeOnStart: false,
beginsPattern: { regexp: oldBegins },
endsPattern: { regexp: oldEnds }
}
};
return;
}
if (Types.isUndefinedOrNull(external.watching)) {
......@@ -959,7 +956,7 @@ export class ProblemMatcherParser extends Parser {
activeOnStart: Types.isBoolean(watching.activeOnStart) ? watching.activeOnStart : false,
beginsPattern: begins,
endsPattern: ends
}
};
return;
}
if (begins || ends) {
......@@ -1027,16 +1024,16 @@ export class ProblemMatcherRegistry {
*/
}
private onProblemMatcher(json: Config.NamedProblemMatcher): void {
let logger: ILogger = {
log: (message) => { console.warn(message); }
}
let parser = new ProblemMatcherParser(this, logger);
let result = parser.parse(json);
if (isNamedProblemMatcher(result) && parser.status.isOK()) {
this.add(result.name, result);
}
}
// private onProblemMatcher(json: Config.NamedProblemMatcher): void {
// let logger: ILogger = {
// log: (message) => { console.warn(message); }
// }
// let parser = new ProblemMatcherParser(this, logger);
// let result = parser.parse(json);
// if (isNamedProblemMatcher(result) && parser.status.isOK()) {
// this.add(result.name, result);
// }
// }
public add(name: string, matcher: ProblemMatcher): void {
this.matchers[name] = matcher;
......
......@@ -7,8 +7,6 @@
import URI from 'vs/base/common/uri';
import {Event} from 'vs/base/common/events';
import {IEditorSelection} from 'vs/editor/common/editorCommon';
import CommonEvents = require('vs/workbench/common/events');
import {BaseEditor} from 'vs/workbench/browser/parts/editor/baseEditor';
import {IEditor} from 'vs/platform/editor/common/editor';
import {EditorInput, EditorOptions} from 'vs/workbench/common/editor';
import {Position} from 'vs/platform/editor/common/editor';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册