Forbid unused locals/parameters anywhere

This commit is contained in:
Andy Hanson 2016-10-19 08:27:49 -07:00
parent db0ee4f763
commit 6814c1d883
71 changed files with 60352 additions and 59524 deletions

View file

@ -448,7 +448,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
options += " --stripInternal";
}
options += " --target es5";
options += " --target es5 --noUnusedLocals --noUnusedParameters";
var cmd = host + " " + compilerPath + " " + options + " ";
cmd = cmd + sources.join(" ");

View file

@ -39,3 +39,5 @@ function createCancellationToken(args) {
};
}
module.exports = createCancellationToken;
//# sourceMappingURL=cancellationToken.js.map

12
lib/lib.d.ts vendored
View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// ECMAScript APIs
/////////////////////////////
@ -4149,6 +4153,8 @@ interface Date {
*/
toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
}
/////////////////////////////
/// IE DOM APIs
@ -18774,12 +18780,16 @@ type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
type MouseWheelEvent = WheelEvent;
type ScrollRestoration = "auto" | "manual";
type ScrollRestoration = "auto" | "manual";
/////////////////////////////
/// WorkerGlobalScope APIs
/////////////////////////////
// These are only available in a Web Worker
declare function importScripts(...urls: string[]): void;
/////////////////////////////

4
lib/lib.dom.d.ts vendored
View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// IE DOM APIs

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference path="lib.dom.d.ts" />
interface DOMTokenList {

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare type PropertyKey = string | number | symbol;
interface Array<T> {

4
lib/lib.es2015.d.ts vendored
View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference path="lib.es2015.core.d.ts" />
/// <reference path="lib.es2015.collection.d.ts" />
/// <reference path="lib.es2015.generator.d.ts" />

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface GeneratorFunction extends Function { }
interface GeneratorFunctionConstructor {

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference path="lib.es2015.symbol.d.ts" />
interface SymbolConstructor {

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/**
* Represents the completion of an asynchronous operation
*/

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface ProxyHandler<T> {
getPrototypeOf? (target: T): any;
setPrototypeOf? (target: T, v: any): boolean;

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
function construct(target: Function, argumentsList: ArrayLike<any>, newTarget?: any): any;

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Symbol {
/** Returns a string representation of an object. */
toString(): string;

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference path="lib.es2015.symbol.d.ts" />
interface SymbolConstructor {

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Array<T> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.

4
lib/lib.es2016.d.ts vendored
View file

@ -13,6 +13,10 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference path="lib.es2015.d.ts" />
/// <reference path="lib.es2016.array.include.d.ts" />

4
lib/lib.es2017.d.ts vendored
View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference path="lib.es2016.d.ts" />
/// <reference path="lib.es2017.object.d.ts" />
/// <reference path="lib.es2017.sharedmemory.d.ts" />

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface ObjectConstructor {
/**
* Returns an array of values of the enumerable properties of an object

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference path="lib.es2015.symbol.d.ts" />
/// <reference path="lib.es2015.symbol.wellknown.d.ts" />

4
lib/lib.es5.d.ts vendored
View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// ECMAScript APIs
/////////////////////////////

44
lib/lib.es6.d.ts vendored
View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// ECMAScript APIs
/////////////////////////////
@ -4149,6 +4153,8 @@ interface Date {
*/
toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
}
declare type PropertyKey = string | number | symbol;
interface Array<T> {
@ -4673,6 +4679,8 @@ interface StringConstructor {
*/
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
}
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;
@ -4745,6 +4753,8 @@ interface WeakSetConstructor {
readonly prototype: WeakSet<any>;
}
declare var WeakSet: WeakSetConstructor;
interface GeneratorFunction extends Function { }
interface GeneratorFunctionConstructor {
@ -4757,6 +4767,8 @@ interface GeneratorFunctionConstructor {
readonly prototype: GeneratorFunction;
}
declare var GeneratorFunction: GeneratorFunctionConstructor;
/// <reference path="lib.es2015.symbol.d.ts" />
interface SymbolConstructor {
@ -5201,7 +5213,9 @@ interface Float64ArrayConstructor {
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
}/**
}
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> {
@ -5454,7 +5468,9 @@ interface PromiseConstructor {
resolve(): Promise<void>;
}
declare var Promise: PromiseConstructor;interface ProxyHandler<T> {
declare var Promise: PromiseConstructor;
interface ProxyHandler<T> {
getPrototypeOf? (target: T): any;
setPrototypeOf? (target: T, v: any): boolean;
isExtensible? (target: T): boolean;
@ -5475,7 +5491,9 @@ interface ProxyConstructor {
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
new <T>(target: T, handler: ProxyHandler<T>): T
}
declare var Proxy: ProxyConstructor;declare namespace Reflect {
declare var Proxy: ProxyConstructor;
declare namespace Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
function construct(target: Function, argumentsList: ArrayLike<any>, newTarget?: any): any;
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
@ -5489,7 +5507,9 @@ declare var Proxy: ProxyConstructor;declare namespace Reflect {
function preventExtensions(target: any): boolean;
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
function setPrototypeOf(target: any, proto: any): boolean;
}interface Symbol {
}
interface Symbol {
/** Returns a string representation of an object. */
toString(): string;
@ -5524,7 +5544,9 @@ interface SymbolConstructor {
keyFor(sym: symbol): string | undefined;
}
declare var Symbol: SymbolConstructor;/// <reference path="lib.es2015.symbol.d.ts" />
declare var Symbol: SymbolConstructor;
/// <reference path="lib.es2015.symbol.d.ts" />
interface SymbolConstructor {
/**
@ -5850,7 +5872,9 @@ interface Float32Array {
*/
interface Float64Array {
readonly [Symbol.toStringTag]: "Float64Array";
}
}
/////////////////////////////
/// IE DOM APIs
/////////////////////////////
@ -20475,12 +20499,16 @@ type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
type MouseWheelEvent = WheelEvent;
type ScrollRestoration = "auto" | "manual";
type ScrollRestoration = "auto" | "manual";
/////////////////////////////
/// WorkerGlobalScope APIs
/////////////////////////////
// These are only available in a Web Worker
declare function importScripts(...urls: string[]): void;
/////////////////////////////
@ -20772,6 +20800,8 @@ interface DateConstructor {
interface Date {
getVarDate: () => VarDate;
}
/// <reference path="lib.dom.d.ts" />
interface DOMTokenList {

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////

View file

@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// IE Worker APIs

17056
lib/tsc.js

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

9338
lib/tsserverlibrary.d.ts vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

528
lib/typescript.d.ts vendored
View file

@ -47,241 +47,241 @@ declare namespace ts {
ConflictMarkerTrivia = 7,
NumericLiteral = 8,
StringLiteral = 9,
RegularExpressionLiteral = 10,
NoSubstitutionTemplateLiteral = 11,
TemplateHead = 12,
TemplateMiddle = 13,
TemplateTail = 14,
OpenBraceToken = 15,
CloseBraceToken = 16,
OpenParenToken = 17,
CloseParenToken = 18,
OpenBracketToken = 19,
CloseBracketToken = 20,
DotToken = 21,
DotDotDotToken = 22,
SemicolonToken = 23,
CommaToken = 24,
LessThanToken = 25,
LessThanSlashToken = 26,
GreaterThanToken = 27,
LessThanEqualsToken = 28,
GreaterThanEqualsToken = 29,
EqualsEqualsToken = 30,
ExclamationEqualsToken = 31,
EqualsEqualsEqualsToken = 32,
ExclamationEqualsEqualsToken = 33,
EqualsGreaterThanToken = 34,
PlusToken = 35,
MinusToken = 36,
AsteriskToken = 37,
AsteriskAsteriskToken = 38,
SlashToken = 39,
PercentToken = 40,
PlusPlusToken = 41,
MinusMinusToken = 42,
LessThanLessThanToken = 43,
GreaterThanGreaterThanToken = 44,
GreaterThanGreaterThanGreaterThanToken = 45,
AmpersandToken = 46,
BarToken = 47,
CaretToken = 48,
ExclamationToken = 49,
TildeToken = 50,
AmpersandAmpersandToken = 51,
BarBarToken = 52,
QuestionToken = 53,
ColonToken = 54,
AtToken = 55,
EqualsToken = 56,
PlusEqualsToken = 57,
MinusEqualsToken = 58,
AsteriskEqualsToken = 59,
AsteriskAsteriskEqualsToken = 60,
SlashEqualsToken = 61,
PercentEqualsToken = 62,
LessThanLessThanEqualsToken = 63,
GreaterThanGreaterThanEqualsToken = 64,
GreaterThanGreaterThanGreaterThanEqualsToken = 65,
AmpersandEqualsToken = 66,
BarEqualsToken = 67,
CaretEqualsToken = 68,
Identifier = 69,
BreakKeyword = 70,
CaseKeyword = 71,
CatchKeyword = 72,
ClassKeyword = 73,
ConstKeyword = 74,
ContinueKeyword = 75,
DebuggerKeyword = 76,
DefaultKeyword = 77,
DeleteKeyword = 78,
DoKeyword = 79,
ElseKeyword = 80,
EnumKeyword = 81,
ExportKeyword = 82,
ExtendsKeyword = 83,
FalseKeyword = 84,
FinallyKeyword = 85,
ForKeyword = 86,
FunctionKeyword = 87,
IfKeyword = 88,
ImportKeyword = 89,
InKeyword = 90,
InstanceOfKeyword = 91,
NewKeyword = 92,
NullKeyword = 93,
ReturnKeyword = 94,
SuperKeyword = 95,
SwitchKeyword = 96,
ThisKeyword = 97,
ThrowKeyword = 98,
TrueKeyword = 99,
TryKeyword = 100,
TypeOfKeyword = 101,
VarKeyword = 102,
VoidKeyword = 103,
WhileKeyword = 104,
WithKeyword = 105,
ImplementsKeyword = 106,
InterfaceKeyword = 107,
LetKeyword = 108,
PackageKeyword = 109,
PrivateKeyword = 110,
ProtectedKeyword = 111,
PublicKeyword = 112,
StaticKeyword = 113,
YieldKeyword = 114,
AbstractKeyword = 115,
AsKeyword = 116,
AnyKeyword = 117,
AsyncKeyword = 118,
AwaitKeyword = 119,
BooleanKeyword = 120,
ConstructorKeyword = 121,
DeclareKeyword = 122,
GetKeyword = 123,
IsKeyword = 124,
ModuleKeyword = 125,
NamespaceKeyword = 126,
NeverKeyword = 127,
ReadonlyKeyword = 128,
RequireKeyword = 129,
NumberKeyword = 130,
SetKeyword = 131,
StringKeyword = 132,
SymbolKeyword = 133,
TypeKeyword = 134,
UndefinedKeyword = 135,
FromKeyword = 136,
GlobalKeyword = 137,
OfKeyword = 138,
QualifiedName = 139,
ComputedPropertyName = 140,
TypeParameter = 141,
Parameter = 142,
Decorator = 143,
PropertySignature = 144,
PropertyDeclaration = 145,
MethodSignature = 146,
MethodDeclaration = 147,
Constructor = 148,
GetAccessor = 149,
SetAccessor = 150,
CallSignature = 151,
ConstructSignature = 152,
IndexSignature = 153,
TypePredicate = 154,
TypeReference = 155,
FunctionType = 156,
ConstructorType = 157,
TypeQuery = 158,
TypeLiteral = 159,
ArrayType = 160,
TupleType = 161,
UnionType = 162,
IntersectionType = 163,
ParenthesizedType = 164,
ThisType = 165,
LiteralType = 166,
ObjectBindingPattern = 167,
ArrayBindingPattern = 168,
BindingElement = 169,
ArrayLiteralExpression = 170,
ObjectLiteralExpression = 171,
PropertyAccessExpression = 172,
ElementAccessExpression = 173,
CallExpression = 174,
NewExpression = 175,
TaggedTemplateExpression = 176,
TypeAssertionExpression = 177,
ParenthesizedExpression = 178,
FunctionExpression = 179,
ArrowFunction = 180,
DeleteExpression = 181,
TypeOfExpression = 182,
VoidExpression = 183,
AwaitExpression = 184,
PrefixUnaryExpression = 185,
PostfixUnaryExpression = 186,
BinaryExpression = 187,
ConditionalExpression = 188,
TemplateExpression = 189,
YieldExpression = 190,
SpreadElementExpression = 191,
ClassExpression = 192,
OmittedExpression = 193,
ExpressionWithTypeArguments = 194,
AsExpression = 195,
NonNullExpression = 196,
TemplateSpan = 197,
SemicolonClassElement = 198,
Block = 199,
VariableStatement = 200,
EmptyStatement = 201,
ExpressionStatement = 202,
IfStatement = 203,
DoStatement = 204,
WhileStatement = 205,
ForStatement = 206,
ForInStatement = 207,
ForOfStatement = 208,
ContinueStatement = 209,
BreakStatement = 210,
ReturnStatement = 211,
WithStatement = 212,
SwitchStatement = 213,
LabeledStatement = 214,
ThrowStatement = 215,
TryStatement = 216,
DebuggerStatement = 217,
VariableDeclaration = 218,
VariableDeclarationList = 219,
FunctionDeclaration = 220,
ClassDeclaration = 221,
InterfaceDeclaration = 222,
TypeAliasDeclaration = 223,
EnumDeclaration = 224,
ModuleDeclaration = 225,
ModuleBlock = 226,
CaseBlock = 227,
NamespaceExportDeclaration = 228,
ImportEqualsDeclaration = 229,
ImportDeclaration = 230,
ImportClause = 231,
NamespaceImport = 232,
NamedImports = 233,
ImportSpecifier = 234,
ExportAssignment = 235,
ExportDeclaration = 236,
NamedExports = 237,
ExportSpecifier = 238,
MissingDeclaration = 239,
ExternalModuleReference = 240,
JsxElement = 241,
JsxSelfClosingElement = 242,
JsxOpeningElement = 243,
JsxText = 244,
JsxText = 10,
RegularExpressionLiteral = 11,
NoSubstitutionTemplateLiteral = 12,
TemplateHead = 13,
TemplateMiddle = 14,
TemplateTail = 15,
OpenBraceToken = 16,
CloseBraceToken = 17,
OpenParenToken = 18,
CloseParenToken = 19,
OpenBracketToken = 20,
CloseBracketToken = 21,
DotToken = 22,
DotDotDotToken = 23,
SemicolonToken = 24,
CommaToken = 25,
LessThanToken = 26,
LessThanSlashToken = 27,
GreaterThanToken = 28,
LessThanEqualsToken = 29,
GreaterThanEqualsToken = 30,
EqualsEqualsToken = 31,
ExclamationEqualsToken = 32,
EqualsEqualsEqualsToken = 33,
ExclamationEqualsEqualsToken = 34,
EqualsGreaterThanToken = 35,
PlusToken = 36,
MinusToken = 37,
AsteriskToken = 38,
AsteriskAsteriskToken = 39,
SlashToken = 40,
PercentToken = 41,
PlusPlusToken = 42,
MinusMinusToken = 43,
LessThanLessThanToken = 44,
GreaterThanGreaterThanToken = 45,
GreaterThanGreaterThanGreaterThanToken = 46,
AmpersandToken = 47,
BarToken = 48,
CaretToken = 49,
ExclamationToken = 50,
TildeToken = 51,
AmpersandAmpersandToken = 52,
BarBarToken = 53,
QuestionToken = 54,
ColonToken = 55,
AtToken = 56,
EqualsToken = 57,
PlusEqualsToken = 58,
MinusEqualsToken = 59,
AsteriskEqualsToken = 60,
AsteriskAsteriskEqualsToken = 61,
SlashEqualsToken = 62,
PercentEqualsToken = 63,
LessThanLessThanEqualsToken = 64,
GreaterThanGreaterThanEqualsToken = 65,
GreaterThanGreaterThanGreaterThanEqualsToken = 66,
AmpersandEqualsToken = 67,
BarEqualsToken = 68,
CaretEqualsToken = 69,
Identifier = 70,
BreakKeyword = 71,
CaseKeyword = 72,
CatchKeyword = 73,
ClassKeyword = 74,
ConstKeyword = 75,
ContinueKeyword = 76,
DebuggerKeyword = 77,
DefaultKeyword = 78,
DeleteKeyword = 79,
DoKeyword = 80,
ElseKeyword = 81,
EnumKeyword = 82,
ExportKeyword = 83,
ExtendsKeyword = 84,
FalseKeyword = 85,
FinallyKeyword = 86,
ForKeyword = 87,
FunctionKeyword = 88,
IfKeyword = 89,
ImportKeyword = 90,
InKeyword = 91,
InstanceOfKeyword = 92,
NewKeyword = 93,
NullKeyword = 94,
ReturnKeyword = 95,
SuperKeyword = 96,
SwitchKeyword = 97,
ThisKeyword = 98,
ThrowKeyword = 99,
TrueKeyword = 100,
TryKeyword = 101,
TypeOfKeyword = 102,
VarKeyword = 103,
VoidKeyword = 104,
WhileKeyword = 105,
WithKeyword = 106,
ImplementsKeyword = 107,
InterfaceKeyword = 108,
LetKeyword = 109,
PackageKeyword = 110,
PrivateKeyword = 111,
ProtectedKeyword = 112,
PublicKeyword = 113,
StaticKeyword = 114,
YieldKeyword = 115,
AbstractKeyword = 116,
AsKeyword = 117,
AnyKeyword = 118,
AsyncKeyword = 119,
AwaitKeyword = 120,
BooleanKeyword = 121,
ConstructorKeyword = 122,
DeclareKeyword = 123,
GetKeyword = 124,
IsKeyword = 125,
ModuleKeyword = 126,
NamespaceKeyword = 127,
NeverKeyword = 128,
ReadonlyKeyword = 129,
RequireKeyword = 130,
NumberKeyword = 131,
SetKeyword = 132,
StringKeyword = 133,
SymbolKeyword = 134,
TypeKeyword = 135,
UndefinedKeyword = 136,
FromKeyword = 137,
GlobalKeyword = 138,
OfKeyword = 139,
QualifiedName = 140,
ComputedPropertyName = 141,
TypeParameter = 142,
Parameter = 143,
Decorator = 144,
PropertySignature = 145,
PropertyDeclaration = 146,
MethodSignature = 147,
MethodDeclaration = 148,
Constructor = 149,
GetAccessor = 150,
SetAccessor = 151,
CallSignature = 152,
ConstructSignature = 153,
IndexSignature = 154,
TypePredicate = 155,
TypeReference = 156,
FunctionType = 157,
ConstructorType = 158,
TypeQuery = 159,
TypeLiteral = 160,
ArrayType = 161,
TupleType = 162,
UnionType = 163,
IntersectionType = 164,
ParenthesizedType = 165,
ThisType = 166,
LiteralType = 167,
ObjectBindingPattern = 168,
ArrayBindingPattern = 169,
BindingElement = 170,
ArrayLiteralExpression = 171,
ObjectLiteralExpression = 172,
PropertyAccessExpression = 173,
ElementAccessExpression = 174,
CallExpression = 175,
NewExpression = 176,
TaggedTemplateExpression = 177,
TypeAssertionExpression = 178,
ParenthesizedExpression = 179,
FunctionExpression = 180,
ArrowFunction = 181,
DeleteExpression = 182,
TypeOfExpression = 183,
VoidExpression = 184,
AwaitExpression = 185,
PrefixUnaryExpression = 186,
PostfixUnaryExpression = 187,
BinaryExpression = 188,
ConditionalExpression = 189,
TemplateExpression = 190,
YieldExpression = 191,
SpreadElementExpression = 192,
ClassExpression = 193,
OmittedExpression = 194,
ExpressionWithTypeArguments = 195,
AsExpression = 196,
NonNullExpression = 197,
TemplateSpan = 198,
SemicolonClassElement = 199,
Block = 200,
VariableStatement = 201,
EmptyStatement = 202,
ExpressionStatement = 203,
IfStatement = 204,
DoStatement = 205,
WhileStatement = 206,
ForStatement = 207,
ForInStatement = 208,
ForOfStatement = 209,
ContinueStatement = 210,
BreakStatement = 211,
ReturnStatement = 212,
WithStatement = 213,
SwitchStatement = 214,
LabeledStatement = 215,
ThrowStatement = 216,
TryStatement = 217,
DebuggerStatement = 218,
VariableDeclaration = 219,
VariableDeclarationList = 220,
FunctionDeclaration = 221,
ClassDeclaration = 222,
InterfaceDeclaration = 223,
TypeAliasDeclaration = 224,
EnumDeclaration = 225,
ModuleDeclaration = 226,
ModuleBlock = 227,
CaseBlock = 228,
NamespaceExportDeclaration = 229,
ImportEqualsDeclaration = 230,
ImportDeclaration = 231,
ImportClause = 232,
NamespaceImport = 233,
NamedImports = 234,
ImportSpecifier = 235,
ExportAssignment = 236,
ExportDeclaration = 237,
NamedExports = 238,
ExportSpecifier = 239,
MissingDeclaration = 240,
ExternalModuleReference = 241,
JsxElement = 242,
JsxSelfClosingElement = 243,
JsxOpeningElement = 244,
JsxClosingElement = 245,
JsxAttribute = 246,
JsxSpreadAttribute = 247,
@ -327,31 +327,31 @@ declare namespace ts {
NotEmittedStatement = 287,
PartiallyEmittedExpression = 288,
Count = 289,
FirstAssignment = 56,
LastAssignment = 68,
FirstCompoundAssignment = 57,
LastCompoundAssignment = 68,
FirstReservedWord = 70,
LastReservedWord = 105,
FirstKeyword = 70,
LastKeyword = 138,
FirstFutureReservedWord = 106,
LastFutureReservedWord = 114,
FirstTypeNode = 154,
LastTypeNode = 166,
FirstPunctuation = 15,
LastPunctuation = 68,
FirstAssignment = 57,
LastAssignment = 69,
FirstCompoundAssignment = 58,
LastCompoundAssignment = 69,
FirstReservedWord = 71,
LastReservedWord = 106,
FirstKeyword = 71,
LastKeyword = 139,
FirstFutureReservedWord = 107,
LastFutureReservedWord = 115,
FirstTypeNode = 155,
LastTypeNode = 167,
FirstPunctuation = 16,
LastPunctuation = 69,
FirstToken = 0,
LastToken = 138,
LastToken = 139,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
LastLiteralToken = 11,
FirstTemplateToken = 11,
LastTemplateToken = 14,
FirstBinaryOperator = 25,
LastBinaryOperator = 68,
FirstNode = 139,
LastLiteralToken = 12,
FirstTemplateToken = 12,
LastTemplateToken = 15,
FirstBinaryOperator = 26,
LastBinaryOperator = 69,
FirstNode = 140,
FirstJSDocNode = 257,
LastJSDocNode = 282,
FirstJSDocTagNode = 273,
@ -406,6 +406,7 @@ declare namespace ts {
AccessibilityModifier = 28,
ParameterPropertyModifier = 92,
NonPublicAccessibilityModifier = 24,
TypeScriptModifier = 2270,
}
enum JsxFlags {
None = 0,
@ -1351,8 +1352,9 @@ declare namespace ts {
TrueCondition = 32,
FalseCondition = 64,
SwitchClause = 128,
Referenced = 256,
Shared = 512,
ArrayMutation = 256,
Referenced = 512,
Shared = 1024,
Label = 12,
Condition = 96,
}
@ -1380,6 +1382,10 @@ declare namespace ts {
clauseEnd: number;
antecedent: FlowNode;
}
interface FlowArrayMutation extends FlowNode {
node: CallExpression | BinaryExpression;
antecedent: FlowNode;
}
type FlowType = Type | IncompleteType;
interface IncompleteType {
flags: TypeFlags;
@ -1913,7 +1919,6 @@ declare namespace ts {
AMD = 2,
UMD = 3,
System = 4,
ES6 = 5,
ES2015 = 5,
}
enum JsxEmit {
@ -1939,9 +1944,10 @@ declare namespace ts {
enum ScriptTarget {
ES3 = 0,
ES5 = 1,
ES6 = 2,
ES2015 = 2,
Latest = 2,
ES2016 = 3,
ES2017 = 4,
Latest = 4,
}
enum LanguageVariant {
Standard = 0,

File diff suppressed because it is too large Load diff

View file

@ -47,241 +47,241 @@ declare namespace ts {
ConflictMarkerTrivia = 7,
NumericLiteral = 8,
StringLiteral = 9,
RegularExpressionLiteral = 10,
NoSubstitutionTemplateLiteral = 11,
TemplateHead = 12,
TemplateMiddle = 13,
TemplateTail = 14,
OpenBraceToken = 15,
CloseBraceToken = 16,
OpenParenToken = 17,
CloseParenToken = 18,
OpenBracketToken = 19,
CloseBracketToken = 20,
DotToken = 21,
DotDotDotToken = 22,
SemicolonToken = 23,
CommaToken = 24,
LessThanToken = 25,
LessThanSlashToken = 26,
GreaterThanToken = 27,
LessThanEqualsToken = 28,
GreaterThanEqualsToken = 29,
EqualsEqualsToken = 30,
ExclamationEqualsToken = 31,
EqualsEqualsEqualsToken = 32,
ExclamationEqualsEqualsToken = 33,
EqualsGreaterThanToken = 34,
PlusToken = 35,
MinusToken = 36,
AsteriskToken = 37,
AsteriskAsteriskToken = 38,
SlashToken = 39,
PercentToken = 40,
PlusPlusToken = 41,
MinusMinusToken = 42,
LessThanLessThanToken = 43,
GreaterThanGreaterThanToken = 44,
GreaterThanGreaterThanGreaterThanToken = 45,
AmpersandToken = 46,
BarToken = 47,
CaretToken = 48,
ExclamationToken = 49,
TildeToken = 50,
AmpersandAmpersandToken = 51,
BarBarToken = 52,
QuestionToken = 53,
ColonToken = 54,
AtToken = 55,
EqualsToken = 56,
PlusEqualsToken = 57,
MinusEqualsToken = 58,
AsteriskEqualsToken = 59,
AsteriskAsteriskEqualsToken = 60,
SlashEqualsToken = 61,
PercentEqualsToken = 62,
LessThanLessThanEqualsToken = 63,
GreaterThanGreaterThanEqualsToken = 64,
GreaterThanGreaterThanGreaterThanEqualsToken = 65,
AmpersandEqualsToken = 66,
BarEqualsToken = 67,
CaretEqualsToken = 68,
Identifier = 69,
BreakKeyword = 70,
CaseKeyword = 71,
CatchKeyword = 72,
ClassKeyword = 73,
ConstKeyword = 74,
ContinueKeyword = 75,
DebuggerKeyword = 76,
DefaultKeyword = 77,
DeleteKeyword = 78,
DoKeyword = 79,
ElseKeyword = 80,
EnumKeyword = 81,
ExportKeyword = 82,
ExtendsKeyword = 83,
FalseKeyword = 84,
FinallyKeyword = 85,
ForKeyword = 86,
FunctionKeyword = 87,
IfKeyword = 88,
ImportKeyword = 89,
InKeyword = 90,
InstanceOfKeyword = 91,
NewKeyword = 92,
NullKeyword = 93,
ReturnKeyword = 94,
SuperKeyword = 95,
SwitchKeyword = 96,
ThisKeyword = 97,
ThrowKeyword = 98,
TrueKeyword = 99,
TryKeyword = 100,
TypeOfKeyword = 101,
VarKeyword = 102,
VoidKeyword = 103,
WhileKeyword = 104,
WithKeyword = 105,
ImplementsKeyword = 106,
InterfaceKeyword = 107,
LetKeyword = 108,
PackageKeyword = 109,
PrivateKeyword = 110,
ProtectedKeyword = 111,
PublicKeyword = 112,
StaticKeyword = 113,
YieldKeyword = 114,
AbstractKeyword = 115,
AsKeyword = 116,
AnyKeyword = 117,
AsyncKeyword = 118,
AwaitKeyword = 119,
BooleanKeyword = 120,
ConstructorKeyword = 121,
DeclareKeyword = 122,
GetKeyword = 123,
IsKeyword = 124,
ModuleKeyword = 125,
NamespaceKeyword = 126,
NeverKeyword = 127,
ReadonlyKeyword = 128,
RequireKeyword = 129,
NumberKeyword = 130,
SetKeyword = 131,
StringKeyword = 132,
SymbolKeyword = 133,
TypeKeyword = 134,
UndefinedKeyword = 135,
FromKeyword = 136,
GlobalKeyword = 137,
OfKeyword = 138,
QualifiedName = 139,
ComputedPropertyName = 140,
TypeParameter = 141,
Parameter = 142,
Decorator = 143,
PropertySignature = 144,
PropertyDeclaration = 145,
MethodSignature = 146,
MethodDeclaration = 147,
Constructor = 148,
GetAccessor = 149,
SetAccessor = 150,
CallSignature = 151,
ConstructSignature = 152,
IndexSignature = 153,
TypePredicate = 154,
TypeReference = 155,
FunctionType = 156,
ConstructorType = 157,
TypeQuery = 158,
TypeLiteral = 159,
ArrayType = 160,
TupleType = 161,
UnionType = 162,
IntersectionType = 163,
ParenthesizedType = 164,
ThisType = 165,
LiteralType = 166,
ObjectBindingPattern = 167,
ArrayBindingPattern = 168,
BindingElement = 169,
ArrayLiteralExpression = 170,
ObjectLiteralExpression = 171,
PropertyAccessExpression = 172,
ElementAccessExpression = 173,
CallExpression = 174,
NewExpression = 175,
TaggedTemplateExpression = 176,
TypeAssertionExpression = 177,
ParenthesizedExpression = 178,
FunctionExpression = 179,
ArrowFunction = 180,
DeleteExpression = 181,
TypeOfExpression = 182,
VoidExpression = 183,
AwaitExpression = 184,
PrefixUnaryExpression = 185,
PostfixUnaryExpression = 186,
BinaryExpression = 187,
ConditionalExpression = 188,
TemplateExpression = 189,
YieldExpression = 190,
SpreadElementExpression = 191,
ClassExpression = 192,
OmittedExpression = 193,
ExpressionWithTypeArguments = 194,
AsExpression = 195,
NonNullExpression = 196,
TemplateSpan = 197,
SemicolonClassElement = 198,
Block = 199,
VariableStatement = 200,
EmptyStatement = 201,
ExpressionStatement = 202,
IfStatement = 203,
DoStatement = 204,
WhileStatement = 205,
ForStatement = 206,
ForInStatement = 207,
ForOfStatement = 208,
ContinueStatement = 209,
BreakStatement = 210,
ReturnStatement = 211,
WithStatement = 212,
SwitchStatement = 213,
LabeledStatement = 214,
ThrowStatement = 215,
TryStatement = 216,
DebuggerStatement = 217,
VariableDeclaration = 218,
VariableDeclarationList = 219,
FunctionDeclaration = 220,
ClassDeclaration = 221,
InterfaceDeclaration = 222,
TypeAliasDeclaration = 223,
EnumDeclaration = 224,
ModuleDeclaration = 225,
ModuleBlock = 226,
CaseBlock = 227,
NamespaceExportDeclaration = 228,
ImportEqualsDeclaration = 229,
ImportDeclaration = 230,
ImportClause = 231,
NamespaceImport = 232,
NamedImports = 233,
ImportSpecifier = 234,
ExportAssignment = 235,
ExportDeclaration = 236,
NamedExports = 237,
ExportSpecifier = 238,
MissingDeclaration = 239,
ExternalModuleReference = 240,
JsxElement = 241,
JsxSelfClosingElement = 242,
JsxOpeningElement = 243,
JsxText = 244,
JsxText = 10,
RegularExpressionLiteral = 11,
NoSubstitutionTemplateLiteral = 12,
TemplateHead = 13,
TemplateMiddle = 14,
TemplateTail = 15,
OpenBraceToken = 16,
CloseBraceToken = 17,
OpenParenToken = 18,
CloseParenToken = 19,
OpenBracketToken = 20,
CloseBracketToken = 21,
DotToken = 22,
DotDotDotToken = 23,
SemicolonToken = 24,
CommaToken = 25,
LessThanToken = 26,
LessThanSlashToken = 27,
GreaterThanToken = 28,
LessThanEqualsToken = 29,
GreaterThanEqualsToken = 30,
EqualsEqualsToken = 31,
ExclamationEqualsToken = 32,
EqualsEqualsEqualsToken = 33,
ExclamationEqualsEqualsToken = 34,
EqualsGreaterThanToken = 35,
PlusToken = 36,
MinusToken = 37,
AsteriskToken = 38,
AsteriskAsteriskToken = 39,
SlashToken = 40,
PercentToken = 41,
PlusPlusToken = 42,
MinusMinusToken = 43,
LessThanLessThanToken = 44,
GreaterThanGreaterThanToken = 45,
GreaterThanGreaterThanGreaterThanToken = 46,
AmpersandToken = 47,
BarToken = 48,
CaretToken = 49,
ExclamationToken = 50,
TildeToken = 51,
AmpersandAmpersandToken = 52,
BarBarToken = 53,
QuestionToken = 54,
ColonToken = 55,
AtToken = 56,
EqualsToken = 57,
PlusEqualsToken = 58,
MinusEqualsToken = 59,
AsteriskEqualsToken = 60,
AsteriskAsteriskEqualsToken = 61,
SlashEqualsToken = 62,
PercentEqualsToken = 63,
LessThanLessThanEqualsToken = 64,
GreaterThanGreaterThanEqualsToken = 65,
GreaterThanGreaterThanGreaterThanEqualsToken = 66,
AmpersandEqualsToken = 67,
BarEqualsToken = 68,
CaretEqualsToken = 69,
Identifier = 70,
BreakKeyword = 71,
CaseKeyword = 72,
CatchKeyword = 73,
ClassKeyword = 74,
ConstKeyword = 75,
ContinueKeyword = 76,
DebuggerKeyword = 77,
DefaultKeyword = 78,
DeleteKeyword = 79,
DoKeyword = 80,
ElseKeyword = 81,
EnumKeyword = 82,
ExportKeyword = 83,
ExtendsKeyword = 84,
FalseKeyword = 85,
FinallyKeyword = 86,
ForKeyword = 87,
FunctionKeyword = 88,
IfKeyword = 89,
ImportKeyword = 90,
InKeyword = 91,
InstanceOfKeyword = 92,
NewKeyword = 93,
NullKeyword = 94,
ReturnKeyword = 95,
SuperKeyword = 96,
SwitchKeyword = 97,
ThisKeyword = 98,
ThrowKeyword = 99,
TrueKeyword = 100,
TryKeyword = 101,
TypeOfKeyword = 102,
VarKeyword = 103,
VoidKeyword = 104,
WhileKeyword = 105,
WithKeyword = 106,
ImplementsKeyword = 107,
InterfaceKeyword = 108,
LetKeyword = 109,
PackageKeyword = 110,
PrivateKeyword = 111,
ProtectedKeyword = 112,
PublicKeyword = 113,
StaticKeyword = 114,
YieldKeyword = 115,
AbstractKeyword = 116,
AsKeyword = 117,
AnyKeyword = 118,
AsyncKeyword = 119,
AwaitKeyword = 120,
BooleanKeyword = 121,
ConstructorKeyword = 122,
DeclareKeyword = 123,
GetKeyword = 124,
IsKeyword = 125,
ModuleKeyword = 126,
NamespaceKeyword = 127,
NeverKeyword = 128,
ReadonlyKeyword = 129,
RequireKeyword = 130,
NumberKeyword = 131,
SetKeyword = 132,
StringKeyword = 133,
SymbolKeyword = 134,
TypeKeyword = 135,
UndefinedKeyword = 136,
FromKeyword = 137,
GlobalKeyword = 138,
OfKeyword = 139,
QualifiedName = 140,
ComputedPropertyName = 141,
TypeParameter = 142,
Parameter = 143,
Decorator = 144,
PropertySignature = 145,
PropertyDeclaration = 146,
MethodSignature = 147,
MethodDeclaration = 148,
Constructor = 149,
GetAccessor = 150,
SetAccessor = 151,
CallSignature = 152,
ConstructSignature = 153,
IndexSignature = 154,
TypePredicate = 155,
TypeReference = 156,
FunctionType = 157,
ConstructorType = 158,
TypeQuery = 159,
TypeLiteral = 160,
ArrayType = 161,
TupleType = 162,
UnionType = 163,
IntersectionType = 164,
ParenthesizedType = 165,
ThisType = 166,
LiteralType = 167,
ObjectBindingPattern = 168,
ArrayBindingPattern = 169,
BindingElement = 170,
ArrayLiteralExpression = 171,
ObjectLiteralExpression = 172,
PropertyAccessExpression = 173,
ElementAccessExpression = 174,
CallExpression = 175,
NewExpression = 176,
TaggedTemplateExpression = 177,
TypeAssertionExpression = 178,
ParenthesizedExpression = 179,
FunctionExpression = 180,
ArrowFunction = 181,
DeleteExpression = 182,
TypeOfExpression = 183,
VoidExpression = 184,
AwaitExpression = 185,
PrefixUnaryExpression = 186,
PostfixUnaryExpression = 187,
BinaryExpression = 188,
ConditionalExpression = 189,
TemplateExpression = 190,
YieldExpression = 191,
SpreadElementExpression = 192,
ClassExpression = 193,
OmittedExpression = 194,
ExpressionWithTypeArguments = 195,
AsExpression = 196,
NonNullExpression = 197,
TemplateSpan = 198,
SemicolonClassElement = 199,
Block = 200,
VariableStatement = 201,
EmptyStatement = 202,
ExpressionStatement = 203,
IfStatement = 204,
DoStatement = 205,
WhileStatement = 206,
ForStatement = 207,
ForInStatement = 208,
ForOfStatement = 209,
ContinueStatement = 210,
BreakStatement = 211,
ReturnStatement = 212,
WithStatement = 213,
SwitchStatement = 214,
LabeledStatement = 215,
ThrowStatement = 216,
TryStatement = 217,
DebuggerStatement = 218,
VariableDeclaration = 219,
VariableDeclarationList = 220,
FunctionDeclaration = 221,
ClassDeclaration = 222,
InterfaceDeclaration = 223,
TypeAliasDeclaration = 224,
EnumDeclaration = 225,
ModuleDeclaration = 226,
ModuleBlock = 227,
CaseBlock = 228,
NamespaceExportDeclaration = 229,
ImportEqualsDeclaration = 230,
ImportDeclaration = 231,
ImportClause = 232,
NamespaceImport = 233,
NamedImports = 234,
ImportSpecifier = 235,
ExportAssignment = 236,
ExportDeclaration = 237,
NamedExports = 238,
ExportSpecifier = 239,
MissingDeclaration = 240,
ExternalModuleReference = 241,
JsxElement = 242,
JsxSelfClosingElement = 243,
JsxOpeningElement = 244,
JsxClosingElement = 245,
JsxAttribute = 246,
JsxSpreadAttribute = 247,
@ -327,31 +327,31 @@ declare namespace ts {
NotEmittedStatement = 287,
PartiallyEmittedExpression = 288,
Count = 289,
FirstAssignment = 56,
LastAssignment = 68,
FirstCompoundAssignment = 57,
LastCompoundAssignment = 68,
FirstReservedWord = 70,
LastReservedWord = 105,
FirstKeyword = 70,
LastKeyword = 138,
FirstFutureReservedWord = 106,
LastFutureReservedWord = 114,
FirstTypeNode = 154,
LastTypeNode = 166,
FirstPunctuation = 15,
LastPunctuation = 68,
FirstAssignment = 57,
LastAssignment = 69,
FirstCompoundAssignment = 58,
LastCompoundAssignment = 69,
FirstReservedWord = 71,
LastReservedWord = 106,
FirstKeyword = 71,
LastKeyword = 139,
FirstFutureReservedWord = 107,
LastFutureReservedWord = 115,
FirstTypeNode = 155,
LastTypeNode = 167,
FirstPunctuation = 16,
LastPunctuation = 69,
FirstToken = 0,
LastToken = 138,
LastToken = 139,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
LastLiteralToken = 11,
FirstTemplateToken = 11,
LastTemplateToken = 14,
FirstBinaryOperator = 25,
LastBinaryOperator = 68,
FirstNode = 139,
LastLiteralToken = 12,
FirstTemplateToken = 12,
LastTemplateToken = 15,
FirstBinaryOperator = 26,
LastBinaryOperator = 69,
FirstNode = 140,
FirstJSDocNode = 257,
LastJSDocNode = 282,
FirstJSDocTagNode = 273,
@ -406,6 +406,7 @@ declare namespace ts {
AccessibilityModifier = 28,
ParameterPropertyModifier = 92,
NonPublicAccessibilityModifier = 24,
TypeScriptModifier = 2270,
}
enum JsxFlags {
None = 0,
@ -1351,8 +1352,9 @@ declare namespace ts {
TrueCondition = 32,
FalseCondition = 64,
SwitchClause = 128,
Referenced = 256,
Shared = 512,
ArrayMutation = 256,
Referenced = 512,
Shared = 1024,
Label = 12,
Condition = 96,
}
@ -1380,6 +1382,10 @@ declare namespace ts {
clauseEnd: number;
antecedent: FlowNode;
}
interface FlowArrayMutation extends FlowNode {
node: CallExpression | BinaryExpression;
antecedent: FlowNode;
}
type FlowType = Type | IncompleteType;
interface IncompleteType {
flags: TypeFlags;
@ -1913,7 +1919,6 @@ declare namespace ts {
AMD = 2,
UMD = 3,
System = 4,
ES6 = 5,
ES2015 = 5,
}
enum JsxEmit {
@ -1939,9 +1944,10 @@ declare namespace ts {
enum ScriptTarget {
ES3 = 0,
ES5 = 1,
ES6 = 2,
ES2015 = 2,
Latest = 2,
ES2016 = 3,
ES2017 = 4,
Latest = 4,
}
enum LanguageVariant {
Standard = 0,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -47,19 +47,6 @@ namespace FourSlash {
ranges: Range[];
}
interface MemberListData {
result: {
maybeInaccurate: boolean;
isMemberCompletion: boolean;
entries: {
name: string;
type: string;
kind: string;
kindModifiers: string;
}[];
};
}
export interface Marker {
fileName: string;
position: number;
@ -178,15 +165,9 @@ namespace FourSlash {
// Return object may lack some functionalities for other purposes.
function createScriptSnapShot(sourceText: string): ts.IScriptSnapshot {
return {
getText: (start: number, end: number) => {
return sourceText.substr(start, end - start);
},
getLength: () => {
return sourceText.length;
},
getChangeRange: (oldSnapshot: ts.IScriptSnapshot) => {
return <ts.TextChangeRange>undefined;
}
getText: (start: number, end: number) => sourceText.substr(start, end - start),
getLength: () => sourceText.length,
getChangeRange: () => undefined
};
}
@ -419,9 +400,8 @@ namespace FourSlash {
public verifyErrorExistsBetweenMarkers(startMarkerName: string, endMarkerName: string, negative: boolean) {
const startMarker = this.getMarkerByName(startMarkerName);
const endMarker = this.getMarkerByName(endMarkerName);
const predicate = function(errorMinChar: number, errorLimChar: number, startPos: number, endPos: number) {
return ((errorMinChar === startPos) && (errorLimChar === endPos)) ? true : false;
};
const predicate = (errorMinChar: number, errorLimChar: number, startPos: number, endPos: number) =>
((errorMinChar === startPos) && (errorLimChar === endPos)) ? true : false;
const exists = this.anyErrorInRange(predicate, startMarker, endMarker);
@ -471,14 +451,12 @@ namespace FourSlash {
let predicate: (errorMinChar: number, errorLimChar: number, startPos: number, endPos: number) => boolean;
if (after) {
predicate = function(errorMinChar: number, errorLimChar: number, startPos: number, endPos: number) {
return ((errorMinChar >= startPos) && (errorLimChar >= startPos)) ? true : false;
};
predicate = (errorMinChar: number, errorLimChar: number, startPos: number) =>
((errorMinChar >= startPos) && (errorLimChar >= startPos)) ? true : false;
}
else {
predicate = function(errorMinChar: number, errorLimChar: number, startPos: number, endPos: number) {
return ((errorMinChar <= startPos) && (errorLimChar <= startPos)) ? true : false;
};
predicate = (errorMinChar: number, errorLimChar: number, startPos: number) =>
((errorMinChar <= startPos) && (errorLimChar <= startPos)) ? true : false;
}
const exists = this.anyErrorInRange(predicate, marker);
@ -1179,7 +1157,7 @@ namespace FourSlash {
private alignmentForExtraInfo = 50;
private spanInfoToString(pos: number, spanInfo: ts.TextSpan, prefixString: string) {
private spanInfoToString(spanInfo: ts.TextSpan, prefixString: string) {
let resultString = "SpanInfo: " + JSON.stringify(spanInfo);
if (spanInfo) {
const spanString = this.activeFile.content.substr(spanInfo.start, spanInfo.length);
@ -1230,7 +1208,7 @@ namespace FourSlash {
startColumn = 0;
length = 0;
}
const spanInfo = this.spanInfoToString(pos, getSpanAtPos(pos), prefixString);
const spanInfo = this.spanInfoToString(getSpanAtPos(pos), prefixString);
if (previousSpanInfo && previousSpanInfo !== spanInfo) {
addSpanInfoString();
previousSpanInfo = spanInfo;
@ -1300,10 +1278,10 @@ namespace FourSlash {
}
}
emitOutput.outputFiles.forEach((outputFile, idx, array) => {
for (const outputFile of emitOutput.outputFiles) {
const fileName = "FileName : " + outputFile.name + Harness.IO.newLine();
resultString = resultString + fileName + outputFile.text;
});
}
resultString += Harness.IO.newLine();
});
@ -1328,7 +1306,7 @@ namespace FourSlash {
}
public printBreakpointLocation(pos: number) {
Harness.IO.log("\n**Pos: " + pos + " " + this.spanInfoToString(pos, this.getBreakpointStatementLocation(pos), " "));
Harness.IO.log("\n**Pos: " + pos + " " + this.spanInfoToString(this.getBreakpointStatementLocation(pos), " "));
}
public printBreakpointAtCurrentLocation() {
@ -1830,7 +1808,7 @@ namespace FourSlash {
return result;
}
private rangeText({fileName, start, end}: Range, more = false): string {
private rangeText({fileName, start, end}: Range): string {
return this.getFileContent(fileName).slice(start, end);
}
@ -1925,7 +1903,7 @@ namespace FourSlash {
}
public printNameOrDottedNameSpans(pos: number) {
Harness.IO.log(this.spanInfoToString(pos, this.getNameOrDottedNameSpan(pos), "**"));
Harness.IO.log(this.spanInfoToString(this.getNameOrDottedNameSpan(pos), "**"));
}
private verifyClassifications(expected: { classificationType: string; text: string; textSpan?: TextSpan }[], actual: ts.ClassifiedSpan[]) {

View file

@ -220,9 +220,7 @@ namespace Utils {
}
export function sourceFileToJSON(file: ts.Node): string {
return JSON.stringify(file, (k, v) => {
return isNodeOrArray(v) ? serializeNode(v) : v;
}, " ");
return JSON.stringify(file, (_, v) => isNodeOrArray(v) ? serializeNode(v) : v, " ");
function getKindName(k: number | string): string {
if (typeof k === "string") {
@ -692,7 +690,7 @@ namespace Harness {
export const getCurrentDirectory = () => "";
export const args = () => <string[]>[];
export const getExecutingFilePath = () => "";
export const exit = (exitCode: number) => { };
export const exit = () => { };
export const getDirectories = () => <string[]>[];
export let log = (s: string) => console.log(s);
@ -742,7 +740,7 @@ namespace Harness {
}
}
export function createDirectory(path: string) {
export function createDirectory() {
// Do nothing (?)
}
@ -750,7 +748,7 @@ namespace Harness {
Http.writeToServerSync(serverRoot + path, "DELETE");
}
export function directoryExists(path: string): boolean {
export function directoryExists(): boolean {
return false;
}
@ -792,7 +790,7 @@ namespace Harness {
return response.status === 200;
}
export function _listFilesImpl(path: string, spec?: RegExp, options?: any) {
export let listFiles = Utils.memoize((path: string, spec?: RegExp): string[] => {
const response = Http.getFileFromServerSync(serverRoot + path);
if (response.status === 200) {
const results = response.responseText.split(",");
@ -806,8 +804,7 @@ namespace Harness {
else {
return [""];
}
};
export let listFiles = Utils.memoize(_listFilesImpl);
});
export function readFile(file: string) {
const response = Http.getFileFromServerSync(serverRoot + file);
@ -991,7 +988,7 @@ namespace Harness {
}
}
function getSourceFile(fileName: string, languageVersion: ts.ScriptTarget) {
function getSourceFile(fileName: string) {
fileName = ts.normalizePath(fileName);
const path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
if (fileMap.contains(path)) {
@ -1051,7 +1048,7 @@ namespace Harness {
getDirectories: d => {
const path = ts.toPath(d, currentDirectory, getCanonicalFileName);
const result: string[] = [];
fileMap.forEachValue((key, value) => {
fileMap.forEachValue(key => {
if (key.indexOf(path) === 0 && key.lastIndexOf("/") > path.length) {
let dirName = key.substr(path.length, key.indexOf("/", path.length + 1) - path.length);
if (dirName[0] === "/") {
@ -1669,7 +1666,7 @@ namespace Harness {
}
// This does not need to exist strictly speaking, but many tests will need to be updated if it's removed
export function compileString(code: string, unitName: string, callback: (result: CompilerResult) => void) {
export function compileString(_code: string, _unitName: string, _callback: (result: CompilerResult) => void) {
// NEWTODO: Re-implement 'compileString'
throw new Error("compileString NYI");
}
@ -1853,8 +1850,8 @@ namespace Harness {
// unit tests always list files explicitly
const parseConfigHost: ts.ParseConfigHost = {
useCaseSensitiveFileNames: false,
readDirectory: (name) => [],
fileExists: (name) => true,
readDirectory: () => [],
fileExists: () => true,
readFile: (name) => ts.forEach(testUnitData, data => data.name.toLowerCase() === name.toLowerCase() ? data.content : undefined)
};

View file

@ -165,7 +165,7 @@ namespace Harness.LanguageService {
throw new Error("No script with name '" + fileName + "'");
}
public openFile(fileName: string, content?: string, scriptKindName?: string): void {
public openFile(_fileName: string, _content?: string, _scriptKindName?: string): void {
}
/**
@ -198,7 +198,7 @@ namespace Harness.LanguageService {
const script = this.getScriptInfo(fileName);
return script ? new ScriptSnapshot(script) : undefined;
}
getScriptKind(fileName: string): ts.ScriptKind { return ts.ScriptKind.Unknown; }
getScriptKind(): ts.ScriptKind { return ts.ScriptKind.Unknown; }
getScriptVersion(fileName: string): string {
const script = this.getScriptInfo(fileName);
return script ? script.version.toString() : undefined;
@ -214,7 +214,7 @@ namespace Harness.LanguageService {
this.getCurrentDirectory(),
(p) => this.virtualFileSystem.getAccessibleFileSystemEntries(p));
}
readFile(path: string, encoding?: string): string {
readFile(path: string): string {
const snapshot = this.getScriptSnapshot(path);
return snapshot.getText(0, snapshot.getLength());
}
@ -223,9 +223,9 @@ namespace Harness.LanguageService {
}
log(s: string): void { }
trace(s: string): void { }
error(s: string): void { }
log(_: string): void { }
trace(_: string): void { }
error(_: string): void { }
}
export class NativeLanguageServiceAdapter implements LanguageServiceAdapter {
@ -308,17 +308,17 @@ namespace Harness.LanguageService {
const nativeScriptSnapshot = this.nativeHost.getScriptSnapshot(fileName);
return nativeScriptSnapshot && new ScriptSnapshotProxy(nativeScriptSnapshot);
}
getScriptKind(fileName: string): ts.ScriptKind { return this.nativeHost.getScriptKind(fileName); }
getScriptKind(): ts.ScriptKind { return this.nativeHost.getScriptKind(); }
getScriptVersion(fileName: string): string { return this.nativeHost.getScriptVersion(fileName); }
getLocalizedDiagnosticMessages(): string { return JSON.stringify({}); }
readDirectory(rootDir: string, extension: string): string {
readDirectory(_rootDir: string, _extension: string): string {
throw new Error("NYI");
}
readDirectoryNames(path: string): string {
readDirectoryNames(_path: string): string {
throw new Error("Not implemented.");
}
readFileNames(path: string): string {
readFileNames(_path: string): string {
throw new Error("Not implemented.");
}
fileExists(fileName: string) { return this.getScriptInfo(fileName) !== undefined; }
@ -329,7 +329,7 @@ namespace Harness.LanguageService {
log(s: string): void { this.nativeHost.log(s); }
trace(s: string): void { this.nativeHost.trace(s); }
error(s: string): void { this.nativeHost.error(s); }
directoryExists(directoryName: string): boolean {
directoryExists(): boolean {
// for tests pessimistically assume that directory always exists
return true;
}
@ -338,7 +338,7 @@ namespace Harness.LanguageService {
class ClassifierShimProxy implements ts.Classifier {
constructor(private shim: ts.ClassifierShim) {
}
getEncodedLexicalClassifications(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.Classifications {
getEncodedLexicalClassifications(_text: string, _lexState: ts.EndOfLineState, _classifyKeywordsInGenerics?: boolean): ts.Classifications {
throw new Error("NYI");
}
getClassificationsForLine(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.ClassificationResult {
@ -411,7 +411,7 @@ namespace Harness.LanguageService {
getCompletionEntryDetails(fileName: string, position: number, entryName: string): ts.CompletionEntryDetails {
return unwrapJSONCallResult(this.shim.getCompletionEntryDetails(fileName, position, entryName));
}
getCompletionEntrySymbol(fileName: string, position: number, entryName: string): ts.Symbol {
getCompletionEntrySymbol(): ts.Symbol {
throw new Error("getCompletionEntrySymbol not implemented across the shim layer.");
}
getQuickInfoAtPosition(fileName: string, position: number): ts.QuickInfo {
@ -490,7 +490,7 @@ namespace Harness.LanguageService {
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean {
return unwrapJSONCallResult(this.shim.isValidBraceCompletionAtPosition(fileName, position, openingBrace));
}
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): ts.CodeAction[] {
getCodeFixesAtPosition(): ts.CodeAction[] {
throw new Error("Not supported on the shim.");
}
getEmitOutput(fileName: string): ts.EmitOutput {
@ -499,10 +499,10 @@ namespace Harness.LanguageService {
getProgram(): ts.Program {
throw new Error("Program can not be marshaled across the shim layer.");
}
getNonBoundSourceFile(fileName: string): ts.SourceFile {
getNonBoundSourceFile(): ts.SourceFile {
throw new Error("SourceFile can not be marshaled across the shim layer.");
}
getSourceFile(fileName: string): ts.SourceFile {
getSourceFile(): ts.SourceFile {
throw new Error("SourceFile can not be marshaled across the shim layer.");
}
dispose(): void { this.shim.dispose({}); }
@ -572,11 +572,11 @@ namespace Harness.LanguageService {
super(cancellationToken, settings);
}
onMessage(message: string): void {
onMessage(): void {
}
writeMessage(message: string): void {
writeMessage(): void {
}
@ -604,11 +604,11 @@ namespace Harness.LanguageService {
this.newLine = this.host.getNewLine();
}
onMessage(message: string): void {
onMessage(): void {
}
writeMessage(message: string): void {
writeMessage(_message: string): void {
}
write(message: string): void {
@ -624,7 +624,7 @@ namespace Harness.LanguageService {
return snapshot && snapshot.getText(0, snapshot.getLength());
}
writeFile(name: string, text: string, writeByteOrderMark: boolean): void {
writeFile(): void {
}
resolvePath(path: string): string {
@ -635,7 +635,7 @@ namespace Harness.LanguageService {
return !!this.host.getScriptSnapshot(path);
}
directoryExists(path: string): boolean {
directoryExists(): boolean {
// for tests assume that directory exists
return true;
}
@ -644,10 +644,10 @@ namespace Harness.LanguageService {
return "";
}
exit(exitCode: number): void {
exit(): void {
}
createDirectory(directoryName: string): void {
createDirectory(_directoryName: string): void {
throw new Error("Not Implemented Yet.");
}
@ -655,7 +655,7 @@ namespace Harness.LanguageService {
return this.host.getCurrentDirectory();
}
getDirectories(path: string): string[] {
getDirectories(): string[] {
return [];
}
@ -663,15 +663,15 @@ namespace Harness.LanguageService {
return ts.sys.getEnvironmentVariable(name);
}
readDirectory(path: string, extension?: string[], exclude?: string[], include?: string[]): string[] {
readDirectory(_path: string, _extension?: string[], _exclude?: string[], _include?: string[]): string[] {
throw new Error("Not implemented Yet.");
}
watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher {
watchFile(): ts.FileWatcher {
return { close() { } };
}
watchDirectory(path: string, callback: (path: string) => void, recursive?: boolean): ts.FileWatcher {
watchDirectory(): ts.FileWatcher {
return { close() { } };
}
@ -717,7 +717,7 @@ namespace Harness.LanguageService {
clearTimeout(timeoutId);
}
setImmediate(callback: (...args: any[]) => void, ms: number, ...args: any[]): any {
setImmediate(callback: (...args: any[]) => void, _ms: number, ...args: any[]): any {
return setImmediate(callback, args);
}
@ -760,6 +760,6 @@ namespace Harness.LanguageService {
getHost() { return this.host; }
getLanguageService(): ts.LanguageService { return this.client; }
getClassifier(): ts.Classifier { throw new Error("getClassifier is not available using the server interface."); }
getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo { throw new Error("getPreProcessedFileInfo is not available using the server interface."); }
getPreProcessedFileInfo(): ts.PreProcessedFileInfo { throw new Error("getPreProcessedFileInfo is not available using the server interface."); }
}
}

View file

@ -173,7 +173,7 @@ namespace Playback {
path => callAndRecord(underlying.fileExists(path), recordLog.fileExists, { path }),
memoize(path => {
// If we read from the file, it must exist
if (findFileByPath(wrapper, replayLog.filesRead, path, /*throwFileNotFoundError*/ false)) {
if (findFileByPath(replayLog.filesRead, path, /*throwFileNotFoundError*/ false)) {
return true;
}
else {
@ -217,7 +217,7 @@ namespace Playback {
recordLog.filesRead.push(logEntry);
return result;
},
memoize(path => findFileByPath(wrapper, replayLog.filesRead, path, /*throwFileNotFoundError*/ true).contents));
memoize(path => findFileByPath(replayLog.filesRead, path, /*throwFileNotFoundError*/ true).contents));
wrapper.readDirectory = recordReplay(wrapper.readDirectory, underlying)(
(path, extensions, exclude, include) => {
@ -226,7 +226,7 @@ namespace Playback {
recordLog.directoriesRead.push(logEntry);
return result;
},
(path, extensions, exclude) => {
path => {
// Because extensions is an array of all allowed extension, we will want to merge each of the replayLog.directoriesRead into one
// if each of the directoriesRead has matched path with the given path (directory with same path but different extension will considered
// different entry).
@ -244,7 +244,7 @@ namespace Playback {
wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)(
(path: string, contents: string) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path, contents, bom: false }),
(path: string, contents: string) => noOpReplay("writeFile"));
() => noOpReplay("writeFile"));
wrapper.exit = (exitCode) => {
if (recordLog !== undefined) {
@ -295,7 +295,7 @@ namespace Playback {
return results[0].result;
}
function findFileByPath(wrapper: { resolvePath(s: string): string }, logArray: IOLogFile[],
function findFileByPath(logArray: IOLogFile[],
expectedPath: string, throwFileNotFoundError: boolean): FileInformation {
const normalizedName = ts.normalizePath(expectedPath).toLowerCase();
// Try to find the result through normal fileName
@ -314,7 +314,7 @@ namespace Playback {
}
}
function noOpReplay(name: string) {
function noOpReplay(_name: string) {
// console.log("Swallowed write operation during replay: " + name);
}
@ -322,13 +322,17 @@ namespace Playback {
const wrapper: PlaybackIO = <any>{};
initWrapper(wrapper, underlying);
wrapper.directoryName = (path): string => { throw new Error("NotSupported"); };
wrapper.createDirectory = (path): void => { throw new Error("NotSupported"); };
wrapper.directoryExists = (path): boolean => { throw new Error("NotSupported"); };
wrapper.deleteFile = (path): void => { throw new Error("NotSupported"); };
wrapper.listFiles = (path, filter, options): string[] => { throw new Error("NotSupported"); };
wrapper.directoryName = notSupported;
wrapper.createDirectory = notSupported;
wrapper.directoryExists = notSupported;
wrapper.deleteFile = notSupported;
wrapper.listFiles = notSupported;
return wrapper;
function notSupported(): never {
throw new Error("NotSupported");
}
}
export function wrapSystem(underlying: ts.System): PlaybackSystem {

View file

@ -178,7 +178,7 @@ class ProjectRunner extends RunnerBase {
function createCompilerHost(): ts.CompilerHost {
return {
getSourceFile,
getDefaultLibFileName: options => Harness.Compiler.defaultLibFileName,
getDefaultLibFileName: () => Harness.Compiler.defaultLibFileName,
writeFile,
getCurrentDirectory,
getCanonicalFileName: Harness.Compiler.getCanonicalFileName,
@ -421,7 +421,7 @@ class ProjectRunner extends RunnerBase {
return undefined;
}
function writeFile(fileName: string, data: string, writeByteOrderMark: boolean) {
function writeFile() {
}
}

View file

@ -11,7 +11,9 @@
"types": [
"node", "mocha", "chai"
],
"target": "es5"
"target": "es5",
"noUnusedLocals": true,
"noUnusedParameters": true
},
"files": [
"../compiler/core.ts",

View file

@ -21,15 +21,14 @@ namespace ts {
args: <string[]>[],
newLine: "\r\n",
useCaseSensitiveFileNames: false,
write: (s: string) => {
},
readFile: (path: string, encoding?: string): string => {
write: () => { },
readFile: (path: string): string => {
return path in fileMap ? fileMap[path].content : undefined;
},
writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => {
writeFile: (_path: string, _data: string, _writeByteOrderMark?: boolean) => {
throw new Error("NYI");
},
resolvePath: (path: string): string => {
resolvePath: (_path: string): string => {
throw new Error("NYI");
},
fileExists: (path: string): boolean => {
@ -38,31 +37,25 @@ namespace ts {
directoryExists: (path: string): boolean => {
return existingDirectories[path] || false;
},
createDirectory: (path: string) => {
},
createDirectory: () => { },
getExecutingFilePath: (): string => {
return "";
},
getCurrentDirectory: (): string => {
return "";
},
getDirectories: (path: string) => [],
getEnvironmentVariable: (name: string) => "",
readDirectory: (path: string, extension?: string[], exclude?: string[], include?: string[]): string[] => {
getDirectories: () => [],
getEnvironmentVariable: () => "",
readDirectory: (_path: string, _extension?: string[], _exclude?: string[], _include?: string[]): string[] => {
throw new Error("NYI");
},
exit: (exitCode?: number) => {
},
watchFile: (path, callback) => {
return {
close: () => { }
};
},
watchDirectory: (path, callback, recursive?) => {
return {
close: () => { }
};
},
exit: () => { },
watchFile: () => ({
close: () => { }
}),
watchDirectory: () => ({
close: () => { }
}),
setTimeout,
clearTimeout,
setImmediate,
@ -75,11 +68,11 @@ namespace ts {
close() { },
hasLevel: () => false,
loggingEnabled: () => false,
perftrc: (s: string) => { },
info: (s: string) => { },
perftrc: () => { },
info: () => { },
startGroup: () => { },
endGroup: () => { },
msg: (s: string, type?: string) => { },
msg: () => { },
getLogFileName: (): string => undefined
};
@ -116,7 +109,7 @@ namespace ts {
const originalFileExists = serverHost.fileExists;
{
// patch fileExists to make sure that disk is not touched
serverHost.fileExists = (fileName): boolean => {
serverHost.fileExists = (): boolean => {
assert.isTrue(false, "fileExists should not be called");
return false;
};

View file

@ -101,7 +101,7 @@ namespace ts {
Harness.Baseline.runBaseline("JSDocParsing/DocComments.parsesCorrectly." + name + ".json",
() => JSON.stringify(comment.jsDoc,
(k, v) => v && v.pos !== undefined ? JSON.parse(Utils.sourceFileToJSON(v)) : v, 4));
(_, v) => v && v.pos !== undefined ? JSON.parse(Utils.sourceFileToJSON(v)) : v, 4));
});
}

View file

@ -290,7 +290,7 @@ namespace ts {
return path in files ? createSourceFile(fileName, files[path], languageVersion) : undefined;
},
getDefaultLibFileName: () => "lib.d.ts",
writeFile: (fileName, content): void => { throw new Error("NotImplemented"); },
writeFile: (): void => { throw new Error("NotImplemented"); },
getCurrentDirectory: () => currentDirectory,
getDirectories: () => [],
getCanonicalFileName: fileName => fileName.toLowerCase(),
@ -300,7 +300,7 @@ namespace ts {
const path = normalizePath(combinePaths(currentDirectory, fileName));
return path in files;
},
readFile: (fileName): string => { throw new Error("NotImplemented"); }
readFile: (): string => { throw new Error("NotImplemented"); }
};
const program = createProgram(rootFiles, options, host);
@ -370,7 +370,7 @@ export = C;
return path in files ? createSourceFile(fileName, files[path], languageVersion) : undefined;
},
getDefaultLibFileName: () => "lib.d.ts",
writeFile: (fileName, content): void => { throw new Error("NotImplemented"); },
writeFile: (): void => { throw new Error("NotImplemented"); },
getCurrentDirectory: () => currentDirectory,
getDirectories: () => [],
getCanonicalFileName,
@ -380,7 +380,7 @@ export = C;
const path = getCanonicalFileName(normalizePath(combinePaths(currentDirectory, fileName)));
return path in files;
},
readFile: (fileName): string => { throw new Error("NotImplemented"); }
readFile: (): string => { throw new Error("NotImplemented"); }
};
const program = createProgram(rootFiles, options, host);
const diagnostics = sortAndDeduplicateDiagnostics(program.getSemanticDiagnostics().concat(program.getOptionsDiagnostics()));
@ -1022,7 +1022,7 @@ import b = require("./moduleB");
fileExists : fileName => fileName in sourceFiles,
getSourceFile: fileName => sourceFiles[fileName],
getDefaultLibFileName: () => "lib.d.ts",
writeFile(file, text) {
writeFile(_file, _text) {
throw new Error("NYI");
},
getCurrentDirectory: () => "/",

View file

@ -111,13 +111,13 @@ namespace ts {
getDefaultLibFileName(): string {
return "lib.d.ts";
},
writeFile(file, text) {
writeFile() {
throw new Error("NYI");
},
getCurrentDirectory(): string {
return "";
},
getDirectories(path: string): string[] {
getDirectories(): string[] {
return [];
},
getCanonicalFileName(fileName): string {
@ -244,17 +244,13 @@ namespace ts {
it("fails if change affects type references", () => {
const program_1 = newProgram(files, ["a.ts"], { types: ["a"] });
updateProgram(program_1, ["a.ts"], { types: ["b"] }, files => {
});
updateProgram(program_1, ["a.ts"], { types: ["b"] }, () => { });
assert.isTrue(!program_1.structureIsReused);
});
it("succeeds if change doesn't affect type references", () => {
const program_1 = newProgram(files, ["a.ts"], { types: ["a"] });
updateProgram(program_1, ["a.ts"], { types: ["a"] }, files => {
});
updateProgram(program_1, ["a.ts"], { types: ["a"] }, () => { });
assert.isTrue(program_1.structureIsReused);
});
@ -280,19 +276,19 @@ namespace ts {
it("fails if module kind changes", () => {
const program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS });
updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.AMD }, files => void 0);
updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.AMD }, () => { });
assert.isTrue(!program_1.structureIsReused);
});
it("fails if rootdir changes", () => {
const program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/b" });
updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, files => void 0);
updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, () => { });
assert.isTrue(!program_1.structureIsReused);
});
it("fails if config path changes", () => {
const program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/b/tsconfig.json" });
updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/c/tsconfig.json" }, files => void 0);
updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/c/tsconfig.json" }, () => { });
assert.isTrue(!program_1.structureIsReused);
});

View file

@ -62,7 +62,7 @@ describe("DocumentRegistry", () => {
const snapshot = ts.ScriptSnapshot.fromString(contents);
// Always treat any change as a full change.
snapshot.getChangeRange = old => ts.createTextChangeRange(ts.createTextSpan(0, contents.length), contents.length);
snapshot.getChangeRange = () => ts.createTextChangeRange(ts.createTextSpan(0, contents.length), contents.length);
// Simulate one LS getting the document.
documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "1");

View file

@ -18,11 +18,11 @@ namespace ts.server {
createDirectory(): void {},
getExecutingFilePath(): string { return void 0; },
getCurrentDirectory(): string { return void 0; },
getEnvironmentVariable(name: string): string { return ""; },
getEnvironmentVariable(): string { return ""; },
readDirectory(): string[] { return []; },
exit(): void { },
setTimeout(callback, ms, ...args) { return 0; },
clearTimeout(timeoutId) { },
setTimeout() { return 0; },
clearTimeout() { },
setImmediate: () => 0,
clearImmediate() {}
};
@ -31,11 +31,11 @@ namespace ts.server {
close(): void {},
hasLevel(): boolean { return false; },
loggingEnabled(): boolean { return false; },
perftrc(s: string): void {},
info(s: string): void {},
perftrc(): void {},
info(): void {},
startGroup(): void {},
endGroup(): void {},
msg(s: string, type?: string): void {},
msg(): void {},
getLogFileName: (): string => undefined
};
@ -245,7 +245,7 @@ namespace ts.server {
responseRequired: true
};
session.addProtocolHandler(command, (req) => result);
session.addProtocolHandler(command, () => result);
expect(session.executeCommand({
command,
@ -263,9 +263,9 @@ namespace ts.server {
};
const command = "newhandle";
session.addProtocolHandler(command, (req) => resp);
session.addProtocolHandler(command, () => resp);
expect(() => session.addProtocolHandler(command, (req) => resp))
expect(() => session.addProtocolHandler(command, () => resp))
.to.throw(`Protocol handler already exists for command "${command}"`);
});
});

View file

@ -72,7 +72,7 @@ namespace ts.projectSystem {
this.postExecActions.forEach((act, i) => assert.equal(act.requestKind, expected[i], "Unexpected post install action"));
}
onProjectClosed(p: server.Project) {
onProjectClosed() {
}
attach(projectService: server.ProjectService) {
@ -83,7 +83,7 @@ namespace ts.projectSystem {
return this.installTypingHost;
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: TI.RequestCompletedAction): void {
executeRequest(requestKind: TI.RequestKind, _requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void {
switch (requestKind) {
case TI.NpmViewRequest:
case TI.NpmInstallRequest:
@ -122,7 +122,7 @@ namespace ts.projectSystem {
return JSON.stringify({ dependencies: dependencies });
}
export function getExecutingFilePathFromLibFile(libFilePath: string): string {
export function getExecutingFilePathFromLibFile(_libFilePath: string): string {
return combinePaths(getDirectoryPath(libFile.path), "tsc.js");
}
@ -322,9 +322,9 @@ namespace ts.projectSystem {
count() {
let n = 0;
/* tslint:disable:no-unused-variable */
for (const _ in this.map) {
/* tslint:enable:no-unused-variable */
// TODO: GH#11734
_;
n++;
}
return n;
@ -473,7 +473,7 @@ namespace ts.projectSystem {
}
// TOOD: record and invoke callbacks to simulate timer events
setTimeout(callback: TimeOutCallback, time: number, ...args: any[]) {
setTimeout(callback: TimeOutCallback, _time: number, ...args: any[]) {
return this.timeoutCallbacks.register(callback, args);
};
@ -490,7 +490,7 @@ namespace ts.projectSystem {
this.timeoutCallbacks.invoke();
}
setImmediate(callback: TimeOutCallback, time: number, ...args: any[]) {
setImmediate(callback: TimeOutCallback, _time: number, ...args: any[]) {
return this.immediateCallbacks.register(callback, args);
}
@ -522,15 +522,14 @@ namespace ts.projectSystem {
this.reloadFS(filesOrFolders);
}
write(s: string) {
}
write() { }
readonly readFile = (s: string) => (<File>this.fs.get(this.toPath(s))).content;
readonly resolvePath = (s: string) => s;
readonly getExecutingFilePath = () => this.executingFilePath;
readonly getCurrentDirectory = () => this.currentDirectory;
readonly exit = () => notImplemented();
readonly getEnvironmentVariable = (v: string) => notImplemented();
readonly exit = notImplemented;
readonly getEnvironmentVariable = notImplemented;
}
export function makeSessionRequest<T>(command: string, args: T) {

View file

@ -81,7 +81,7 @@ namespace ts.projectSystem {
constructor() {
super(host);
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
executeRequest(requestKind: TI.RequestKind, _requestId: number, _args: string[], _cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
const installedTypings = ["@types/jquery"];
const typingFiles = [jquery];
executeCommand(this, host, installedTypings, typingFiles, requestKind, cb);
@ -125,7 +125,7 @@ namespace ts.projectSystem {
constructor() {
super(host);
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
executeRequest(requestKind: TI.RequestKind, _requestId: number, _args: string[], _cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
const installedTypings = ["@types/jquery"];
const typingFiles = [jquery];
executeCommand(this, host, installedTypings, typingFiles, requestKind, cb);
@ -221,7 +221,7 @@ namespace ts.projectSystem {
enqueueIsCalled = true;
super.enqueueInstallTypingsRequest(project, typingOptions);
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: TI.RequestCompletedAction): void {
executeRequest(requestKind: TI.RequestKind, _requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void {
const installedTypings = ["@types/jquery"];
const typingFiles = [jquery];
executeCommand(this, host, installedTypings, typingFiles, requestKind, cb);
@ -275,7 +275,7 @@ namespace ts.projectSystem {
constructor() {
super(host);
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: TI.RequestCompletedAction): void {
executeRequest(requestKind: TI.RequestKind, _requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void {
const installedTypings = ["@types/lodash", "@types/react"];
const typingFiles = [lodash, react];
executeCommand(this, host, installedTypings, typingFiles, requestKind, cb);
@ -323,7 +323,7 @@ namespace ts.projectSystem {
enqueueIsCalled = true;
super.enqueueInstallTypingsRequest(project, typingOptions);
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: TI.RequestCompletedAction): void {
executeRequest(requestKind: TI.RequestKind, _requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void {
const installedTypings: string[] = [];
const typingFiles: FileOrFolder[] = [];
executeCommand(this, host, installedTypings, typingFiles, requestKind, cb);
@ -398,7 +398,7 @@ namespace ts.projectSystem {
constructor() {
super(host);
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: TI.RequestCompletedAction): void {
executeRequest(requestKind: TI.RequestKind, _requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void {
const installedTypings = ["@types/commander", "@types/express", "@types/jquery", "@types/moment"];
const typingFiles = [commander, express, jquery, moment];
executeCommand(this, host, installedTypings, typingFiles, requestKind, cb);
@ -477,7 +477,7 @@ namespace ts.projectSystem {
constructor() {
super(host, { throttleLimit: 3 });
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: TI.RequestCompletedAction): void {
executeRequest(requestKind: TI.RequestKind, _requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void {
const installedTypings = ["@types/commander", "@types/express", "@types/jquery", "@types/moment", "@types/lodash"];
executeCommand(this, host, installedTypings, typingFiles, requestKind, cb);
}
@ -567,7 +567,7 @@ namespace ts.projectSystem {
constructor() {
super(host, { throttleLimit: 3 });
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: TI.RequestCompletedAction): void {
executeRequest(requestKind: TI.RequestKind, _requestId: number, args: string[], _cwd: string, cb: TI.RequestCompletedAction): void {
if (requestKind === TI.NpmInstallRequest) {
let typingFiles: (FileOrFolder & { typings: string}) [] = [];
if (args.indexOf("@types/commander") >= 0) {
@ -655,7 +655,7 @@ namespace ts.projectSystem {
constructor() {
super(host, { globalTypingsCacheLocation: "/tmp" });
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
executeRequest(requestKind: TI.RequestKind, _requestId: number, _args: string[], _cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
const installedTypings = ["@types/jquery"];
const typingFiles = [jqueryDTS];
executeCommand(this, host, installedTypings, typingFiles, requestKind, cb);
@ -701,7 +701,7 @@ namespace ts.projectSystem {
constructor() {
super(host, { globalTypingsCacheLocation: "/tmp" });
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
executeRequest(requestKind: TI.RequestKind, _requestId: number, _args: string[], _cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
const installedTypings = ["@types/jquery"];
const typingFiles = [jqueryDTS];
executeCommand(this, host, installedTypings, typingFiles, requestKind, cb);
@ -766,7 +766,7 @@ namespace ts.projectSystem {
constructor() {
super(host, { globalTypingsCacheLocation: "/tmp" }, { isEnabled: () => true, writeLine: msg => messages.push(msg) });
}
executeRequest(requestKind: TI.RequestKind, requestId: number, args: string[], cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
executeRequest() {
assert(false, "runCommand should not be invoked");
}
})();

View file

@ -122,7 +122,7 @@ namespace ts.server {
}
protected forEachFileInfo(action: (fileInfo: T) => any) {
this.fileInfos.forEachValue((path: Path, value: T) => action(value));
this.fileInfos.forEachValue((_path, value) => action(value));
}
abstract getFilesAffectedBy(scriptInfo: ScriptInfo): string[];

View file

@ -11,7 +11,9 @@
"types": [
"node"
],
"target": "es5"
"target": "es5",
"noUnusedLocals": true,
"noUnusedParameters": true
},
"files": [
"cancellationToken.ts"

View file

@ -5,11 +5,6 @@ namespace ts.server {
writeMessage(message: string): void;
}
interface CompletionEntry extends CompletionInfo {
fileName: string;
position: number;
}
interface RenameEntry extends RenameInfo {
fileName: string;
position: number;
@ -246,7 +241,7 @@ namespace ts.server {
return response.body[0];
}
getCompletionEntrySymbol(fileName: string, position: number, entryName: string): Symbol {
getCompletionEntrySymbol(_fileName: string, _position: number, _entryName: string): Symbol {
throw new Error("Not Implemented Yet.");
}
@ -278,7 +273,7 @@ namespace ts.server {
});
}
getFormattingEditsForRange(fileName: string, start: number, end: number, options: ts.FormatCodeOptions): ts.TextChange[] {
getFormattingEditsForRange(fileName: string, start: number, end: number, _options: ts.FormatCodeOptions): ts.TextChange[] {
const startLineOffset = this.positionToOneBasedLineOffset(fileName, start);
const endLineOffset = this.positionToOneBasedLineOffset(fileName, end);
const args: protocol.FormatRequestArgs = {
@ -300,7 +295,7 @@ namespace ts.server {
return this.getFormattingEditsForRange(fileName, 0, this.host.getScriptSnapshot(fileName).getLength(), options);
}
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] {
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, _options: FormatCodeOptions): ts.TextChange[] {
const lineOffset = this.positionToOneBasedLineOffset(fileName, position);
const args: protocol.FormatOnKeyRequestArgs = {
file: fileName,
@ -390,7 +385,7 @@ namespace ts.server {
});
}
findReferences(fileName: string, position: number): ReferencedSymbol[] {
findReferences(_fileName: string, _position: number): ReferencedSymbol[] {
// Not yet implemented.
return [];
}
@ -419,7 +414,7 @@ namespace ts.server {
});
}
getEmitOutput(fileName: string): EmitOutput {
getEmitOutput(_fileName: string): EmitOutput {
throw new Error("Not Implemented Yet.");
}
@ -441,7 +436,7 @@ namespace ts.server {
return (<protocol.DiagnosticWithLinePosition[]>response.body).map(entry => this.convertDiagnostic(entry, fileName));
}
convertDiagnostic(entry: protocol.DiagnosticWithLinePosition, fileName: string): Diagnostic {
convertDiagnostic(entry: protocol.DiagnosticWithLinePosition, _fileName: string): Diagnostic {
let category: DiagnosticCategory;
for (const id in DiagnosticCategory) {
if (typeof id === "string" && entry.category === id.toLowerCase()) {
@ -566,11 +561,11 @@ namespace ts.server {
this.lineOffsetToPosition(fileName, span.end, lineMap));
}
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan {
getNameOrDottedNameSpan(_fileName: string, _startPos: number, _endPos: number): TextSpan {
throw new Error("Not Implemented Yet.");
}
getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan {
getBreakpointStatementAtPosition(_fileName: string, _position: number): TextSpan {
throw new Error("Not Implemented Yet.");
}
@ -660,19 +655,19 @@ namespace ts.server {
}
}
getOutliningSpans(fileName: string): OutliningSpan[] {
getOutliningSpans(_fileName: string): OutliningSpan[] {
throw new Error("Not Implemented Yet.");
}
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] {
getTodoComments(_fileName: string, _descriptors: TodoCommentDescriptor[]): TodoComment[] {
throw new Error("Not Implemented Yet.");
}
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion {
getDocCommentTemplateAtPosition(_fileName: string, _position: number): TextInsertion {
throw new Error("Not Implemented Yet.");
}
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean {
isValidBraceCompletionAtPosition(_fileName: string, _position: number, _openingBrace: number): boolean {
throw new Error("Not Implemented Yet.");
}
@ -739,23 +734,23 @@ namespace ts.server {
});
}
getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number {
getIndentationAtPosition(_fileName: string, _position: number, _options: EditorOptions): number {
throw new Error("Not Implemented Yet.");
}
getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {
getSyntacticClassifications(_fileName: string, _span: TextSpan): ClassifiedSpan[] {
throw new Error("Not Implemented Yet.");
}
getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {
getSemanticClassifications(_fileName: string, _span: TextSpan): ClassifiedSpan[] {
throw new Error("Not Implemented Yet.");
}
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications {
getEncodedSyntacticClassifications(_fileName: string, _span: TextSpan): Classifications {
throw new Error("Not Implemented Yet.");
}
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications {
getEncodedSemanticClassifications(_fileName: string, _span: TextSpan): Classifications {
throw new Error("Not Implemented Yet.");
}
@ -763,11 +758,11 @@ namespace ts.server {
throw new Error("SourceFile objects are not serializable through the server protocol.");
}
getNonBoundSourceFile(fileName: string): SourceFile {
getNonBoundSourceFile(_fileName: string): SourceFile {
throw new Error("SourceFile objects are not serializable through the server protocol.");
}
getSourceFile(fileName: string): SourceFile {
getSourceFile(_fileName: string): SourceFile {
throw new Error("SourceFile objects are not serializable through the server protocol.");
}

View file

@ -41,7 +41,7 @@ namespace ts.server {
class BaseLineIndexWalker implements ILineIndexWalker {
goSubtree = true;
done = false;
leaf(rangeStart: number, rangeLength: number, ll: LineLeaf) {
leaf(_rangeStart: number, _rangeLength: number, _ll: LineLeaf) {
}
}
@ -150,7 +150,7 @@ namespace ts.server {
return this.lineIndex;
}
post(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineCollection, nodeType: CharRangeSection): LineCollection {
post(_relativeStart: number, _relativeLength: number, lineCollection: LineCollection): LineCollection {
// have visited the path for start of range, now looking for end
// if range is on single line, we will never make this state transition
if (lineCollection === this.lineCollectionAtBranch) {
@ -161,7 +161,7 @@ namespace ts.server {
return undefined;
}
pre(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineCollection, nodeType: CharRangeSection) {
pre(_relativeStart: number, _relativeLength: number, lineCollection: LineCollection, _parent: LineCollection, nodeType: CharRangeSection) {
// currentNode corresponds to parent, but in the new tree
const currentNode = this.stack[this.stack.length - 1];
@ -414,7 +414,7 @@ namespace ts.server {
const starts: number[] = [-1];
let count = 1;
let pos = 0;
this.index.every((ll, s, len) => {
this.index.every(ll => {
starts[count] = pos;
count++;
pos += ll.text.length;

View file

@ -53,14 +53,6 @@ namespace ts.server {
historySize?: number;
}
interface Key {
sequence?: string;
name?: string;
ctrl?: boolean;
meta?: boolean;
shift?: boolean;
}
interface Stats {
isFile(): boolean;
isDirectory(): boolean;
@ -192,7 +184,7 @@ namespace ts.server {
constructor(
private readonly logger: server.Logger,
private readonly eventPort: number,
eventPort: number,
readonly globalTypingsCacheLocation: string,
private newLine: string) {
if (eventPort) {
@ -218,7 +210,7 @@ namespace ts.server {
const match = /^--(debug|inspect)(=(\d+))?$/.exec(arg);
if (match) {
// if port is specified - use port + 1
// otherwise pick a default port depending on if 'debug' or 'inspect' and use its value + 1
// otherwise pick a default port depending on if 'debug' or 'inspect' and use its value + 1
const currentPort = match[3] !== undefined
? +match[3]
: match[1] === "debug" ? 5858 : 9229;

View file

@ -1300,7 +1300,7 @@ namespace ts.server {
}
// No need to analyze lib.d.ts
let fileNamesInProject = fileNames.filter((value, index, array) => value.indexOf("lib.d.ts") < 0);
let fileNamesInProject = fileNames.filter(value => value.indexOf("lib.d.ts") < 0);
// Sort the file name list to make the recently touched files come first
const highPriorityFiles: NormalizedPath[] = [];
@ -1500,7 +1500,7 @@ namespace ts.server {
[CommandNames.EncodedSemanticClassificationsFull]: (request: protocol.EncodedSemanticClassificationsRequest) => {
return this.requiredResponse(this.getEncodedSemanticClassifications(request.arguments));
},
[CommandNames.Cleanup]: (request: protocol.Request) => {
[CommandNames.Cleanup]: () => {
this.cleanup();
return this.requiredResponse(true);
},
@ -1581,7 +1581,7 @@ namespace ts.server {
[CommandNames.ProjectInfo]: (request: protocol.ProjectInfoRequest) => {
return this.requiredResponse(this.getProjectInfo(request.arguments));
},
[CommandNames.ReloadProjects]: (request: protocol.ReloadProjectsRequest) => {
[CommandNames.ReloadProjects]: () => {
this.projectService.reloadProjects();
return this.notRequired();
},
@ -1591,7 +1591,7 @@ namespace ts.server {
[CommandNames.GetCodeFixesFull]: (request: protocol.CodeFixRequest) => {
return this.requiredResponse(this.getCodeFixes(request.arguments, /*simplifiedResult*/ false));
},
[CommandNames.GetSupportedCodeFixes]: (request: protocol.Request) => {
[CommandNames.GetSupportedCodeFixes]: () => {
return this.requiredResponse(this.getSupportedCodeFixes());
}
});

View file

@ -11,7 +11,9 @@
"types": [
"node"
],
"target": "es5"
"target": "es5",
"noUnusedLocals": true,
"noUnusedParameters": true
},
"files": [
"../services/shims.ts",

View file

@ -8,7 +8,9 @@
"stripInternal": true,
"declaration": true,
"types": [],
"target": "es5"
"target": "es5",
"noUnusedLocals": true,
"noUnusedParameters": true
},
"files": [
"../services/shims.ts",

View file

@ -10,8 +10,8 @@ namespace ts.server {
export const nullTypingsInstaller: ITypingsInstaller = {
enqueueInstallTypingsRequest: () => {},
attach: (projectService: ProjectService) => {},
onProjectClosed: (p: Project) => {},
attach: () => {},
onProjectClosed: () => {},
globalTypingsCacheLocation: undefined
};

View file

@ -126,7 +126,7 @@ namespace ts.server.typingsInstaller {
case NpmInstallRequest: {
const command = `${this.npmPath} install ${args.join(" ")} --save-dev`;
const start = Date.now();
this.exec(command, { cwd }, (err, stdout, stderr) => {
this.exec(command, { cwd }, (_err, stdout, stderr) => {
if (this.log.isEnabled()) {
this.log.writeLine(`${requestKind} #${requestId} took: ${Date.now() - start} ms${sys.newLine}stdout: ${stdout}${sys.newLine}stderr: ${stderr}`);
}

View file

@ -11,7 +11,9 @@
"types": [
"node"
],
"target": "es5"
"target": "es5",
"noUnusedLocals": true,
"noUnusedParameters": true
},
"files": [
"../types.d.ts",

View file

@ -35,7 +35,7 @@ namespace ts.server.typingsInstaller {
export const MaxPackageNameLength = 214;
/**
* Validates package name using rules defined at https://docs.npmjs.com/files/package.json
* Validates package name using rules defined at https://docs.npmjs.com/files/package.json
*/
export function validatePackageName(packageName: string): PackageNameValidationResult {
Debug.assert(!!packageName, "Package name is not specified");
@ -131,7 +131,7 @@ namespace ts.server.typingsInstaller {
this.log.writeLine(`Got install request ${JSON.stringify(req)}`);
}
// load existing typing information from the cache
// load existing typing information from the cache
if (req.cachePath) {
if (this.log.isEnabled()) {
this.log.writeLine(`Request specifies cache path '${req.cachePath}', loading cached information...`);
@ -145,8 +145,7 @@ namespace ts.server.typingsInstaller {
req.projectRootPath,
this.safeListPath,
this.packageNameToTypingLocation,
req.typingOptions,
req.compilerOptions);
req.typingOptions);
if (this.log.isEnabled()) {
this.log.writeLine(`Finished typings discovery: ${JSON.stringify(discoverTypingsResult)}`);

View file

@ -179,7 +179,7 @@ namespace ts.Completions {
// Get string literal completions from specialized signatures of the target
// i.e. declare function f(a: 'A');
// f("/*completion position*/")
return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, node);
return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo);
}
// Get completion for string literal from string literal type
@ -199,7 +199,7 @@ namespace ts.Completions {
}
}
function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo: SignatureHelp.ArgumentListInfo, location: Node) {
function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo: SignatureHelp.ArgumentListInfo) {
const candidates: Signature[] = [];
const entries: CompletionEntry[] = [];
@ -361,7 +361,7 @@ namespace ts.Completions {
/**
* Multiple file entries might map to the same truncated name once we remove extensions
* (happens iff includeExtensions === false)so we use a set-like data structure. Eg:
*
*
* both foo.ts and foo.tsx become foo
*/
const foundFiles = createMap<boolean>();
@ -617,7 +617,7 @@ namespace ts.Completions {
if (typeRoots) {
for (const root of typeRoots) {
getCompletionEntriesFromDirectories(host, options, root, span, result);
getCompletionEntriesFromDirectories(host, root, span, result);
}
}
}
@ -626,14 +626,14 @@ namespace ts.Completions {
// Also get all @types typings installed in visible node_modules directories
for (const packageJson of findPackageJsons(scriptPath)) {
const typesDir = combinePaths(getDirectoryPath(packageJson), "node_modules/@types");
getCompletionEntriesFromDirectories(host, options, typesDir, span, result);
getCompletionEntriesFromDirectories(host, typesDir, span, result);
}
}
return result;
}
function getCompletionEntriesFromDirectories(host: LanguageServiceHost, options: CompilerOptions, directory: string, span: TextSpan, result: CompletionEntry[]) {
function getCompletionEntriesFromDirectories(host: LanguageServiceHost, directory: string, span: TextSpan, result: CompletionEntry[]) {
if (host.getDirectories && tryDirectoryExists(host, directory)) {
const directories = tryGetDirectories(host, directory);
if (directories) {
@ -1708,11 +1708,11 @@ namespace ts.Completions {
* to determine if the caret is currently within the string literal and capture the literal fragment
* for completions.
* For example, this matches
*
*
* /// <reference path="fragment
*
*
* but not
*
*
* /// <reference path="fragment"
*/
const tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*<reference\s+(path|types)\s*=\s*(?:'|"))([^\3"]*)$/;

View file

@ -90,7 +90,7 @@ namespace ts.FindAllReferences {
getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex);
}
else {
const internedName = getInternedName(symbol, node, declarations);
const internedName = getInternedName(symbol, node);
for (const sourceFile of sourceFiles) {
cancellationToken.throwIfCancellationRequested();
@ -175,7 +175,7 @@ namespace ts.FindAllReferences {
return undefined;
}
function getInternedName(symbol: Symbol, location: Node, declarations: Declaration[]): string {
function getInternedName(symbol: Symbol, location: Node): string {
// If this is an export or import specifier it could have been renamed using the 'as' syntax.
// If so we want to search for whatever under the cursor.
if (isImportOrExportSpecifierName(location)) {

View file

@ -248,7 +248,7 @@ namespace ts.formatting {
}
};
function rangeHasNoErrors(r: TextRange): boolean {
function rangeHasNoErrors(): boolean {
return false;
}
}

View file

@ -67,7 +67,7 @@ namespace ts.formatting {
return result;
}
public Contains(tokenValue: SyntaxKind): boolean {
public Contains(): boolean {
return true;
}

View file

@ -43,7 +43,7 @@ namespace ts.JsDoc {
];
let jsDocCompletionEntries: CompletionEntry[];
export function getJsDocCommentsFromDeclarations(declarations: Declaration[], name: string, canUseParsedParamTagComments: boolean) {
export function getJsDocCommentsFromDeclarations(declarations: Declaration[]) {
// Only collect doc comments from duplicate declarations once:
// In case of a union property there might be same declaration multiple times
// which only varies in type parameter

View file

@ -46,8 +46,7 @@ namespace ts.JsTyping {
projectRootPath: Path,
safeListPath: Path,
packageNameToTypingLocation: Map<string>,
typingOptions: TypingOptions,
compilerOptions: CompilerOptions):
typingOptions: TypingOptions):
{ cachedTypingPaths: string[], newTypingNames: string[], filesToWatch: string[] } {
// A typing name to typing file path mapping

View file

@ -264,23 +264,23 @@ namespace ts {
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
}
public getChildCount(sourceFile?: SourceFile): number {
public getChildCount(): number {
return 0;
}
public getChildAt(index: number, sourceFile?: SourceFile): Node {
public getChildAt(): Node {
return undefined;
}
public getChildren(sourceFile?: SourceFile): Node[] {
public getChildren(): Node[] {
return emptyArray;
}
public getFirstToken(sourceFile?: SourceFile): Node {
public getFirstToken(): Node {
return undefined;
}
public getLastToken(sourceFile?: SourceFile): Node {
public getLastToken(): Node {
return undefined;
}
}
@ -313,7 +313,7 @@ namespace ts {
getDocumentationComment(): SymbolDisplayPart[] {
if (this.documentationComment === undefined) {
this.documentationComment = JsDoc.getJsDocCommentsFromDeclarations(this.declarations, this.name, !(this.flags & SymbolFlags.Property));
this.documentationComment = JsDoc.getJsDocCommentsFromDeclarations(this.declarations);
}
return this.documentationComment;
@ -338,7 +338,7 @@ namespace ts {
_incrementExpressionBrand: any;
_unaryExpressionBrand: any;
_expressionBrand: any;
constructor(kind: SyntaxKind.Identifier, pos: number, end: number) {
constructor(_kind: SyntaxKind.Identifier, pos: number, end: number) {
super(pos, end);
}
}
@ -423,10 +423,7 @@ namespace ts {
getDocumentationComment(): SymbolDisplayPart[] {
if (this.documentationComment === undefined) {
this.documentationComment = this.declaration ? JsDoc.getJsDocCommentsFromDeclarations(
[this.declaration],
/*name*/ undefined,
/*canUseParsedParamTagComments*/ false) : [];
this.documentationComment = this.declaration ? JsDoc.getJsDocCommentsFromDeclarations([this.declaration]) : [];
}
return this.documentationComment;
@ -802,7 +799,7 @@ namespace ts {
public getRootFileNames(): string[] {
const fileNames: string[] = [];
this.fileNameToEntry.forEachValue((path, value) => {
this.fileNameToEntry.forEachValue((_path, value) => {
if (value) {
fileNames.push(value.hostFileName);
}
@ -1054,7 +1051,7 @@ namespace ts {
useCaseSensitiveFileNames: () => useCaseSensitivefileNames,
getNewLine: () => getNewLineOrDefaultFromHost(host),
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
writeFile: (fileName, data, writeByteOrderMark) => { },
writeFile: () => { },
getCurrentDirectory: () => currentDirectory,
fileExists: (fileName): boolean => {
// stub missing host functionality
@ -1458,7 +1455,7 @@ namespace ts {
return getNonBoundSourceFile(fileName);
}
function getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan {
function getNameOrDottedNameSpan(fileName: string, startPos: number, _endPos: number): TextSpan {
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
// Get node at the location

View file

@ -119,13 +119,13 @@ namespace ts {
}
export interface Shim {
dispose(dummy: any): void;
dispose(_dummy: any): void;
}
export interface LanguageServiceShim extends Shim {
languageService: LanguageService;
dispose(dummy: any): void;
dispose(_dummy: any): void;
refresh(throwOnError: boolean): void;
@ -600,7 +600,7 @@ namespace ts {
constructor(private factory: ShimFactory) {
factory.registerShim(this);
}
public dispose(dummy: any): void {
public dispose(_dummy: any): void {
this.factory.unregisterShim(this);
}
}
@ -1168,8 +1168,7 @@ namespace ts {
toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName),
toPath(info.safeListPath, info.safeListPath, getCanonicalFileName),
info.packageNameToTypingLocation,
info.typingOptions,
info.compilerOptions);
info.typingOptions);
});
}
}

View file

@ -74,8 +74,8 @@ namespace ts {
// Create a compilerHost object to allow the compiler to read and write files
const compilerHost: CompilerHost = {
getSourceFile: (fileName, target) => fileName === normalizePath(inputFileName) ? sourceFile : undefined,
writeFile: (name, text, writeByteOrderMark) => {
getSourceFile: (fileName) => fileName === normalizePath(inputFileName) ? sourceFile : undefined,
writeFile: (name, text) => {
if (fileExtensionIs(name, ".map")) {
Debug.assert(sourceMapText === undefined, `Unexpected multiple source map outputs for the file '${name}'`);
sourceMapText = text;
@ -91,9 +91,9 @@ namespace ts {
getCurrentDirectory: () => "",
getNewLine: () => newLine,
fileExists: (fileName): boolean => fileName === inputFileName,
readFile: (fileName): string => "",
directoryExists: directoryExists => true,
getDirectories: (path: string) => []
readFile: () => "",
directoryExists: () => true,
getDirectories: () => []
};
const program = createProgram([inputFileName], options, compilerHost);

View file

@ -10,7 +10,9 @@
"stripInternal": true,
"noResolve": false,
"declaration": true,
"target": "es5"
"target": "es5",
"noUnusedLocals": true,
"noUnusedParameters": true
},
"files": [
"../compiler/core.ts",

View file

@ -97,7 +97,7 @@ namespace ts {
return this.text.length;
}
public getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange {
public getChangeRange(): TextChangeRange {
// Text-based snapshots do not support incremental parsing. Return undefined
// to signal that to the caller.
return undefined;

View file

@ -1179,7 +1179,7 @@ namespace ts {
}
export function symbolPart(text: string, symbol: Symbol) {
return displayPart(text, displayPartKind(symbol), symbol);
return displayPart(text, displayPartKind(symbol));
function displayPartKind(symbol: Symbol): SymbolDisplayPartKind {
const flags = symbol.flags;
@ -1205,7 +1205,7 @@ namespace ts {
}
}
export function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart {
export function displayPart(text: string, kind: SymbolDisplayPartKind): SymbolDisplayPart {
return <SymbolDisplayPart>{
text: text,
kind: SymbolDisplayPartKind[kind]