mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
delete unused tests
This commit is contained in:
1 parent
3fcd33ec32
commit
05d2e75e7c
82 files changed
-4560
No files matched your search
@@ -1,27 +0,0 @@
|
||||
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
|
||||
///<reference path='..\..\..\..\src\harness\harness.ts' />
|
||||
|
||||
describe('Compiling unittests\\compiler\\callSignatureTests.ts', function () {
|
||||
it("If a signature omits a return type annotation, any type is assumed", function () {
|
||||
var code = 'var foo: {();};';
|
||||
code += 'var test = foo();'
|
||||
code += 'test.bar = 2;'
|
||||
Harness.Compiler.compileString(code, 'call signatures', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
it("A call signature can have the void return type", function () {
|
||||
var code = 'var foo: {():void;};';
|
||||
code += 'var test = foo();'
|
||||
Harness.Compiler.compileString(code, 'call signatures', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
it("A call signature can't have the same overload", function () {
|
||||
var code = 'var foo: { (): string; (): string; };';
|
||||
Harness.Compiler.compileString(code, 'call signatures', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,128 +0,0 @@
|
||||
/// <reference path='..\..\..\..\src\compiler\typescript.ts' />
|
||||
/// <reference path='..\..\..\..\src\harness\harness.ts' />
|
||||
|
||||
describe('Compiling unittests\\compiler\\classOverloads.ts', function () {
|
||||
it("Everytype is a subtype of itself", function () {
|
||||
var code = 'class foo { public bar: number; }';
|
||||
code += 'class bar extends foo { public bar: number; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
it("All types except the Void type are subtypes of the Any type", function () {
|
||||
var code = 'class foo { public bar: any; }';
|
||||
code += 'class bar extends foo { public bar: number; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
it("All types are subtypes of the Any type - 2", function () {
|
||||
var code = 'class baz { public bar(): any { return 1; } }';
|
||||
code += 'class foo extends baz { public bar(): void {} }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
it("The Undefined type is a subtype of all types except the Void type", function () {
|
||||
var code = 'class baz { public bar(): any { return 1 } }';
|
||||
code += 'class foo extends baz { public bar(){ return undefined} }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
it("The Undefined type is a subtype of all types except the Void type - 2", function () {
|
||||
var code = 'class baz { public bar(): void { } }';
|
||||
code += 'class foo extends baz { public bar(){ return undefined} }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
it("The Null type is a subtype of all types, except the Undefined and Void types", function () {
|
||||
var code = 'class baz { public bar:any; }';
|
||||
code += 'class foo extends baz { public bar = null; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
it("The Null type is a subtype of all types, except the Undefined and Void types - 3", function () {
|
||||
var code = 'class baz { public bar():void { } }';
|
||||
code += 'class foo extends baz { public bar() { return null; } }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('An object type S is a subtype of an object type T', function () {
|
||||
it("A property in T is matched by a property in S", function () {
|
||||
var code = 'class baz { public bar: { a: string; }; }';
|
||||
code += 'class foo extends baz { public bar: { a: number; }; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 1);
|
||||
});
|
||||
});
|
||||
it("A property in T is matched by a property in S - 2", function () {
|
||||
var code = 'class baz { public bar: { a: string; }; }';
|
||||
code += 'class foo extends baz { public bar: { a: string; }; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
it("A property in T is matched by a property in S - 3", function () {
|
||||
var code = 'class baz { public bar: { a: string; }; }';
|
||||
code += 'class foo extends baz { public bar: { b: string; }; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 1);
|
||||
});
|
||||
});
|
||||
it("A call, construct or index signature in T is matched by a call, construct or index signature", function () {
|
||||
var code = 'class baz { public bar: { (); }; }';
|
||||
code += 'class foo extends baz { public bar: { (); } ;}';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
it("A call, construct or index signature in T is matched by a call, construct or index signature - 2", function () {
|
||||
var code = 'class baz { public bar: { [idx:number]: any; }; }';
|
||||
code += 'class foo extends baz { public bar: { (); }; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 1);
|
||||
});
|
||||
});
|
||||
it("A call, construct or index signature in T is matched by a call, construct or index signature - 3", function () {
|
||||
var code = 'class baz { public bar: { (a: string); }; }';
|
||||
code += 'class foo extends baz { public bar: { (); }; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
|
||||
});
|
||||
it("A call, construct or index signature in T is matched by a call, construct or index signature - 4", function () {
|
||||
var code = 'class baz { public bar: { (a:string); }; }';
|
||||
code += 'class foo extends baz { public bar: { (a:string,b:string); }; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 1);
|
||||
});
|
||||
});
|
||||
it("A call, construct or index signature in T is matched by a call, construct or index signature - 5", function () {
|
||||
var code = 'class baz { public bar: { ():void; }; }';
|
||||
code += 'class foo extends baz { public bar: { ():void; }; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
it("A call, construct or index signature in T is matched by a call, construct or index signature - 6", function () {
|
||||
var code = 'class baz { public bar: { (); }; }';
|
||||
code += 'class foo extends baz { public bar: { ():void; }; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
|
||||
///<reference path='..\..\..\..\src\harness\harness.ts' />
|
||||
|
||||
describe('Compiling tests\\compiler\\constructSignatureTests.ts', function () {
|
||||
it("If a signature omits a return type annotation, any type is assumed", function () {
|
||||
var code = 'var foo: {new ();};';
|
||||
code += 'var test = new foo();'
|
||||
code += 'test.bar = 2;'
|
||||
Harness.Compiler.compileString(code, 'construct signatures', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
it("A call signature can have the void return type", function () {
|
||||
var code = 'var foo: {new ():void;};';
|
||||
Harness.Compiler.compileString(code, 'call signatures', function (result) {
|
||||
assert.equal(result.errors.length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
it("A construct signature can't have the same overload", function () {
|
||||
var code = 'var foo: { new (): string; new (): string; };';
|
||||
Harness.Compiler.compileString(code, 'call signatures', function (result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,52 +0,0 @@
|
||||
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
|
||||
///<reference path='..\..\..\..\src\harness\harness.ts' />
|
||||
|
||||
//@tags 1.1 Declarations
|
||||
|
||||
describe('Compiling unittests\\compiler\\declarationTests.ts', function() {
|
||||
it("Each internal module’s export declaration spaces are shared with other internal modules that have the same root module and the " +
|
||||
"same qualified name starting from that root module", function() {
|
||||
var code = 'module baz{export var foo;}';
|
||||
code += 'module baz{export var bar;}'
|
||||
code += 'baz.foo = baz.bar;'
|
||||
Harness.Compiler.compileString(code, 'declarations', function(result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
it("Each object type literal has a declaration space for its members", function() {
|
||||
var code = 'var foo:{a:number;};';
|
||||
code += 'foo.a = 2;'
|
||||
Harness.Compiler.compileString(code, 'declarations', function(result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
it("Each class declaration has a declaration space for members and a declaration space for statics", function() {
|
||||
var code = 'class foo {';
|
||||
code += ' static bar;'
|
||||
code += ' public bar;'
|
||||
code += '}'
|
||||
Harness.Compiler.compileString(code, 'declarations', function(result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
it("Each function declaration (including member function declarations and static function declarations) has a declaration space for " +
|
||||
"statics and a declaration space for locals (parameters, variables, and functions).", function() {
|
||||
var code = 'function foo() {';
|
||||
code += ' static bar;'
|
||||
code += ' var bar;'
|
||||
code += '}'
|
||||
Harness.Compiler.compileString(code, 'declarations', function(result) {
|
||||
assert.equal(result.errors.length, 1);
|
||||
});
|
||||
});
|
||||
it("Modules contain separate declaration spaces for variables and types.", function() {
|
||||
var code = 'module M {';
|
||||
code += ' class bar {};'
|
||||
code += ' var bar;'
|
||||
code += '}'
|
||||
Harness.Compiler.compileString(code, 'declarations', function(result) {
|
||||
assert.equal(result.errors.length, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
|
||||
///<reference path='..\..\..\..\src\harness\harness.ts' />
|
||||
|
||||
describe('Compiling unittests\\compiler\\functionSignatureTests.ts', function() {
|
||||
it('Check overload with different return types.', function(){
|
||||
var code = 'var foo: { bar(): string; bar(): number; };\n';
|
||||
code += 'var bar: { bar: { (): string; (): number; }; };';
|
||||
code += 'foo = bar;';
|
||||
Harness.Compiler.compileString(code, 'function signatures', function(result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
})
|
||||
|
||||
describe('Function Type Literals', function() {
|
||||
it('Basic sanity check', function() {
|
||||
var code = 'var foo: { (): string; };';
|
||||
code += 'var bar: () => string;';
|
||||
code += 'foo = bar;';
|
||||
Harness.Compiler.compileString(code, 'function type literal', function(result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
|
||||
///<reference path='..\..\..\..\src\harness\harness.ts' />
|
||||
|
||||
describe('Compiling tests\\compiler\\identifiers.ts', function() {
|
||||
it("Everytype is a subtype of itself", function() {
|
||||
var code = 'class foo { public bar: number; }';
|
||||
code += 'class bar extends foo { public bar: number; }';
|
||||
Harness.Compiler.compileString(code, 'subtypes', function(result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
|
||||
///<reference path='..\..\..\..\src\harness\harness.ts' />
|
||||
|
||||
describe('Compiling unittests\\compiler\\moduleAlias.ts', function() {
|
||||
describe('Internal module alias test', function() {
|
||||
it("basic test", function() {
|
||||
var code = "module A.B.C { import XYZ = X.Y.Z; export function ping(x: number) { if (x > 0) XYZ.pong(x-1);}};";
|
||||
code += "module X.Y.Z { import ABC = A.B.C; export function pong(x: number) { if (x > 0) ABC.ping(x-1);}};";
|
||||
Harness.Compiler.compileString(code, 'module alias', function(result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,50 +0,0 @@
|
||||
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
|
||||
///<reference path='..\..\..\..\src\harness\harness.ts' />
|
||||
|
||||
describe('Verifying pathing functions', function () {
|
||||
it("Normalizes Mac paths", function () {
|
||||
var result = TypeScript.normalizePath("/Users/Me/somefile.ts");
|
||||
var expected = "/Users/Me/somefile.ts";
|
||||
assert.equal(result, expected);
|
||||
});
|
||||
it("Normalizes relative Mac paths", function () {
|
||||
var result = TypeScript.normalizePath("/Users/./Me/../somefile.ts");
|
||||
var expected = "/Users/somefile.ts";
|
||||
assert.equal(result, expected);
|
||||
});
|
||||
it("Normalizes Windows paths", function () {
|
||||
var result = TypeScript.normalizePath("C:\\Users\\Me\\somefile.ts");
|
||||
var expected = "C:/Users/Me/somefile.ts";
|
||||
assert.equal(result, expected);
|
||||
});
|
||||
it("Normalizes relative Windows paths", function () {
|
||||
var result = TypeScript.normalizePath("C:\\Users\\.\\Me\\..\\somefile.ts");
|
||||
var expected = "C:/Users/somefile.ts";
|
||||
assert.equal(result, expected);
|
||||
});
|
||||
it("Normalizes . and ..", function () {
|
||||
var result = TypeScript.normalizePath("..\\Users\\.\\Me\\..\\somefile.ts");
|
||||
var expected = "../Users/somefile.ts";
|
||||
assert.equal(result, expected);
|
||||
});
|
||||
it("Normalizes UNC paths", function () {
|
||||
var result = TypeScript.normalizePath("\\\\server\\share\\someFile.ts");
|
||||
var expected = "file://server/share/someFile.ts";
|
||||
assert.equal(result, expected);
|
||||
});
|
||||
it("Normalizes relative UNC paths with IP addresses", function () {
|
||||
var result = TypeScript.normalizePath("\\\\127.0.0.1\\share\\..\\elsewhere\\someFile.ts");
|
||||
var expected = "file://127.0.0.1/elsewhere/someFile.ts";
|
||||
assert.equal(result, expected);
|
||||
});
|
||||
it("Normalizes HTTP paths", function () {
|
||||
var result = TypeScript.normalizePath("http://www.server.com/share/someFile.ts");
|
||||
var expected = "http://www.server.com/share/someFile.ts";
|
||||
assert.equal(result, expected);
|
||||
});
|
||||
it("Normalizes relative HTTP paths", function () {
|
||||
var result = TypeScript.normalizePath("http://www.server.com/share/../someFile.ts");
|
||||
var expected = "http://www.server.com/someFile.ts";
|
||||
assert.equal(result, expected);
|
||||
});
|
||||
});
|
||||
@@ -1,19 +0,0 @@
|
||||
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
|
||||
///<reference path='..\..\..\..\src\harness\harness.ts' />
|
||||
|
||||
describe('Compiling unittests\\compiler\\propertySignatureTests.ts', function() {
|
||||
it('The Identifier of a property signature must be unique within its containing type. ', function(){
|
||||
var code = 'var foo: { a:string; a: string; };';
|
||||
Harness.Compiler.compileString(code, 'property signatures', function(result) {
|
||||
assert.equal(result.errors.length, 1);
|
||||
//assert.compilerWarning(result, 1, 9, 'Duplicate identifier a');
|
||||
});
|
||||
});
|
||||
|
||||
it('If a property signature omits a TypeAnnotation, the Any type is assumed.', function(){
|
||||
var code = 'var foo: { a; }; foo.a = 2; foo.a = "0";';
|
||||
Harness.Compiler.compileString(code, 'property signatures', function(result) {
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
})
|
||||
});
|
||||
@@ -1,4 +0,0 @@
|
||||
///<reference path='..\..\..\..\src\harness\harness.ts'/>
|
||||
///<reference path='..\..\..\..\src\compiler\tsc.ts' />
|
||||
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
|
||||
///<reference path='..\..\..\..\src\services\typescriptServices.ts' />
|
||||
@@ -1,20 +0,0 @@
|
||||
///<reference path='..\..\..\src\harness\harness.ts'/>
|
||||
///<reference path='..\..\..\src\harness\baselining.ts'/>
|
||||
declare var JSON: any;
|
||||
|
||||
describe('Accepting local files as new reference...', function() {
|
||||
var localPath = 'tests/services/baselines/local';
|
||||
var outputPath = 'tests/services/baselines/reference';
|
||||
|
||||
// Get a list of all the files in the baseline/inputs folder
|
||||
var files = IO.dir(localPath);
|
||||
|
||||
// Copy them to the output folder
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var filename = files[i].substr(files[i].lastIndexOf('\\'));
|
||||
if(filename.indexOf('.html') === -1) {
|
||||
var referenceData = IO.readFile(files[i]);
|
||||
IO.writeFile(outputPath + '/' + filename, referenceData);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,66 +0,0 @@
|
||||
/// <reference path='..\..\..\src\harness\harness.ts'/>
|
||||
/// <reference path='..\..\..\src\harness\baselining.ts'/>
|
||||
/// <reference path='..\..\..\src\harness\external\json2.ts'/>
|
||||
|
||||
describe('Baseline files match (intellisense data)', function() {
|
||||
var inputPath = 'tests/services/baselines/inputs';
|
||||
var outputPath = 'tests/services/baselines/local';
|
||||
var referencePath = 'tests/services/baselines/reference';
|
||||
|
||||
var i;
|
||||
|
||||
// Might need to create this
|
||||
IO.createDirectory(outputPath);
|
||||
|
||||
// Delete any old reports from the local path
|
||||
var localFiles = IO.dir(outputPath);
|
||||
for (i = 0; i < localFiles.length; i++) {
|
||||
var localFilename = localFiles[i];
|
||||
if(localFilename.indexOf('.html') > 0) {
|
||||
IO.deleteFile(localFilename);
|
||||
}
|
||||
}
|
||||
|
||||
// Get a list of all the files in the baseline/inputs folder
|
||||
var files = IO.dir(inputPath);
|
||||
|
||||
var template = IO.readFile('tests/services/baselines/diff-template.html');
|
||||
|
||||
// For each file, get data:
|
||||
// a) Completion
|
||||
// b) Type signature
|
||||
// c) etc...
|
||||
for (i = 0; i < files.length; i++) {
|
||||
var filename = files[i].substr(files[i].lastIndexOf('\\'));
|
||||
var scriptText = IO.readFile(files[i]).trim();
|
||||
|
||||
var outputAndCheck = function(nameSuffix: string, process: any) {
|
||||
describe(nameSuffix + ' data for ' + filename + ' matches the baseline', function() {
|
||||
var data = process(scriptText);
|
||||
var stringified = JSON.stringify(data).trim();
|
||||
|
||||
var baseFilename = filename + '-' + nameSuffix + '.json';
|
||||
IO.writeFile(outputPath + '/' + baseFilename, stringified);
|
||||
|
||||
var referenceFilename = referencePath + '/' + baseFilename;
|
||||
var reference = IO.fileExists(referenceFilename) ? IO.readFile(referenceFilename) : '[{file: "(no file)"}]';
|
||||
reference = reference.trim();
|
||||
|
||||
if (reference != stringified) {
|
||||
// Emit a report file in 'local'
|
||||
var errorReportFile = outputPath + filename + '-' + nameSuffix + '-diff.html';
|
||||
IO.writeFile(errorReportFile,
|
||||
template.replace('/**REFERENCE**/', reference).replace('/**ACTUAL**/', stringified));
|
||||
throw new Error('Data does not match reference. Refer to diff report ' + errorReportFile);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Write that data out to a JSON file in the 'local' folder
|
||||
outputAndCheck('signatures', getIntellisenseSignatureRegions);
|
||||
outputAndCheck('completions', getIntellisenseCompletionListRegions);
|
||||
outputAndCheck('definitions', getIntellisenseDefinitionRegions);
|
||||
outputAndCheck('types', getIntellisenseTypeRegions);
|
||||
outputAndCheck('members', getIntellisenseMemberListRegions);
|
||||
}
|
||||
});
|
||||
@@ -1,23 +0,0 @@
|
||||
module Foo { var testing = ""; test }
|
||||
|
||||
class C1 {
|
||||
public pubMeth() {this.} // test on 'this.'
|
||||
private privMeth() {}
|
||||
public pubProp;
|
||||
private privProp;
|
||||
}
|
||||
|
||||
var f = new C1();
|
||||
f. // test on F.
|
||||
module M {
|
||||
export class C { public pub; private priv; }
|
||||
export var V = 0;
|
||||
}
|
||||
|
||||
|
||||
var c = new M.C();
|
||||
|
||||
c. // test on c.
|
||||
|
||||
//Test for comment
|
||||
//c.
|
||||
@@ -1,215 +0,0 @@
|
||||
interface IOptions {
|
||||
name: string;
|
||||
flag: boolean;
|
||||
short: string;
|
||||
usage: string;
|
||||
set: (s: string) => void;
|
||||
type: string;
|
||||
}
|
||||
|
||||
class OptionsParser {
|
||||
private DEFAULT_SHORT_FLAG = "-";
|
||||
private DEFAULT_LONG_FLAG = "--";
|
||||
|
||||
constructor (private host: IIO) { }
|
||||
|
||||
// Find the option record for the given string. Returns null if not found.
|
||||
private findOption(arg: string) {
|
||||
|
||||
for (var i = 0; i < this.options.length; i++) {
|
||||
|
||||
if (arg === this.options[i].short || arg === this.options[i].name) {
|
||||
return this.options[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public unnamed: string[] = [];
|
||||
|
||||
public options: IOptions[] = [];
|
||||
|
||||
public printUsage() {
|
||||
IO.printLine("Syntax: tsc [options] [file ..]");
|
||||
IO.printLine("");
|
||||
IO.printLine("Examples: tsc hello.ts");
|
||||
IO.printLine(" tsc --out foo.js foo.ts");
|
||||
IO.printLine(" tsc @args.txt");
|
||||
IO.printLine("");
|
||||
IO.printLine("Options:");
|
||||
|
||||
var output = [];
|
||||
var maxLength = 0;
|
||||
|
||||
this.options = this.options.sort(function(a, b) {
|
||||
var aName = a.name.toLowerCase();
|
||||
var bName = b.name.toLowerCase();
|
||||
|
||||
if (aName > bName) {
|
||||
return 1;
|
||||
} else if (aName < bName) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Build up output array
|
||||
for (var i = 0; i < this.options.length; i++) {
|
||||
var option = this.options[i];
|
||||
|
||||
if (!option.usage)
|
||||
break;
|
||||
|
||||
var usageString = " ";
|
||||
var type = option.type ? " " + option.type.toUpperCase() : "";
|
||||
|
||||
if (option.short) {
|
||||
usageString += this.DEFAULT_SHORT_FLAG + option.short + type + ", ";
|
||||
}
|
||||
|
||||
usageString += this.DEFAULT_LONG_FLAG + option.name + type;
|
||||
|
||||
output.push([usageString, option.usage]);
|
||||
|
||||
if (usageString.length > maxLength) {
|
||||
maxLength = usageString.length;
|
||||
}
|
||||
}
|
||||
|
||||
output.push([" @<file>", "Insert command line options and files from a file."]);
|
||||
|
||||
// Print padded output
|
||||
for (var i = 0; i < output.length; i++) {
|
||||
IO.printLine(output[i][0] + (new Array(maxLength - output[i][0].length + 3)).join(" ") + output[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
public option(name: string, config: IOptions);
|
||||
public option(name: string, config: IOptions, short: string) {
|
||||
if (!config) {
|
||||
config = <any>short;
|
||||
short = null;
|
||||
}
|
||||
|
||||
config.name = name;
|
||||
config.short = short;
|
||||
config.flag = false;
|
||||
|
||||
this.options.push(config);
|
||||
}
|
||||
|
||||
public flag(name: string, config: IOptions);
|
||||
public flag(name: string, config: IOptions, short: string) {
|
||||
if (!config) {
|
||||
config = <any>short;
|
||||
short = null;
|
||||
}
|
||||
|
||||
config.name = name;
|
||||
config.short = short;
|
||||
config.flag = true
|
||||
|
||||
this.options.push(config);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Parse an arguments string
|
||||
public parseString(argString: string) {
|
||||
var position = 0;
|
||||
var tokens = argString.match(/\s+|"|[^\s"]+/g);
|
||||
|
||||
function peek() {
|
||||
return tokens[position];
|
||||
}
|
||||
|
||||
function consume() {
|
||||
return tokens[position++];
|
||||
}
|
||||
|
||||
function consumeQuotedString() {
|
||||
var value = '';
|
||||
consume(); // skip opening quote.
|
||||
|
||||
var token = peek();
|
||||
|
||||
while (token && token !== '"') {
|
||||
consume();
|
||||
|
||||
value += token;
|
||||
|
||||
token = peek();
|
||||
}
|
||||
|
||||
consume(); // skip ending quote;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var args: string[] = [];
|
||||
var currentArg = '';
|
||||
|
||||
while (position < tokens.length) {
|
||||
var token = peek();
|
||||
|
||||
if (token === '"') {
|
||||
currentArg += consumeQuotedString();
|
||||
} else if (token.match(/\s/)) {
|
||||
if (currentArg.length > 0) {
|
||||
args.push(currentArg);
|
||||
currentArg = '';
|
||||
}
|
||||
|
||||
consume();
|
||||
} else {
|
||||
consume();
|
||||
currentArg += token;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentArg.length > 0) {
|
||||
args.push(currentArg);
|
||||
}
|
||||
|
||||
this.parse(args);
|
||||
}
|
||||
|
||||
// Parse arguments as they come from the platform: split into arguments.
|
||||
public parse(args: string[]) {
|
||||
var position = 0;
|
||||
|
||||
function consume() {
|
||||
return args[position++];
|
||||
}
|
||||
|
||||
while (position < args.length) {
|
||||
var current = consume();
|
||||
var match = current.match(/^(--?|\/|@)(.*)/);
|
||||
var value = null;
|
||||
|
||||
if (match) {
|
||||
if (match[1] === '@') {
|
||||
this.parseString(IO.readFile(match[2]));
|
||||
} else {
|
||||
var arg = match[2];
|
||||
var option = this.findOption(arg);
|
||||
|
||||
if (option === null) {
|
||||
IO.printLine("Unknown option " + arg);
|
||||
IO.printLine("");
|
||||
this.printUsage();
|
||||
} else {
|
||||
if (!option.flag)
|
||||
value = consume();
|
||||
|
||||
option.set(value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.unnamed.push(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
[{"start":7,"end":11,"data":"(empty)"},{"start":11,"end":21,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\ntesting\tstring\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":21,"end":29,"data":"(empty)"},{"start":29,"end":31,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\ntesting\tstring\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":31,"end":34,"data":"(empty)"},{"start":34,"end":46,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\ntesting\tstring\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":46,"end":49,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":49,"end":55,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":55,"end":58,"data":"(empty)"},{"start":58,"end":71,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":71,"end":79,"data":"(empty)"},{"start":79,"end":118,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":118,"end":127,"data":"(empty)"},{"start":127,"end":141,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":141,"end":149,"data":"(empty)"},{"start":149,"end":164,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":164,"end":173,"data":"(empty)"},{"start":173,"end":181,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":181,"end":188,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":188,"end":190,"data":"(empty)"},{"start":190,"end":207,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\n(present standard item) any\tany\n(presenLine truncated
|
||||
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
[{"start":17,"end":31,"data":"0\t17\t34\t\ttesting\t\tFoo"},{"start":33,"end":34,"data":"0\t17\t34\t\ttesting\t\tFoo"},{"start":49,"end":60,"data":"0\t55\t180\t\tC1\t\t__GLO"},{"start":71,"end":79,"data":"0\t64\t88\t\tpubMeth\t\tC1"},{"start":82,"end":87,"data":"0\t55\t180\t\tC1\t\t__GLO"},{"start":118,"end":127,"data":"0\t110\t131\t\tprivMeth\t\tC1"},{"start":134,"end":151,"data":"0\t134\t153\t\tpubProp\t\tC1"},{"start":152,"end":153,"data":"0\t134\t153\t\tpubProp\t\tC1"},{"start":156,"end":175,"data":"0\t156\t177\t\tprivProp\t\tC1"},{"start":176,"end":177,"data":"0\t156\t177\t\tprivProp\t\tC1"},{"start":184,"end":192,"data":"0\t184\t201\t\tf\t\t__GLO"},{"start":192,"end":200,"data":"0\t55\t180\t\tC1\t\t__GLO"},{"start":200,"end":201,"data":"0\t184\t201\t\tf\t\t__GLO"},{"start":203,"end":206,"data":"0\t184\t201\t\tf\t\t__GLO"},{"start":221,"end":230,"data":"0\t221\t315\t\tM\t\t__GLO"},{"start":237,"end":252,"data":"0\t250\t289\t\tC\t\tM"},{"start":254,"end":267,"data":"0\t254\t269\t\tpub\t\tM.C"},{"start":268,"end":269,"data":"0\t254\t269\t\tpub\t\tM.C"},{"start":270,"end":285,"data":"0\t270\t287\t\tpriv\t\tM.C"},{"start":286,"end":287,"data":"0\t270\t287\t\tpriv\t\tM.C"},{"start":295,"end":310,"data":"0\t295\t312\t\tV\t\tM"},{"start":311,"end":312,"data":"0\t295\t312\t\tV\t\tM"},{"start":321,"end":329,"data":"0\t321\t339\t\tc\t\t__GLO"},{"start":329,"end":333,"data":"0\t250\t289\t\tC\t\tM"},{"start":333,"end":335,"data":"0\t221\t315\t\tM\t\t__GLO"},{"start":335,"end":338,"data":"0\t250\t289\t\tC\t\tM"},{"start":338,"end":339,"data":"0\t321\t339\t\tc\t\t__GLO"},{"start":343,"end":346,"data":"0\t321\t339\t\tc\t\t__GLO"}]
|
||||
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
[{"start":87,"end":88,"data":"pubMeth\t() => void\npubProp\tnumber\nprivMeth\t() => void\nprivProp\tnumber\n"},{"start":205,"end":206,"data":"pubMeth\t() => void\npubProp\tnumber\n"},{"start":335,"end":336,"data":"C\tnew() => M.C\nV\tnumber\n"},{"start":345,"end":346,"data":"pub\tnumber\n"}]
|
||||
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
[{"start":192,"end":200,"data":"C1(): C1\n"},{"start":329,"end":338,"data":"C(): C\n"}]
|
||||
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
[{"start":17,"end":34,"data":"string"},{"start":34,"end":39,"data":"Foo"},{"start":39,"end":43,"data":"any"},{"start":43,"end":45,"data":"Foo"},{"start":49,"end":64,"data":"new() => C1"},{"start":64,"end":82,"data":"() => void"},{"start":82,"end":87,"data":"C1"},{"start":87,"end":88,"data":"() => void"},{"start":88,"end":89,"data":"new() => C1"},{"start":108,"end":110,"data":"new() => C1"},{"start":110,"end":131,"data":"() => void"},{"start":131,"end":134,"data":"new() => C1"},{"start":134,"end":153,"data":"number"},{"start":153,"end":156,"data":"new() => C1"},{"start":156,"end":177,"data":"number"},{"start":177,"end":180,"data":"new() => C1"},{"start":184,"end":196,"data":"C1"},{"start":196,"end":198,"data":"new() => C1"},{"start":198,"end":201,"data":"C1"},{"start":203,"end":205,"data":"C1"},{"start":221,"end":237,"data":"M"},{"start":237,"end":254,"data":"new() => C"},{"start":254,"end":269,"data":"number"},{"start":269,"end":270,"data":"new() => C"},{"start":270,"end":287,"data":"number"},{"start":287,"end":289,"data":"new() => C"},{"start":289,"end":295,"data":"M"},{"start":295,"end":312,"data":"number"},{"start":312,"end":315,"data":"M"},{"start":321,"end":333,"data":"M.C"},{"start":333,"end":334,"data":"M"},{"start":334,"end":336,"data":"new() => M.C"},{"start":336,"end":339,"data":"M.C"},{"start":343,"end":345,"data":"M.C"}]
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
[{"start":10,"end":19,"data":"(empty)"},{"start":19,"end":26,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":26,"end":31,"data":"(empty)"},{"start":31,"end":45,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":45,"end":50,"data":"(empty)"},{"start":50,"end":62,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":62,"end":68,"data":"(empty)"},{"start":68,"end":82,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":82,"end":88,"data":"(empty)"},{"start":88,"end":102,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":102,"end":106,"data":"(empty)"},{"start":106,"end":108,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":108,"end":110,"data":"(empty)"},{"start":110,"end":133,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":133,"end":138,"data":"(empty)"},{"start":138,"end":150,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":150,"end":159,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":159,"end":173,"data":"(empty)"},{"start":173,"end":180,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":180,"end":186,"data":"(empty)"},{"start":186,"end":188,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":188,"end":207,"data":"(empty)"},{"start":207,"end":209,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":209,"end":213,"data":"(empty)"},{"start":213,"end":219,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":219,"end":225,"data":"(empty)"},{"start":225,"end":227,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":227,"end":245,"data":"(empty)"},{"start":245,"end":247,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":247,"end":252,"data":"(empty)"},{"start":252,"end":260,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":260,"end":296,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\narguments any\nhost any\n(standard items)"},{"start":296,"end":304,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":304,"end":378,"data":"(empty)"},{"start":378,"end":383,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":383,"end":391,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\narg string\narguments any\ni number\n(standard items)"},{"start":391,"end":406,"data":"(empty)"},{"start":406,"end":437,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\narg string\narguments any\ni number\n(standard items)"},{"start":437,"end":439,"data":"(empty)"},{"start":439,"end":658,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\narg string\narguments any\ni number\n(standard items)"},{"start":658,"end":665,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":665,"end":6Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
[{"start":26,"end":32,"data":"0\t26\t39\t\tname\t\tIOptions"},{"start":45,"end":51,"data":"0\t45\t56\t\tflag\t\tIOptions"},{"start":62,"end":69,"data":"0\t62\t76\t\tshort\t\tIOptions"},{"start":82,"end":89,"data":"0\t82\t96\t\tusage\t\tIOptions"},{"start":102,"end":107,"data":"0\t102\t127\t\tset\t\tIOptions"},{"start":108,"end":111,"data":"0\t108\t117\t\ts\t\t<global>"},{"start":133,"end":139,"data":"0\t133\t146\t\ttype\t\tIOptions"},{"start":153,"end":173,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":180,"end":209,"data":"0\t180\t212\t\tDEFAULT_SHORT_FLAG\t\tOptionsParser"},{"start":219,"end":247,"data":"0\t219\t251\t\tDEFAULT_LONG_FLAG\t\tOptionsParser"},{"start":260,"end":272,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":273,"end":287,"data":"0\t273\t290\t\thost\t\tOptionsParser"},{"start":291,"end":292,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":383,"end":391,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":391,"end":402,"data":"0\t383\t657\t\tfindOption\t\tOptionsParser"},{"start":402,"end":407,"data":"0\t402\t413\t\targ\t\tOptionsParser.findOption"},{"start":414,"end":415,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":433,"end":441,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":444,"end":446,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":448,"end":452,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":452,"end":461,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":469,"end":471,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":495,"end":499,"data":"0\t402\t413\t\targ\t\tOptionsParser.findOption"},{"start":503,"end":507,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":507,"end":516,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":516,"end":518,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":518,"end":525,"data":"0\t62\t76\t\tshort\t\tIOptions"},{"start":528,"end":532,"data":"0\t402\t413\t\targ\t\tOptionsParser.findOption"},{"start":536,"end":540,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":540,"end":549,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":549,"end":551,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":551,"end":557,"data":"0\t26\t39\t\tname\t\tIOptions"},{"start":577,"end":584,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":584,"end":588,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":588,"end":597,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":597,"end":599,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":599,"end":600,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":665,"end":681,"data":"0\t665\t694\t\tunnamed\t\tOptionsParser"},{"start":689,"end":692,"data":"0\t665\t694\t\tunnamed\t\tOptionsParser"},{"start":703,"end":719,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":719,"end":729,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":729,"end":732,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":732,"end":734,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":750,"end":761,"data":"0\t743\t2528\t\tprintUsage\t\tOptionsParser"},{"start":1102,"end":1115,"data":"0\t1102\t1118\t\toutput\t\tOptionsParser.printUsage"},{"start":1117,"end":1118,"data":"0\t1102\t1118\t\toutput\t\tOptionsParser.printUsage"},{"start":1128,"end":1144,"data":"0\t1128\t1146\t\tmaxLength\t\tOptionsParser.printUsage"},{"start":1145,"end":1146,"data":"0\t1128\t1146\t\tmaxLength\t\tOptionsParser.printUsage"},{"start":1158,"end":1162,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":1162,"end":1171,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":1173,"end":1177,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":1177,"end":1186,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":1200,"end":1202,"data":"0\t1200\t1201\t\ta\t\tOptionsParser.printUsage._anonymous"},{"start":1203,"end":1205,"data":"0\t1203\t1204\t\tb\t\tOptionsParser.printUsage._anonymous"},{"start":1221,"end":1233,"data":"0\t1221\t1254\t\taName\t\tOptionsParser.printUsage._anonymous"},{"start":1233,"end":1235,"data":"0\t1200\t1201\t\ta\t\tOptionsParser.printUsage._anonymous"},{"start":1253,"end":1254,"data":"0\t1221\t1254\t\taName\t\tOptionsParser.printUsage._anonymous"},{"start":1268,"end":1280,"data":"0\t1268\t1301\t\tbName\t\tOptionsParser.printUsage._anonymous"},{"start":1280,"end":1282,"data":"0\t1203\t1204\t\tb\t\tOptionsParser.printUsage._anonymous"},{"start":1300,"end":1301,"data":"0\t1268\t1301\t\tbName\t\tOptionsParser.printUsage._anonymous"},{"start":1321,"end":1327,"data":"0\t1221\t1254\t\taName\t\tOptionsParser.printUsage._anonymous"},{"start":1329,"end":1335,"data":"0\t1268\t1301\t\tbName\t\tOptionsParser.printUsage._anonymous"},{"start":1389,"end":1395,"data":"0\t1221\t1254\t\taName\t\tOptionsParser.printUsage._anonymous"},{"start":1397,"end":1403,"data":"0\t1268\t1301\t\tbName\t\tOptionsParser.printUsage._anonymous"},{"start":1561,"end":1569,"data":"0\t1561\t1570\t\ti\t\tOptionsParser.prinLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
[{"start":453,"end":454,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":508,"end":509,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":519,"end":520,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":541,"end":542,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":552,"end":553,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":589,"end":590,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1163,"end":1164,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1178,"end":1179,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1581,"end":1582,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1635,"end":1636,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1674,"end":1675,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":1775,"end":1776,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":1795,"end":1796,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":1846,"end":1847,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":1892,"end":1893,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1920,"end":1921,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":1991,"end":1992,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":2018,"end":2019,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":2079,"end":2080,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":2765,"end":2766,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tsLine truncated
|
||||
@@ -1,2 +0,0 @@
|
||||
[{"start":3649,"end":3659,"data":"consume(): any\n"},{"start":3710,"end":3716,"data":"peek(): any\n"},{"start":3783,"end":3793,"data":"consume(): any\n"},{"start":3856,"end":3862,"data":"peek(): any\n"},{"start":3894,"end":3904,"data":"consume(): any\n"},{"start":4104,"end":4110,"data":"peek(): any\n"},{"start":4179,"end":4200,"data":"consumeQuotedString(): string\n"},{"start":4413,"end":4423,"data":"consume(): any\n"},{"start":4463,"end":4473,"data":"consume(): any\n"},{"start":4636,"end":4653,"data":"parse(args: string[]): void\n"},{"start":4956,"end":4965,"data":"consume(): string\n"},{"start":5147,"end":5164,"data":"parseString(argString: string): void\n"},{"start":5185,"end":5187,"data":"parseString(argString: string): void\n"},{"start":5289,"end":5309,"data":"findOption(arg: string): IOptions\n"},{"start":5489,"end":5507,"data":"printUsage(): void\n"},{"start":5618,"end":5627,"data":"consume(): string\n"},{"start":5656,"end":5674,"data":"set(s: string): void\n"}]
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
[{"start":26,"end":39,"data":"string"},{"start":39,"end":45,"data":"IOptions"},{"start":45,"end":56,"data":"bool"},{"start":56,"end":62,"data":"IOptions"},{"start":62,"end":76,"data":"string"},{"start":76,"end":82,"data":"IOptions"},{"start":82,"end":96,"data":"string"},{"start":96,"end":102,"data":"IOptions"},{"start":102,"end":108,"data":"(s: string) => void"},{"start":108,"end":117,"data":"string"},{"start":117,"end":122,"data":"(s: string) => void"},{"start":122,"end":126,"data":"void"},{"start":126,"end":127,"data":"(s: string) => void"},{"start":127,"end":133,"data":"IOptions"},{"start":133,"end":146,"data":"string"},{"start":146,"end":149,"data":"IOptions"},{"start":153,"end":180,"data":"new(host: any) => OptionsParser"},{"start":180,"end":212,"data":"string"},{"start":212,"end":219,"data":"new(host: any) => OptionsParser"},{"start":219,"end":251,"data":"string"},{"start":251,"end":273,"data":"new(host: any) => OptionsParser"},{"start":273,"end":290,"data":"any"},{"start":290,"end":303,"data":"new(host: any) => OptionsParser"},{"start":378,"end":383,"data":"new(host: any) => OptionsParser"},{"start":383,"end":402,"data":"(arg: string) => IOptions"},{"start":402,"end":413,"data":"string"},{"start":413,"end":428,"data":"(arg: string) => IOptions"},{"start":428,"end":433,"data":"void"},{"start":433,"end":442,"data":"number"},{"start":442,"end":444,"data":"void"},{"start":444,"end":445,"data":"number"},{"start":445,"end":448,"data":"bool"},{"start":448,"end":452,"data":"OptionsParser"},{"start":452,"end":460,"data":"IOptions[]"},{"start":460,"end":467,"data":"any"},{"start":467,"end":469,"data":"void"},{"start":469,"end":472,"data":"number"},{"start":472,"end":495,"data":"void"},{"start":495,"end":498,"data":"string"},{"start":498,"end":503,"data":"bool"},{"start":503,"end":507,"data":"OptionsParser"},{"start":507,"end":515,"data":"IOptions[]"},{"start":515,"end":516,"data":"IOptions"},{"start":516,"end":517,"data":"number"},{"start":517,"end":518,"data":"IOptions"},{"start":518,"end":524,"data":"string"},{"start":524,"end":528,"data":"bool"},{"start":528,"end":531,"data":"string"},{"start":531,"end":536,"data":"bool"},{"start":536,"end":540,"data":"OptionsParser"},{"start":540,"end":548,"data":"IOptions[]"},{"start":548,"end":549,"data":"IOptions"},{"start":549,"end":550,"data":"number"},{"start":550,"end":551,"data":"IOptions"},{"start":551,"end":556,"data":"string"},{"start":556,"end":577,"data":"void"},{"start":577,"end":584,"data":"IOptions"},{"start":584,"end":588,"data":"OptionsParser"},{"start":588,"end":596,"data":"IOptions[]"},{"start":596,"end":597,"data":"IOptions"},{"start":597,"end":598,"data":"number"},{"start":598,"end":600,"data":"IOptions"},{"start":600,"end":626,"data":"void"},{"start":626,"end":638,"data":"(arg: string) => IOptions"},{"start":638,"end":650,"data":"any"},{"start":650,"end":657,"data":"(arg: string) => IOptions"},{"start":657,"end":665,"data":"new(host: any) => OptionsParser"},{"start":665,"end":681,"data":"string[]"},{"start":681,"end":687,"data":"string"},{"start":687,"end":694,"data":"string[]"},{"start":694,"end":703,"data":"new(host: any) => OptionsParser"},{"start":703,"end":719,"data":"IOptions[]"},{"start":719,"end":727,"data":"IOptions"},{"start":727,"end":734,"data":"IOptions[]"},{"start":734,"end":743,"data":"new(host: any) => OptionsParser"},{"start":743,"end":774,"data":"() => void"},{"start":774,"end":787,"data":"any"},{"start":787,"end":826,"data":"string"},{"start":826,"end":828,"data":"any"},{"start":828,"end":838,"data":"() => void"},{"start":838,"end":851,"data":"any"},{"start":851,"end":853,"data":"string"},{"start":853,"end":855,"data":"any"},{"start":855,"end":865,"data":"() => void"},{"start":865,"end":878,"data":"any"},{"start":878,"end":907,"data":"string"},{"start":907,"end":909,"data":"any"},{"start":909,"end":919,"data":"() => void"},{"start":919,"end":932,"data":"any"},{"start":932,"end":972,"data":"string"},{"start":972,"end":974,"data":"any"},{"start":974,"end":984,"data":"() => void"},{"start":984,"end":997,"data":"any"},{"start":997,"end":1026,"data":"string"},{"start":1026,"end":1028,"data":"any"},{"start":1028,"end":1038,"data":"() => void"},{"start":1038,"end":1051,"data":"any"},{"start":1051,"end":1053,"data":"string"},{"start":1053,"end":1055,"data":"any"},{"start":1055,"end":1065,"data":"() => void"},{"start":1065,"end":1078,"data":"any"},{"start":1078,"end":1088,"data":"string"},{"start":1088,"end":1090,"data":"any"},{"start":1090,"end":1102,"data":"() => void"},{"start":1102,"end":1118,"data":"any[]"},{"start":1118,"end":1128,"data":"() => void"},{"start":1128,"end":1146,"data":"number"},{"start":1146,"end":1158,"data":"() => void"},{"start":1158,"end":1162,"data":"OptionsParser"},{"start":1162,"end":1170,"data":"IOptions[]"},{"start":1170,"end":1173,"data":"any"},{"start":1173,"end":1177,"data":"OptionsParser"},{"start":1177,"end":1185,"data":"IOptions[]"},{"start":1185,"end":1190,"data":"any"},{"start":1190,"end":1191,"data":"Line truncated
|
||||
@@ -1,3 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
DumpAST.compareDumpFilesWithBaseline();
|
||||
@@ -1,9 +0,0 @@
|
||||
///<reference path='..\..\..\harness\dumpAST-baselining.ts'/>
|
||||
|
||||
describe('dumpAST-create-baselines', function() {
|
||||
describe("create test baseline files for AST source locations", function() {
|
||||
it("create baseline files", function() {
|
||||
DumpAST.generateBaselineFiles();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,220 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
debugger;
|
||||
|
||||
describe('getCompletionsAtPosition', function () {
|
||||
var typescriptLS = new Harness.TypeScriptLS();
|
||||
|
||||
typescriptLS.addDefaultLibrary();
|
||||
|
||||
var fileName = 'tests/cases/unittests/services/testCode/getCompletionsAtPosition1.ts';
|
||||
var fileName2 = 'tests/cases/unittests/services/testCode/getCompletionsAtPosition2.ts';
|
||||
var fileName3 = 'tests/cases/unittests/services/testCode/getCompletionsAtPosition3.ts';
|
||||
var fileName4 = 'tests/cases/unittests/services/testCode/getCompletionsAtPosition4.ts';
|
||||
var fileName5 = 'tests/cases/unittests/services/testCode/getCompletionsAtPosition5.ts';
|
||||
var fileName6 = 'tests/cases/unittests/services/testCode/getCompletionsAtPosition6.ts';
|
||||
var fileName7 = 'tests/cases/unittests/services/testCode/getCompletionsAtPosition7.ts';
|
||||
var fileName8 = 'tests/cases/unittests/services/testCode/getCompletionsAtPosition8.ts';
|
||||
var fileName9 = 'tests/cases/unittests/services/testCode/getCompletionsAtPosition9.ts';
|
||||
var fileName10 = 'tests/cases/unittests/services/testCode/getCompletionsAtPosition10.ts';
|
||||
var fileNameBugFixes = 'tests/cases/unittests/services/testCode/getCompletionsAtPositionBugFixes.ts';
|
||||
|
||||
typescriptLS.addFile(fileName);
|
||||
typescriptLS.addFile(fileName2);
|
||||
typescriptLS.addFile(fileName3);
|
||||
typescriptLS.addFile(fileName4);
|
||||
typescriptLS.addFile(fileName5);
|
||||
typescriptLS.addFile(fileName6);
|
||||
typescriptLS.addFile(fileName7);
|
||||
typescriptLS.addFile(fileName8);
|
||||
typescriptLS.addFile(fileName9);
|
||||
typescriptLS.addFile(fileName10);
|
||||
typescriptLS.addFile(fileNameBugFixes);
|
||||
|
||||
var ls = typescriptLS.getLanguageService();
|
||||
|
||||
//
|
||||
// line and column are 1-based
|
||||
//
|
||||
function lineColToPosition(fileName: string, line: number, col: number): number {
|
||||
var script = ls.languageService.getScriptAST(fileName);
|
||||
assert.notNull(script);
|
||||
|
||||
var lineMap = script.locationInfo.lineMap;
|
||||
|
||||
assert.is(line >= 1);
|
||||
assert.is(col >= 1);
|
||||
assert.is(line <= lineMap.length);
|
||||
var offset = lineMap[line - 1] + (col - 1);
|
||||
|
||||
assert.is(offset < script.limChar);
|
||||
return offset;
|
||||
}
|
||||
|
||||
//
|
||||
// line and column are 1-based
|
||||
//
|
||||
function getCompletionList(fileName, line, column, isMemberCompletion) {
|
||||
var position = lineColToPosition(fileName, line, column);
|
||||
return ls.languageService.getCompletionsAtPosition(fileName, position, isMemberCompletion);
|
||||
}
|
||||
|
||||
describe("test cases for completion list", function () {
|
||||
|
||||
//it("contains a private variable defined in a module", function () {
|
||||
// var result = ls.languageService.getCompletionsAtPosition(fileName, 45, false);
|
||||
// assert.arrayContainsOnce(result.entries, (x: Services.CompletionEntry) => x.name == "testing" && x.type == "string");
|
||||
//});
|
||||
|
||||
//it("'this.' member completion for class containing privates", function () {
|
||||
// var result = ls.languageService.getCompletionsAtPosition(fileName, 85, true);
|
||||
// assert.arrayContainsOnce(result.entries, (x: Services.CompletionEntry) => x.name == "privMeth" && x.type == "() => void");
|
||||
// assert.arrayContainsOnce(result.entries, (x: Services.CompletionEntry) => x.name == "pubMeth" && x.type == "() => void");
|
||||
// assert.arrayContainsOnce(result.entries, (x: Services.CompletionEntry) => x.name == "pubProp" && x.type == "number");
|
||||
//});
|
||||
|
||||
//it("member completion for class containing privates, outside of class scope", function () {
|
||||
// var result = ls.languageService.getCompletionsAtPosition(fileName, 203, true);
|
||||
|
||||
// assert.arrayContainsOnce(result.entries, (x: Services.CompletionEntry) => x.name == "pubMeth" && x.type == "() => void");
|
||||
// assert.arrayContainsOnce(result.entries, (x: Services.CompletionEntry) => x.name == "pubProp" && x.type == "number");
|
||||
//});
|
||||
|
||||
//it("member completion for module-exported class containing privates, outside of class and module scopes", function () {
|
||||
// var result = ls.languageService.getCompletionsAtPosition(fileName, 343, true);
|
||||
// assert.notNull(result);
|
||||
// assert.notNull(result.entries);
|
||||
// assert.equal(true, result.isMemberCompletion);
|
||||
// assert.arrayContainsOnce(result.entries, (x: Services.CompletionEntry) => x.name == "pub" && x.type == "number");
|
||||
|
||||
//});
|
||||
|
||||
//it("member completion for dotted typeref works", function () {
|
||||
// assert.equal(125, lineColToPosition(fileName2, 12, 11));
|
||||
// var result = getCompletionList(fileName2, 12, 11, true);
|
||||
// assert.notEqual(null, result);
|
||||
// assert.notEqual(null, result.entries);
|
||||
// assert.equal(true, result.isMemberCompletion);
|
||||
// assert.equal(2, result.entries.length);
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "Bar"; });
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "Blah"; });
|
||||
//});
|
||||
|
||||
// Negative Cases
|
||||
it("doesnt return anything from a comment-1", function () {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName, lineColToPosition(fileName, 23, 5), true);
|
||||
assert.equal(result.isMemberCompletion, true);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
|
||||
it("doesnt return anything from a comment-2", function () {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName, lineColToPosition(fileName, 23, 5), false);
|
||||
assert.equal(result.isMemberCompletion, false);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
|
||||
it("doesnt return anything from a comment-3", function () {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName, lineColToPosition(fileName, 23, 6), true);
|
||||
assert.equal(result.isMemberCompletion, true);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
|
||||
it("doesnt return anything from a comment-4", function () {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName, lineColToPosition(fileName, 23, 6), false);
|
||||
assert.equal(result.isMemberCompletion, false);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
|
||||
it("checks for completion in comment", function () {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName3, lineColToPosition(fileName3, 1, 4), false);
|
||||
assert.equal(result.isMemberCompletion, false);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
|
||||
/*
|
||||
it("checks for completion in var decl", function() {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName3, lineColToPosition(fileName3, 2, 5), false);
|
||||
assert.equal(result.wasMemberCompletion, false);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
|
||||
|
||||
it("checks for completion in class decl", function() {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName4, lineColToPosition(fileName4, 1, 7), false);
|
||||
assert.equal(result.wasMemberCompletion, false);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
|
||||
|
||||
it("checks for completion in module decl", function() {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName5, lineColToPosition(fileName5, 1, 7), false);
|
||||
assert.equal(result.wasMemberCompletion, false);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
|
||||
it("checks for completion in interface decl", function() {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName6, lineColToPosition(fileName6, 1, 11), false);
|
||||
assert.equal(result.wasMemberCompletion, false);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
|
||||
|
||||
it("checks for completion in function decl", function() {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName7, lineColToPosition(fileName7, 1, 10), false);
|
||||
assert.equal(result.wasMemberCompletion, false);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
*/
|
||||
|
||||
it("checks for completion after single dot", function () {
|
||||
var result = ls.languageService.getCompletionsAtPosition(fileName8, lineColToPosition(fileName8, 1, 1), true);
|
||||
assert.equal(result.isMemberCompletion, true);
|
||||
assert.equal(result.entries.length, 0);
|
||||
});
|
||||
|
||||
//it("checks for completion at declaration of parameter type", function () {
|
||||
// var result = ls.languageService.getCompletionsAtPosition(fileName9, lineColToPosition(fileName9, 9, 17), false);
|
||||
// assert.equal(result.isMemberCompletion, false);
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "Bar"; });
|
||||
//});
|
||||
|
||||
//it("checks for completion after class extends", function () {
|
||||
// var result = ls.languageService.getCompletionsAtPosition(fileName9, lineColToPosition(fileName9, 5, 30), false);
|
||||
// assert.equal(result.isMemberCompletion, false);
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "Bar"; });
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "Bleah"; });
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "Foo"; });
|
||||
//});
|
||||
|
||||
//it("checks for completion at reference to function parameter", function () {
|
||||
// var result = ls.languageService.getCompletionsAtPosition(fileName10, lineColToPosition(fileName10, 4, 31), true);
|
||||
// assert.equal(result.isMemberCompletion, true);
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "charAt"; });
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "charCodeAt"; });
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "length"; });
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "concat"; });
|
||||
//});
|
||||
|
||||
//it("checks for completion at enum", function () {
|
||||
// var result = ls.languageService.getCompletionsAtPosition(fileNameBugFixes, lineColToPosition(fileNameBugFixes, 7, 22), true);
|
||||
// assert.equal(result.isMemberCompletion, true);
|
||||
// assert.equal(result.entries.length, 2);
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "bar"; });
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "baz"; });
|
||||
//});
|
||||
|
||||
//it("checks for completion at imported enum", function () {
|
||||
// var result = ls.languageService.getCompletionsAtPosition(fileNameBugFixes, lineColToPosition(fileNameBugFixes, 10, 9), true);
|
||||
// assert.equal(result.isMemberCompletion, true);
|
||||
// assert.equal(result.entries.length, 2);
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "bar"; });
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "baz"; });
|
||||
//});
|
||||
|
||||
//it("checks for completion inside target typed function", function () {
|
||||
// var result = ls.languageService.getCompletionsAtPosition(fileNameBugFixes, lineColToPosition(fileNameBugFixes, 15, 40), false);
|
||||
// assert.equal(result.isMemberCompletion, false);
|
||||
// assert.arrayContainsOnce(result.entries, function (item: Services.CompletionEntry) { return item.name === "elem" && item.type === "string"; });
|
||||
//});
|
||||
});
|
||||
});
|
||||
@@ -1,55 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
describe('getCompletionsAtPositionAfterEdits', function () {
|
||||
var typescriptLS = new Harness.TypeScriptLS();
|
||||
|
||||
typescriptLS.addDefaultLibrary();
|
||||
|
||||
var fileName = 'tests/cases/unittests/services/testCode/getCompletionsAtPositionAfterEdits.ts';
|
||||
var fileName2 = 'otherScript.ts';
|
||||
|
||||
typescriptLS.addFile(fileName);
|
||||
typescriptLS.addScript(fileName2, typescriptLS.getScriptContent(1));
|
||||
|
||||
var ls = typescriptLS.getLanguageService();
|
||||
|
||||
//
|
||||
// line and column are 1-based
|
||||
//
|
||||
function getCompletionList(fileName: string, position: number, isMemberCompletion: boolean): Services.CompletionInfo {
|
||||
return ls.languageService.getCompletionsAtPosition(fileName, position, isMemberCompletion);
|
||||
}
|
||||
|
||||
function typeCharacters(fileName: string, line: number, column: number, text: string): number {
|
||||
var pos = typescriptLS.lineColToPosition(fileName, line, column);
|
||||
for (var i = 0; i < text.length; i++) {
|
||||
typescriptLS.editScript(fileName, pos, pos, text.charAt(i));
|
||||
pos++;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
describe("test cases for completion list after edits inside source file", function () {
|
||||
|
||||
it("verify function arguments are available after edits at end of function", function () {
|
||||
// Apply edit
|
||||
var pos = typescriptLS.lineColToPosition(fileName, 5, 13);
|
||||
var text = "this.children = ch";
|
||||
typescriptLS.editScript(fileName, pos, pos, text);
|
||||
var result = getCompletionList(fileName, pos + text.length - 2 /*ch*/, false);
|
||||
var entry = result.entries.filter(x => x.name == "children");
|
||||
assert.notNull(entry);
|
||||
assert.equal(1, entry.length);
|
||||
});
|
||||
|
||||
it("verify function arguments are available after edits at end of function after multiple edits", function () {
|
||||
// Apply edit
|
||||
var text = "this.children = ch";
|
||||
var pos = typeCharacters(fileName2, 5, 13, text);
|
||||
var result = getCompletionList(fileName2, pos - 2 /*ch*/, false);
|
||||
var entry = result.entries.filter(x => x.name == "children");
|
||||
assert.notNull(entry);
|
||||
assert.equal(1, entry.length);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,100 +0,0 @@
|
||||
/////<reference path='_project.ts'/>
|
||||
|
||||
//describe('getCompletionsAtPositionObjectLiterals', function () {
|
||||
// var typescriptls = new Harness.TypeScriptLS();
|
||||
|
||||
// typescriptls.addDefaultLibrary();
|
||||
|
||||
// var fileNameObjectLiterals = 'tests/cases/unittests/services/testCode/getCompletionsAtPositionObjectLiterals.ts';
|
||||
|
||||
// typescriptls.addFile(fileNameObjectLiterals);
|
||||
|
||||
// var ls = typescriptls.getLanguageService();
|
||||
|
||||
// //
|
||||
// // line and column are 1-based
|
||||
// //
|
||||
// function getCompletionList(fileName: string, line: number, column: number, isMemberCompletion: boolean): Services.CompletionInfo {
|
||||
// var position = typescriptls.lineColToPosition(fileName, line, column);
|
||||
// return ls.languageService.getCompletionsAtPosition(fileName, position, isMemberCompletion);
|
||||
// }
|
||||
|
||||
// function assertIsMemberCompletions(result: Services.CompletionInfo) {
|
||||
// assert.notNull(result);
|
||||
// assert.is(result.isMemberCompletion, "isMemberCompletion should be set");
|
||||
// assert.is(!result.maybeInaccurate, "CompletionInfo should be accurate");
|
||||
// assert.is(result.entries.length == 2, "Completion should contain only 2 members of object literal");
|
||||
// assert.arrayContainsOnce(result.entries, (x: Services.CompletionEntry) => x.name == "x1" && x.type == "number");
|
||||
// assert.arrayContainsOnce(result.entries, (x: Services.CompletionEntry) => x.name == "y1" && x.type == "number");
|
||||
// }
|
||||
|
||||
// function assertIsGlobalCompletions(result: Services.CompletionInfo) {
|
||||
// assert.notNull(result);
|
||||
// assert.is(!result.isMemberCompletion, "isMemberCompletion should be not be set");
|
||||
// assert.is(!result.maybeInaccurate, "CompletionInfo should be accurate");
|
||||
// assert.is(result.entries.length >= 10, "Completion should be global completion set");
|
||||
// }
|
||||
|
||||
// function assertIsNoCompletions(result: Services.CompletionInfo) {
|
||||
// assert.notNull(result);
|
||||
// assert.is(result.entries.length == 0, "Completion should be empty (i.e. no completion)");
|
||||
// }
|
||||
|
||||
// describe("test cases for completion list inside object literals", function () {
|
||||
// it("Literal member completion inside empty literal", function () {
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 8, 9, false);
|
||||
// assertIsMemberCompletions(result);
|
||||
// });
|
||||
|
||||
// it("Literal member completion for 2nd member name", function () {
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 13, 9, false);
|
||||
// assertIsMemberCompletions(result);
|
||||
// });
|
||||
|
||||
// it("Literal member completion at existing member name location", function () {
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 17, 9, false);
|
||||
// assertIsMemberCompletions(result);
|
||||
// });
|
||||
|
||||
// it("Literal member completion after existing member name location", function () {
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 17, 12, false);
|
||||
// assertIsMemberCompletions(result);
|
||||
// });
|
||||
|
||||
// });
|
||||
|
||||
// describe("test cases for global completion list inside object literals", function () {
|
||||
// it("Literal member completion after member name with empty member expression and missing colon", function () {
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 27, 13, false);
|
||||
// assertIsGlobalCompletions(result);
|
||||
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 28, 5, false);
|
||||
// assertIsGlobalCompletions(result);
|
||||
// });
|
||||
|
||||
// it("Literal member completion after member name with empty member expression", function () {
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 31, 13, false);
|
||||
// assertIsGlobalCompletions(result);
|
||||
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 31, 22, false);
|
||||
// assertIsGlobalCompletions(result);
|
||||
// });
|
||||
|
||||
// it("No completion on '{' location", function () {
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 7, 23, false);
|
||||
// assertIsGlobalCompletions(result);
|
||||
// });
|
||||
// });
|
||||
|
||||
// describe("test cases for no completion list inside object literals", function () {
|
||||
// it("No completion on comments (1)", function () {
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 8, 12, false);
|
||||
// assertIsNoCompletions(result);
|
||||
// });
|
||||
|
||||
// it("No completion on comments (2)", function () {
|
||||
// var result = getCompletionList(fileNameObjectLiterals, 8, 18, false);
|
||||
// assertIsNoCompletions(result);
|
||||
// });
|
||||
// });
|
||||
//});
|
||||
@@ -1,193 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
describe('getDefinitionPositionAtPosition', function() {
|
||||
var typescriptLS = new Harness.TypeScriptLS();
|
||||
|
||||
typescriptLS.addDefaultLibrary();
|
||||
|
||||
var fileName = 'tests/cases/unittests/services/testCode/getDefinitionsAtPosition.ts';
|
||||
var fileName2 = 'tests/cases/unittests/services/testCode/getDefinitionsAtPosition2.ts';
|
||||
var fileName3 = 'tests/cases/unittests/services/testCode/getDefinitionsAtPosition3.ts';
|
||||
|
||||
typescriptLS.addFile(fileName);
|
||||
typescriptLS.addFile(fileName2);
|
||||
typescriptLS.addFile(fileName3);
|
||||
|
||||
var ls = typescriptLS.getLanguageService();
|
||||
|
||||
function lineToOffset(line: number, col = 0, sFile?) {
|
||||
var script: TypeScript.Script;
|
||||
if (sFile) {
|
||||
if (sFile === 1){
|
||||
script = ls.languageService.getScriptAST(fileName);
|
||||
} else if (sFile === 2) {
|
||||
script = ls.languageService.getScriptAST(fileName2);
|
||||
} else if (sFile === 3){
|
||||
script = ls.languageService.getScriptAST(fileName3);
|
||||
}
|
||||
}
|
||||
else {
|
||||
script = ls.languageService.getScriptAST(fileName);
|
||||
}
|
||||
return script.locationInfo.lineMap[line - 1] + col;
|
||||
}
|
||||
|
||||
function definitionAtPos(line: number, col: number) {
|
||||
var result = ls.getDefinitionAtPosition(fileName, lineToOffset(line, col));
|
||||
if (result.substr(0,9) === "##ERROR##") {
|
||||
return null;
|
||||
}
|
||||
var parts = result.split('\t');
|
||||
var defScriptIndex = parts[0];
|
||||
var defPosition = parts[1];
|
||||
return { index : defScriptIndex, pos : defPosition }
|
||||
}
|
||||
|
||||
function verifyDefinition(indexAndPos: {index: string; pos: string;}, line: number, col: number, fileNum: number) {
|
||||
if (indexAndPos.index !== fileNum.toString()) {
|
||||
throw new Error("Expected file index to be " + fileNum + " but it was " + indexAndPos.index + " instead.");
|
||||
}
|
||||
if (indexAndPos.pos!== lineToOffset(line, col, fileNum).toString()) {
|
||||
throw new Error("Expected offset to be " + lineToOffset(line, col, fileNum).toString() + " but it was " + indexAndPos.pos + " instead.");
|
||||
}
|
||||
}
|
||||
|
||||
describe('GoTo Definition', function() {
|
||||
/*
|
||||
LOCAL
|
||||
*/
|
||||
|
||||
it("A variable that is defined in the same file", function() {
|
||||
var indexAndPos = definitionAtPos(8, 0);
|
||||
verifyDefinition(indexAndPos, 2, 0, 1);
|
||||
});
|
||||
|
||||
it("A function that is defined in the same file", function() {
|
||||
var indexAndPos = definitionAtPos(9, 0);
|
||||
verifyDefinition(indexAndPos, 3, 0, 1);
|
||||
});
|
||||
|
||||
it("A class that is defined in the same file", function() {
|
||||
var indexAndPos = definitionAtPos(10, 16);
|
||||
verifyDefinition(indexAndPos, 4, 0, 1);
|
||||
});
|
||||
|
||||
it("An interface that is defined in the same file", function() {
|
||||
var indexAndPos = definitionAtPos(11, 26);
|
||||
verifyDefinition(indexAndPos, 5, 0, 1);
|
||||
});
|
||||
|
||||
it("A module that is defined in the same file", function() {
|
||||
var indexAndPos = definitionAtPos(12, 15);
|
||||
verifyDefinition(indexAndPos, 6, 0, 1);
|
||||
});
|
||||
|
||||
/*
|
||||
REMOTE
|
||||
*/
|
||||
|
||||
it("A variable that is defined in a remote file", function() {
|
||||
var indexAndPos = definitionAtPos(14, 0);
|
||||
verifyDefinition(indexAndPos, 2, 0, 2);
|
||||
});
|
||||
|
||||
it("A function that is defined in a remote file", function() {
|
||||
var indexAndPos = definitionAtPos(15, 0);
|
||||
verifyDefinition(indexAndPos, 3, 0, 2);
|
||||
});
|
||||
|
||||
it("A class that is defined in a remote file", function() {
|
||||
var indexAndPos = definitionAtPos(16, 19);
|
||||
verifyDefinition(indexAndPos, 4, 0, 2);
|
||||
});
|
||||
|
||||
it("An interface that is defined in a remote file", function() {
|
||||
var indexAndPos = definitionAtPos(17, 29);
|
||||
verifyDefinition(indexAndPos, 5, 0, 2);
|
||||
});
|
||||
|
||||
it("A module that is defined in a remote file", function() {
|
||||
var indexAndPos = definitionAtPos(18, 18);
|
||||
verifyDefinition(indexAndPos, 6, 0, 2);
|
||||
});
|
||||
|
||||
/*
|
||||
REMOTE -> REMOTE
|
||||
*/
|
||||
|
||||
it("A variable that is defined in a remote file that is referenced from a remote file", function() {
|
||||
var indexAndPos = definitionAtPos(20, 0);
|
||||
verifyDefinition(indexAndPos, 1, 0, 3);
|
||||
});
|
||||
|
||||
it("A function that is defined in a remote file that is referenced from a remote file", function() {
|
||||
var indexAndPos = definitionAtPos(21, 0);
|
||||
verifyDefinition(indexAndPos, 2, 0, 3);
|
||||
});
|
||||
|
||||
it("A class that is defined in a remote file that is referenced from a remote file", function() {
|
||||
var indexAndPos = definitionAtPos(22, 19);
|
||||
verifyDefinition(indexAndPos, 3, 0, 3);
|
||||
});
|
||||
|
||||
it("An interface that is defined in a remote file that is referenced from a remote file", function() {
|
||||
var indexAndPos = definitionAtPos(23, 29);
|
||||
verifyDefinition(indexAndPos, 4, 0, 3);
|
||||
});
|
||||
|
||||
it("A module that is defined in a remote file that is referenced from a remote file", function() {
|
||||
var indexAndPos = definitionAtPos(24, 18);
|
||||
verifyDefinition(indexAndPos, 5, 0, 3);
|
||||
});
|
||||
|
||||
/*
|
||||
Others
|
||||
*/
|
||||
|
||||
it("A shadowed variable inside a module", function() {
|
||||
var indexAndPos = definitionAtPos(29, 6);
|
||||
verifyDefinition(indexAndPos, 28, 4, 1);
|
||||
});
|
||||
|
||||
it("A function being overloaded on global - 1", function() {
|
||||
var indexAndPos = definitionAtPos(32, 9);
|
||||
verifyDefinition(indexAndPos, 34, 0, 1);
|
||||
});
|
||||
|
||||
it("A function being overloaded on global - 2", function() {
|
||||
var indexAndPos = definitionAtPos(36, 0);
|
||||
verifyDefinition(indexAndPos, 34, 0, 1);
|
||||
});
|
||||
|
||||
it("Constructor being overloaded in class", function() {
|
||||
var indexAndPos = definitionAtPos(40, 4);
|
||||
verifyDefinition(indexAndPos, 42, 4, 1);
|
||||
});
|
||||
|
||||
it("A function being overloaded in class - 1", function() {
|
||||
var indexAndPos = definitionAtPos(52, 11);
|
||||
verifyDefinition(indexAndPos, 54, 4, 1);
|
||||
});
|
||||
|
||||
it("A static function being overloaded in class - 1", function() {
|
||||
var indexAndPos = definitionAtPos(50, 11);
|
||||
verifyDefinition(indexAndPos, 51, 4, 1);
|
||||
});
|
||||
|
||||
it("Calling a static function of a class", function() {
|
||||
var indexAndPos = definitionAtPos(63, 19);
|
||||
verifyDefinition(indexAndPos, 51, 4, 1);
|
||||
});
|
||||
|
||||
it("A class implementing an interface", function() {
|
||||
var indexAndPos = definitionAtPos(83, 24);
|
||||
verifyDefinition(indexAndPos, 78, 0, 1);
|
||||
});
|
||||
|
||||
it("An ambient variable", function() {
|
||||
var indexAndPos = definitionAtPos(91, 0);
|
||||
verifyDefinition(indexAndPos, 89, 0, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
describe('getDefinitionPositionAtPositionPartialInterface', function() {
|
||||
var typescriptLS = new Harness.TypeScriptLS();
|
||||
|
||||
typescriptLS.addDefaultLibrary();
|
||||
|
||||
var fileName = 'tests/cases/unittests/services/testCode/getDefinitionsAtPositionPartialInterface1.ts';
|
||||
var fileName2 = 'tests/cases/unittests/services/testCode/getDefinitionsAtPositionPartialInterface2.ts';
|
||||
|
||||
typescriptLS.addFile(fileName);
|
||||
typescriptLS.addFile(fileName2);
|
||||
|
||||
var ls = typescriptLS.getLanguageService()
|
||||
function definitionAtPos(fileName:string, line: number, col: number) {
|
||||
return ls.languageService.getDefinitionAtPosition(fileName, typescriptLS.lineColToPosition(fileName, line, col));
|
||||
}
|
||||
|
||||
describe('GoTo Definition', function() {
|
||||
it("returns the location of the first part of a partial interface", function() {
|
||||
var def = definitionAtPos(fileName2, 8, 13);
|
||||
assert.notNull(def);
|
||||
assert.equal(def.unitIndex, 1);
|
||||
assert.equal(typescriptLS.positionToZeroBasedLineCol(fileName, def.minChar).line + 1, 2);
|
||||
assert.equal(typescriptLS.positionToZeroBasedLineCol(fileName, def.minChar).col + 1, 5);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
describe('getImplementorsAtPosition', function () {
|
||||
var typescriptLS = new Harness.TypeScriptLS();
|
||||
|
||||
typescriptLS.addDefaultLibrary();
|
||||
|
||||
var fileName = 'tests/cases/unittests/services/testCode/getImplementorsAtPosition.ts';
|
||||
|
||||
typescriptLS.addFile(fileName);
|
||||
|
||||
var ls = typescriptLS.getLanguageService();
|
||||
|
||||
|
||||
function getImplementorsAtPos(fileName:string, line: number, col: number): Services.ReferenceEntry[] {
|
||||
var pos = typescriptLS.lineColToPosition(fileName, line, col);
|
||||
|
||||
return ls.languageService.getImplementorsAtPosition(fileName, pos);
|
||||
}
|
||||
|
||||
describe('Get Implementors At Position Simple Tests', function () {
|
||||
it("Find derived class from base class", function() {
|
||||
var result = getImplementorsAtPos(fileName, 2, 12);
|
||||
assert.notNull(result);
|
||||
assert.equal(2, result.length);
|
||||
});
|
||||
|
||||
it("Should not find base class from derived class", function() {
|
||||
var result = getImplementorsAtPos(fileName, 6, 12);
|
||||
assert.notNull(result);
|
||||
assert.equal(1, result.length);
|
||||
});
|
||||
|
||||
it("Find derived interface from base interface", function() {
|
||||
var result = getImplementorsAtPos(fileName, 13, 16);
|
||||
assert.notNull(result);
|
||||
assert.equal(2, result.length);
|
||||
});
|
||||
|
||||
it("Should not find base interface from derived interface", function() {
|
||||
var result = getImplementorsAtPos(fileName, 16, 16);
|
||||
assert.notNull(result);
|
||||
assert.equal(1, result.length);
|
||||
});
|
||||
|
||||
it("Find dervied class from base interface", function() {
|
||||
var result = getImplementorsAtPos(fileName, 22, 16);
|
||||
assert.notNull(result);
|
||||
assert.equal(2, result.length);
|
||||
});
|
||||
|
||||
it("Should not find base interface from derived class", function() {
|
||||
var result = getImplementorsAtPos(fileName, 25, 12);
|
||||
assert.notNull(result);
|
||||
assert.equal(1, result.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Get Implementors At Position Complex Tests', function () {
|
||||
it("Find derived classes and interfaces from top level interface", function() {
|
||||
var result = getImplementorsAtPos(fileName, 32, 17);
|
||||
assert.notNull(result);
|
||||
assert.equal(6, result.length);
|
||||
});
|
||||
|
||||
it("Find derived classes and interfaces from middle interface", function() {
|
||||
var result = getImplementorsAtPos(fileName, 41, 18);
|
||||
assert.notNull(result);
|
||||
assert.equal(4, result.length);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
debugger;
|
||||
|
||||
describe('getReferencesAtPosition', function() {
|
||||
var typescriptLS = new Harness.TypeScriptLS();
|
||||
|
||||
typescriptLS.addDefaultLibrary();
|
||||
|
||||
var fileName1 = 'tests/cases/unittests/services/testCode/getReferencesAtPositionTest.ts';
|
||||
var fileName2 = 'tests/cases/unittests/services/testCode/getReferencesAtPositionTest2.ts';
|
||||
var fileName3 = 'tests/cases/unittests/services/testCode/getReferencesAtPositionTest3.ts';
|
||||
var fileName4 = 'tests/cases/unittests/services/testCode/getReferencesAtPositionTest4.ts';
|
||||
|
||||
typescriptLS.addFile(fileName1);
|
||||
typescriptLS.addFile(fileName2);
|
||||
typescriptLS.addFile(fileName3);
|
||||
typescriptLS.addFile(fileName4);
|
||||
|
||||
var ls = typescriptLS.getLanguageService();
|
||||
|
||||
// Returns the offset corresponding to the line + column given
|
||||
function lineToOffset(line: number, col = 0, fileName?: string = fileName1) {
|
||||
var script: TypeScript.Script = ls.languageService.getScriptAST(fileName);
|
||||
return script.locationInfo.lineMap[line - 1] + col;
|
||||
}
|
||||
|
||||
describe("local get references", function() {
|
||||
|
||||
it("finds references to comment", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(2, 25));
|
||||
assert.equal(1, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to type", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(3, 15));
|
||||
var count = 0;
|
||||
// Filter out the lib.d.ts
|
||||
var items = result.split("\n");
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].split(" ")[0] !== "0") {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
assert.equal(10, count);
|
||||
});
|
||||
|
||||
it("find references to a variable declared in global", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(3, 4));
|
||||
assert.equal(12, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to a variable declared in a class", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(8, 8));
|
||||
assert.equal(3, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to static variable declared in a class", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(6, 16));
|
||||
assert.equal(7, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to a variable declared in a function", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(22, 8));
|
||||
assert.equal(3, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to a class parameter", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(15, 17));
|
||||
assert.equal(2, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to a function parameter", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(20, 14));
|
||||
assert.equal(3, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to a function argument", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(66, 8));
|
||||
assert.equal(12, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to a class argument", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(65, 29));
|
||||
assert.equal(12, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to illegal assignment", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(75, 0));
|
||||
assert.equal(8, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to unresolved symbol", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(76, 0));
|
||||
assert.equal(1, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to no context", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(77, 0));
|
||||
assert.equal(1, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to shadowed function parameter", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(79, 20));
|
||||
assert.equal(4, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find reference misses function parameter", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(115, 11));
|
||||
assert.equal(3, result.split("\n").length);
|
||||
});
|
||||
});
|
||||
|
||||
describe("remote get references", function() {
|
||||
it("find references to a variable declared in global", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(96, 0));
|
||||
assert.equal(12, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to a type", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(87, 23));
|
||||
assert.equal(9, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to a function argument", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(91, 19));
|
||||
assert.equal(12, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to a class argument", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName1, lineToOffset(90, 43));
|
||||
assert.equal(12, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to a variable declared in a class", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName2, lineToOffset(5, 8, fileName2));
|
||||
assert.equal(3, result.split("\n").length);
|
||||
});
|
||||
|
||||
it("find references to static variable declared in a class", function() {
|
||||
var result = ls.getReferencesAtPosition(fileName2, lineToOffset(6, 11, fileName2));
|
||||
assert.equal(7, result.split("\n").length);
|
||||
});
|
||||
});
|
||||
|
||||
describe("get references for overrides", function() {
|
||||
it("find references to a field declared in a base class", function() {
|
||||
var result = ls.languageService.getReferencesAtPosition(fileName3, lineToOffset(62, 11, fileName3));
|
||||
assert.equal(3, result.length);
|
||||
});
|
||||
|
||||
it("find references to a field declared in a base interface", function() {
|
||||
var result = ls.languageService.getReferencesAtPosition(fileName3, lineToOffset(65, 11, fileName3));
|
||||
assert.equal(3, result.length);
|
||||
});
|
||||
|
||||
it("find references to a field declared in a chain of base class and interfaces", function() {
|
||||
var result = ls.languageService.getReferencesAtPosition(fileName3, lineToOffset(68, 11, fileName3));
|
||||
assert.equal(6, result.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe("get references for statics with same names as members", function() {
|
||||
it("find references to a member method with the same name as a static", function() {
|
||||
/* public foo(): void */
|
||||
var result = ls.languageService.getReferencesAtPosition(fileName4, lineToOffset(7, 21, fileName4));
|
||||
assert.equal(3, result.length);
|
||||
});
|
||||
|
||||
it("find references to a static method with the same name as a member", function() {
|
||||
/* public static foo(): void */
|
||||
var result = ls.languageService.getReferencesAtPosition(fileName4, lineToOffset(9, 28, fileName4));
|
||||
assert.equal(2, result.length);
|
||||
});
|
||||
|
||||
it("find references to a member property with the same name as a static", function() {
|
||||
/* bar: Foo */
|
||||
var result = ls.languageService.getReferencesAtPosition(fileName4, lineToOffset(4, 14, fileName4));
|
||||
assert.equal(3, result.length);
|
||||
});
|
||||
|
||||
it("find references to a static property with the same name as a member", function() {
|
||||
/* static bar: Foo */
|
||||
var result = ls.languageService.getReferencesAtPosition(fileName4, lineToOffset(5, 21, fileName4));
|
||||
assert.equal(2, result.length);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,235 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
function testFileForReferenceHighlighting(filename: string, expectedMissingCount ?= 0, expectedExtraCount ?= 0) {
|
||||
describe(
|
||||
'The file ' + filename + ' has ' + expectedMissingCount + ' missing reference highlights and ' + expectedExtraCount + ' extra reference highlights',
|
||||
function(filename: string, expectedMissingCount: number, expectedExtraCount: number) {
|
||||
return function() {
|
||||
validateReferencesFile(filename, expectedMissingCount, expectedExtraCount);
|
||||
}
|
||||
}(filename, expectedMissingCount, expectedExtraCount)
|
||||
);
|
||||
}
|
||||
|
||||
function validateReferencesFile(filename: string, expectedMissingCount: number, expectedExtraCount: number) {
|
||||
var __typescriptLS = new Harness.TypeScriptLS();
|
||||
|
||||
// Read the input file and split it apart into sub-files
|
||||
var testFile = IO.readFile(filename);
|
||||
var testFileParts = splitFile(testFile);
|
||||
|
||||
var testFileNames: string[] = [];
|
||||
var testFileContents: string[] = [];
|
||||
|
||||
// For each sub-file, add it to the project and collect its spans
|
||||
var spans: Span[] = [];
|
||||
var caretPositions: Span[] = [];
|
||||
var i;
|
||||
for(i = 0; i < testFileParts.length; i++) {
|
||||
var partSpans: Span[] = [];
|
||||
var partCarets: Span[] = [];
|
||||
var transformedCode = extractCodeSpans(testFileParts[i], partSpans, partCarets);
|
||||
|
||||
partSpans.forEach(function(sp) {
|
||||
sp.fileIndex = i;
|
||||
spans.push(sp);
|
||||
});
|
||||
|
||||
partCarets.forEach(function(sp) {
|
||||
sp.fileIndex = i;
|
||||
caretPositions.push(sp);
|
||||
});
|
||||
|
||||
var tempFilename = 'tempFile' + i + '.ts';
|
||||
testFileNames.push(tempFilename);
|
||||
testFileContents.push(transformedCode);
|
||||
__typescriptLS.addScript(tempFilename , transformedCode);
|
||||
}
|
||||
|
||||
// Be sure to do this last so file indices don't get off-by-n'd by the default library
|
||||
__typescriptLS.addDefaultLibrary();
|
||||
testFileContents.push(Harness.Compiler.libText);
|
||||
|
||||
// If there's no caret position, someone screwed up the test authoring
|
||||
if(caretPositions.length === 0) {
|
||||
throw new Error('No caret positions in ' + filename + ' - did you forget to add some?');
|
||||
}
|
||||
|
||||
var __ls = __typescriptLS.getLanguageService();
|
||||
|
||||
for(var caretIndex = 0; caretIndex < caretPositions.length; caretIndex++) {
|
||||
var caret = caretPositions[caretIndex];
|
||||
describe('Returns the correct references at caret position = ' + caret, function() {
|
||||
var references = __ls.getReferencesAtPosition(testFileNames[caret.fileIndex], caret.start);
|
||||
var referencesList = Span.fromReferenceLines(references);
|
||||
referencesList.forEach(function(rf) { rf.getContent(testFileContents); });
|
||||
|
||||
var diff = diffLists(spans, referencesList, function(s1, s2) { return s1.equals(s2); });
|
||||
if(expectedExtraCount === 0) {
|
||||
it('Has no extra highlights', function() {
|
||||
assert.equal('', diff.extraItems.join(', '));
|
||||
});
|
||||
} else {
|
||||
it('Has ' + expectedExtraCount + ' extra highlights', function() {
|
||||
assert.equal(expectedExtraCount, diff.extraItems.length);
|
||||
});
|
||||
}
|
||||
|
||||
if(expectedMissingCount === 0) {
|
||||
it('Has no missing highlights', function() {
|
||||
assert.equal('', diff.missingItems.join(', '));
|
||||
});
|
||||
} else {
|
||||
it('Has ' + expectedMissingCount + ' missing highlights', function() {
|
||||
assert.equal(expectedMissingCount, diff.missingItems.length);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
interface ListDiffResult {
|
||||
areIdentical: boolean;
|
||||
extraItems: any[];
|
||||
missingItems: any[];
|
||||
}
|
||||
|
||||
function diffLists(expected: any[], actual: any[], equals: (expct: any, actl: any) => boolean) : ListDiffResult {
|
||||
var result = { areIdentical: false, extraItems: actual.slice(0), missingItems: expected.slice(0) };
|
||||
|
||||
var i, j;
|
||||
for(i = 0; i < result.extraItems.length; i++) {
|
||||
for(j = 0; j < result.missingItems.length; j++) {
|
||||
if(equals(result.missingItems[j], result.extraItems[i])) {
|
||||
result.extraItems.splice(i, 1);
|
||||
result.missingItems.splice(j, 1);
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.areIdentical = result.extraItems.length === 0 && result.missingItems.length === 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
class Span {
|
||||
constructor (public start: number, public length: number, public content: string) { }
|
||||
|
||||
public fileIndex: number = null;
|
||||
|
||||
public getContent(fileContents: string[]) {
|
||||
this.content = fileContents[this.fileIndex].substr(this.start, this.length);
|
||||
}
|
||||
|
||||
static fromReferenceLine(line: string): Span {
|
||||
var parts = line.split(' ');
|
||||
var fileNumber = parseInt(parts[0]);
|
||||
var start = parseInt(parts[1]);
|
||||
var end = parseInt(parts[2]);
|
||||
|
||||
var result = new Span(start, end - start, "<???>");
|
||||
result.fileIndex = fileNumber;
|
||||
return result;
|
||||
}
|
||||
|
||||
static fromReferenceLines(lines: string): Span[] {
|
||||
var result: Span[] = [];
|
||||
lines.split('\n').forEach(function(ln: string) {
|
||||
if(ln) {
|
||||
result.push(fromReferenceLine(ln));
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
public toString(): string {
|
||||
return '[File = ' + this.fileIndex + ', Start = ' + this.start + ', Length = ' + this.length + ', Content = "' + this.content + '"]';
|
||||
}
|
||||
|
||||
public equals(other: Span) {
|
||||
if(!other) return false;
|
||||
// Don't check 'content' as that won't be populated in all cases (it's only for diagnostic purposes)
|
||||
return other.start === this.start &&
|
||||
other.length === this.length &&
|
||||
other.fileIndex === this.fileIndex;
|
||||
}
|
||||
}
|
||||
|
||||
function splitFile(contents: string): string[] {
|
||||
var delimiterChar = '=';
|
||||
var delimiterStr = delimiterChar + delimiterChar + delimiterChar + delimiterChar;
|
||||
|
||||
var result: string[] = [];
|
||||
|
||||
while(true) {
|
||||
var delimIndex = contents.indexOf(delimiterStr);
|
||||
if(delimIndex === -1) {
|
||||
result.push(contents);
|
||||
break;
|
||||
} else {
|
||||
result.push(contents.substr(0, delimIndex - 1));
|
||||
while(contents.charAt(delimIndex) === delimiterChar) {
|
||||
delimIndex++;
|
||||
}
|
||||
contents = contents.substr(delimIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function extractCodeSpans(code: string, outputSpans: Span[], caretPositions: Span[]): string {
|
||||
var startTag = '[|';
|
||||
var endTag = '|]';
|
||||
var caretMarker = '^^';
|
||||
var result = code;
|
||||
while(true) {
|
||||
var caretIndex = result.indexOf(caretMarker);
|
||||
var tagStartIndex = result.indexOf(startTag);
|
||||
if(tagStartIndex === -1 && caretIndex === -1) break; // No more matches
|
||||
|
||||
if(tagStartIndex != -1 && ((tagStartIndex < caretIndex) || (caretIndex === -1))) {
|
||||
// Tag series is first
|
||||
var tagEndIndex = result.indexOf(endTag, tagStartIndex + tagStartIndex.length);
|
||||
if(tagEndIndex === -1) throw new Error('Unbalanced ' + startTag + '/' + endTag + ' pairs - expected to find a ' + startTag);
|
||||
|
||||
var interiorStart = tagStartIndex + startTag.length;
|
||||
var content = result.substr(interiorStart, tagEndIndex - interiorStart);
|
||||
var contentCaretIndex = content.indexOf(caretMarker);
|
||||
// Need to handle the case where there are caret[s] inside the tag markers
|
||||
while(contentCaretIndex != -1) {
|
||||
caretPositions.push(new Span(contentCaretIndex + tagStartIndex, 0, '<caret>'));
|
||||
content = content.substring(0, contentCaretIndex) + content.substring(contentCaretIndex + caretMarker.length);
|
||||
contentCaretIndex = content.indexOf(caretMarker);
|
||||
}
|
||||
|
||||
outputSpans.push(new Span(tagStartIndex, content.length, content));
|
||||
result = result.substr(0, tagStartIndex) + content + result.substr(tagEndIndex + endTag.length);
|
||||
} else {
|
||||
// Cursor marker is first
|
||||
caretPositions.push(new Span(caretIndex, 0, '<caret>'));
|
||||
result = result.substr(0, caretIndex) + result.substr(caretIndex + caretMarker.length);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
var refFile = function(fn) { return Harness.userSpecifiedroot + 'tests/cases/unittests/services/testCode/references/' + fn; };
|
||||
|
||||
testFileForReferenceHighlighting(refFile('classLocal.ts'));
|
||||
|
||||
testFileForReferenceHighlighting(refFile('classParameter.ts'));
|
||||
|
||||
testFileForReferenceHighlighting(refFile('comment.ts'));
|
||||
|
||||
testFileForReferenceHighlighting(refFile('functionOverloads.ts'));
|
||||
testFileForReferenceHighlighting(refFile('functionParameter.ts'));
|
||||
|
||||
testFileForReferenceHighlighting(refFile('illegalAssignment1.ts'));
|
||||
testFileForReferenceHighlighting(refFile('illegalAssignment2.ts'));
|
||||
|
||||
testFileForReferenceHighlighting(refFile('noContext.ts'));
|
||||
testFileForReferenceHighlighting(refFile('referenceToClass.ts'));
|
||||
testFileForReferenceHighlighting(refFile('static.ts'));
|
||||
@@ -1,904 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
describe('getScriptLexicalStructure', function () {
|
||||
var typescriptLS = new Harness.TypeScriptLS();
|
||||
|
||||
typescriptLS.addDefaultLibrary();
|
||||
|
||||
var fileName = 'tests/cases/unittests/services/testCode/getScriptLexicalStructure.ts';
|
||||
|
||||
typescriptLS.addFile(fileName);
|
||||
|
||||
var __ls = typescriptLS.getLanguageService();
|
||||
|
||||
|
||||
function getScriptLexicalStructure(fileName: string): Services.NavigateToItem[] {
|
||||
return __ls.languageService.getScriptLexicalStructure(fileName);
|
||||
}
|
||||
|
||||
describe('Get script lexical structure', function () {
|
||||
it("Cover all kinds of structure elements", function () {
|
||||
var result = getScriptLexicalStructure(fileName);
|
||||
|
||||
// Note: This baseline can be easily regenerated by taking the output of the test
|
||||
// resulting from the call to "assert.equal" below.
|
||||
var baseline =
|
||||
[
|
||||
{
|
||||
"name": "Bar",
|
||||
"kind": "module",
|
||||
"kindModifiers": "",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 0,
|
||||
"limChar": 1501,
|
||||
"containerName": "",
|
||||
"containerKind": ""
|
||||
},
|
||||
{
|
||||
"name": "x",
|
||||
"kind": "var",
|
||||
"kindModifiers": "",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 47,
|
||||
"limChar": 61,
|
||||
"containerName": "Bar",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "f",
|
||||
"kind": "function",
|
||||
"kindModifiers": "",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 92,
|
||||
"limChar": 114,
|
||||
"containerName": "Bar",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "IFoo",
|
||||
"kind": "interface",
|
||||
"kindModifiers": "",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 139,
|
||||
"limChar": 411,
|
||||
"containerName": "Bar",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "()",
|
||||
"kind": "call",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 165,
|
||||
"limChar": 183,
|
||||
"containerName": "Bar.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "new()",
|
||||
"kind": "construct",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 212,
|
||||
"limChar": 225,
|
||||
"containerName": "Bar.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "[]",
|
||||
"kind": "index",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 264,
|
||||
"limChar": 284,
|
||||
"containerName": "Bar.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "foo",
|
||||
"kind": "property",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 312,
|
||||
"limChar": 324,
|
||||
"containerName": "Bar.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "bar",
|
||||
"kind": "method",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 363,
|
||||
"limChar": 375,
|
||||
"containerName": "Bar.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "Blah",
|
||||
"kind": "enum",
|
||||
"kindModifiers": "",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 419,
|
||||
"limChar": 491,
|
||||
"containerName": "Bar",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "foo",
|
||||
"kind": "property",
|
||||
"kindModifiers": "export",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 440,
|
||||
"limChar": 447,
|
||||
"containerName": "Bar.Blah",
|
||||
"containerKind": "enum"
|
||||
},
|
||||
{
|
||||
"name": "Bar",
|
||||
"kind": "class",
|
||||
"kindModifiers": "",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 499,
|
||||
"limChar": 1498,
|
||||
"containerName": "Bar",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "constructor",
|
||||
"kind": "constructor",
|
||||
"kindModifiers": "",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 520,
|
||||
"limChar": 556,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barVar",
|
||||
"kind": "property",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 532,
|
||||
"limChar": 551,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barProp",
|
||||
"kind": "property",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 597,
|
||||
"limChar": 620,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barPropFunc",
|
||||
"kind": "method",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 672,
|
||||
"limChar": 702,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1",
|
||||
"kind": "getter",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 747,
|
||||
"limChar": 775,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1",
|
||||
"kind": "setter",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 822,
|
||||
"limChar": 844,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barPropP",
|
||||
"kind": "property",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 899,
|
||||
"limChar": 924,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barPropFuncP",
|
||||
"kind": "method",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 974,
|
||||
"limChar": 1006,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1P",
|
||||
"kind": "getter",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1049,
|
||||
"limChar": 1079,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1P",
|
||||
"kind": "setter",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1124,
|
||||
"limChar": 1148,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "foo",
|
||||
"kind": "property",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1201,
|
||||
"limChar": 1220,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "bar",
|
||||
"kind": "method",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1276,
|
||||
"limChar": 1298,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "foo2",
|
||||
"kind": "getter",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1351,
|
||||
"limChar": 1378,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "foo2",
|
||||
"kind": "setter",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1426,
|
||||
"limChar": 1447,
|
||||
"containerName": "Bar.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "Bar2",
|
||||
"kind": "module",
|
||||
"kindModifiers": "",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1505,
|
||||
"limChar": 3051,
|
||||
"containerName": "",
|
||||
"containerKind": ""
|
||||
},
|
||||
{
|
||||
"name": "x",
|
||||
"kind": "var",
|
||||
"kindModifiers": "export",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1560,
|
||||
"limChar": 1581,
|
||||
"containerName": "Bar2",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "f",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1613,
|
||||
"limChar": 1642,
|
||||
"containerName": "Bar2",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "IFoo",
|
||||
"kind": "interface",
|
||||
"kindModifiers": "export",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1668,
|
||||
"limChar": 1947,
|
||||
"containerName": "Bar2",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "()",
|
||||
"kind": "call",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1701,
|
||||
"limChar": 1719,
|
||||
"containerName": "Bar2.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "new()",
|
||||
"kind": "construct",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1748,
|
||||
"limChar": 1761,
|
||||
"containerName": "Bar2.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "[]",
|
||||
"kind": "index",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1800,
|
||||
"limChar": 1820,
|
||||
"containerName": "Bar2.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "foo",
|
||||
"kind": "property",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1848,
|
||||
"limChar": 1860,
|
||||
"containerName": "Bar2.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "bar",
|
||||
"kind": "method",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1899,
|
||||
"limChar": 1911,
|
||||
"containerName": "Bar2.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "Blah",
|
||||
"kind": "enum",
|
||||
"kindModifiers": "export",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1955,
|
||||
"limChar": 2034,
|
||||
"containerName": "Bar2",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "foo",
|
||||
"kind": "property",
|
||||
"kindModifiers": "export",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 1983,
|
||||
"limChar": 1990,
|
||||
"containerName": "Bar2.Blah",
|
||||
"containerKind": "enum"
|
||||
},
|
||||
{
|
||||
"name": "Bar",
|
||||
"kind": "class",
|
||||
"kindModifiers": "export",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2042,
|
||||
"limChar": 3048,
|
||||
"containerName": "Bar2",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "constructor",
|
||||
"kind": "constructor",
|
||||
"kindModifiers": "export",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2070,
|
||||
"limChar": 2106,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barVar",
|
||||
"kind": "property",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2082,
|
||||
"limChar": 2101,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barProp",
|
||||
"kind": "property",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2147,
|
||||
"limChar": 2170,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barPropFunc",
|
||||
"kind": "method",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2222,
|
||||
"limChar": 2252,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1",
|
||||
"kind": "getter",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2297,
|
||||
"limChar": 2325,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1",
|
||||
"kind": "setter",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2372,
|
||||
"limChar": 2394,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barPropP",
|
||||
"kind": "property",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2449,
|
||||
"limChar": 2474,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barPropFuncP",
|
||||
"kind": "method",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2524,
|
||||
"limChar": 2556,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1P",
|
||||
"kind": "getter",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2599,
|
||||
"limChar": 2629,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1P",
|
||||
"kind": "setter",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2674,
|
||||
"limChar": 2698,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "foo",
|
||||
"kind": "property",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2751,
|
||||
"limChar": 2770,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "bar",
|
||||
"kind": "method",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2826,
|
||||
"limChar": 2848,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "foo2",
|
||||
"kind": "getter",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2901,
|
||||
"limChar": 2928,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "foo2",
|
||||
"kind": "setter",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 2976,
|
||||
"limChar": 2997,
|
||||
"containerName": "Bar2.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "Bar3",
|
||||
"kind": "module",
|
||||
"kindModifiers": "declare",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3057,
|
||||
"limChar": 3083,
|
||||
"containerName": "",
|
||||
"containerKind": ""
|
||||
},
|
||||
{
|
||||
"name": "Bar4",
|
||||
"kind": "module",
|
||||
"kindModifiers": "",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3087,
|
||||
"limChar": 4611,
|
||||
"containerName": "",
|
||||
"containerKind": ""
|
||||
},
|
||||
{
|
||||
"name": "x",
|
||||
"kind": "var",
|
||||
"kindModifiers": "declare",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3134,
|
||||
"limChar": 3156,
|
||||
"containerName": "Bar4",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "f",
|
||||
"kind": "function",
|
||||
"kindModifiers": "declare",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3179,
|
||||
"limChar": 3206,
|
||||
"containerName": "Bar4",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "IFoo",
|
||||
"kind": "interface",
|
||||
"kindModifiers": "",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3226,
|
||||
"limChar": 3506,
|
||||
"containerName": "Bar4",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "()",
|
||||
"kind": "call",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3260,
|
||||
"limChar": 3278,
|
||||
"containerName": "Bar4.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "new()",
|
||||
"kind": "construct",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3307,
|
||||
"limChar": 3320,
|
||||
"containerName": "Bar4.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "[]",
|
||||
"kind": "index",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3359,
|
||||
"limChar": 3379,
|
||||
"containerName": "Bar4.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "foo",
|
||||
"kind": "property",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3407,
|
||||
"limChar": 3419,
|
||||
"containerName": "Bar4.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "bar",
|
||||
"kind": "method",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3458,
|
||||
"limChar": 3470,
|
||||
"containerName": "Bar4.IFoo",
|
||||
"containerKind": "interface"
|
||||
},
|
||||
{
|
||||
"name": "Blah",
|
||||
"kind": "enum",
|
||||
"kindModifiers": "declare",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3514,
|
||||
"limChar": 3594,
|
||||
"containerName": "Bar4",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "foo",
|
||||
"kind": "property",
|
||||
"kindModifiers": "export",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3543,
|
||||
"limChar": 3550,
|
||||
"containerName": "Bar4.Blah",
|
||||
"containerKind": "enum"
|
||||
},
|
||||
{
|
||||
"name": "Bar",
|
||||
"kind": "class",
|
||||
"kindModifiers": "declare",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3602,
|
||||
"limChar": 4608,
|
||||
"containerName": "Bar4",
|
||||
"containerKind": "module"
|
||||
},
|
||||
{
|
||||
"name": "constructor",
|
||||
"kind": "constructor",
|
||||
"kindModifiers": "declare",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3631,
|
||||
"limChar": 3665,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barVar",
|
||||
"kind": "property",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3644,
|
||||
"limChar": 3663,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barProp",
|
||||
"kind": "property",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3707,
|
||||
"limChar": 3730,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barPropFunc",
|
||||
"kind": "method",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3782,
|
||||
"limChar": 3809,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1",
|
||||
"kind": "getter",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3857,
|
||||
"limChar": 3882,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1",
|
||||
"kind": "setter",
|
||||
"kindModifiers": "public",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 3932,
|
||||
"limChar": 3951,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barPropP",
|
||||
"kind": "property",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 4009,
|
||||
"limChar": 4034,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "barPropFuncP",
|
||||
"kind": "method",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 4084,
|
||||
"limChar": 4113,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1P",
|
||||
"kind": "getter",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 4159,
|
||||
"limChar": 4186,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "prop1P",
|
||||
"kind": "setter",
|
||||
"kindModifiers": "private",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 4234,
|
||||
"limChar": 4255,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "foo",
|
||||
"kind": "property",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 4311,
|
||||
"limChar": 4330,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "bar",
|
||||
"kind": "method",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 4386,
|
||||
"limChar": 4405,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "foo2",
|
||||
"kind": "getter",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 4461,
|
||||
"limChar": 4485,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
},
|
||||
{
|
||||
"name": "foo2",
|
||||
"kind": "setter",
|
||||
"kindModifiers": "public,static",
|
||||
"matchKind": "exact",
|
||||
"unitIndex": 1,
|
||||
"minChar": 4536,
|
||||
"limChar": 4554,
|
||||
"containerName": "Bar4.Bar",
|
||||
"containerKind": "class"
|
||||
}
|
||||
];
|
||||
var baselineText = JSON.stringify(baseline, null, " ");
|
||||
var resultText = JSON.stringify(result, null, " ");
|
||||
assert.notNull(result);
|
||||
assert.equal(79, result.length);
|
||||
assert.equal(baselineText, resultText);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,493 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
describe('getSignatureAtPosition', function () {
|
||||
var mytypescriptLS = new Harness.TypeScriptLS();
|
||||
|
||||
mytypescriptLS.addDefaultLibrary();
|
||||
|
||||
var fileName = 'tests/cases/unittests/services/testCode/getSignatureAtPositionTest.ts';
|
||||
var fileName2 = 'tests/cases/unittests/services/testCode/getSignatureAtPositionTestEOF.ts';
|
||||
|
||||
mytypescriptLS.addFile(fileName);
|
||||
mytypescriptLS.addFile(fileName2);
|
||||
|
||||
var myls = mytypescriptLS.getLanguageService();
|
||||
|
||||
function singatureAtPos(line: number, col: number): Services.SignatureInfo {
|
||||
return myls.languageService.getSignatureAtPosition(fileName, mytypescriptLS.lineColToPosition(fileName, line, col));
|
||||
}
|
||||
|
||||
function singatureAtPos2(line: number, col: number): Services.SignatureInfo {
|
||||
return myls.languageService.getSignatureAtPosition(fileName2, mytypescriptLS.lineColToPosition(fileName2, line, col));
|
||||
}
|
||||
|
||||
describe('Get signatures from position', function () {
|
||||
it("Comment", function () {
|
||||
var result = singatureAtPos(1, 4);
|
||||
assert.equal(null, result);
|
||||
});
|
||||
|
||||
it("No Context", function () {
|
||||
var result = singatureAtPos(2, 1);
|
||||
assert.equal(null, result);
|
||||
});
|
||||
|
||||
it("Construct expression", function () {
|
||||
var result = singatureAtPos(3, 23);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("sampleCls", formal.name);
|
||||
assert.equal(1, formal.signatureGroup.length);
|
||||
assert.equal(2, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("str", formal.signatureGroup[0].parameters[0].name);
|
||||
assert.equal("string", formal.signatureGroup[0].parameters[0].type);
|
||||
assert.equal("num", formal.signatureGroup[0].parameters[1].name);
|
||||
assert.equal("number", formal.signatureGroup[0].parameters[1].type);
|
||||
assert.equal("sampleCls", formal.signatureGroup[0].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 3, 22), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 3, 29), actual.closeParenLimChar);
|
||||
assert.equal(2, actual.parameters.length);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 3, 23), actual.parameters[0].minChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 3, 25), actual.parameters[0].limChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 3, 27), actual.parameters[1].minChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 3, 28), actual.parameters[1].limChar);
|
||||
|
||||
assert.equal(0, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Wrong context", function () {
|
||||
var result = singatureAtPos(4, 11);
|
||||
assert.equal(null, result);
|
||||
});
|
||||
|
||||
it("Call expression", function () {
|
||||
var result = singatureAtPos(7, 8);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("fnTest", formal.name);
|
||||
assert.equal(1, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(2, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("str", formal.signatureGroup[0].parameters[0].name);
|
||||
assert.equal("string", formal.signatureGroup[0].parameters[0].type);
|
||||
assert.equal("num", formal.signatureGroup[0].parameters[1].name);
|
||||
assert.equal("number", formal.signatureGroup[0].parameters[1].type);
|
||||
assert.equal("void", formal.signatureGroup[0].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 7, 7), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 7, 9), actual.closeParenLimChar);
|
||||
assert.equal(0, actual.parameters.length);
|
||||
|
||||
assert.equal(-1, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Overloaded function", function () {
|
||||
var result = singatureAtPos(11, 12);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("fnOverload", formal.name);
|
||||
assert.equal(2, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(0, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("any", formal.signatureGroup[0].returnType);
|
||||
|
||||
assert.equal(1, formal.signatureGroup[1].parameters.length);
|
||||
assert.equal("test", formal.signatureGroup[1].parameters[0].name);
|
||||
assert.equal("string", formal.signatureGroup[1].parameters[0].type);
|
||||
assert.equal("any", formal.signatureGroup[1].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 11, 11), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 11, 13), actual.closeParenLimChar);
|
||||
assert.equal(0, actual.parameters.length);
|
||||
|
||||
assert.equal(0, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Overloaded function 2", function () {
|
||||
var result = singatureAtPos(12, 12);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("fnOverload", formal.name);
|
||||
assert.equal(2, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(0, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("any", formal.signatureGroup[0].returnType);
|
||||
|
||||
assert.equal(1, formal.signatureGroup[1].parameters.length);
|
||||
assert.equal("test", formal.signatureGroup[1].parameters[0].name);
|
||||
assert.equal("string", formal.signatureGroup[1].parameters[0].type);
|
||||
assert.equal("any", formal.signatureGroup[1].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 12, 11), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 12, 15), actual.closeParenLimChar);
|
||||
assert.equal(1, actual.parameters.length);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 12, 12), actual.parameters[0].minChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 12, 14), actual.parameters[0].limChar);
|
||||
|
||||
assert.equal(1, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Overloaded construct - before open paren", function () {
|
||||
var result = singatureAtPos(15, 24);
|
||||
assert.equal(null, result);
|
||||
});
|
||||
|
||||
it("Overloaded construct - after close paren", function () {
|
||||
var result = singatureAtPos(15, 26);
|
||||
assert.equal(null, result);
|
||||
});
|
||||
|
||||
it("Overloaded construct", function () {
|
||||
var result = singatureAtPos(15, 25);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("clsOverload", formal.name);
|
||||
assert.equal(2, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(0, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("clsOverload", formal.signatureGroup[0].returnType);
|
||||
|
||||
assert.equal(1, formal.signatureGroup[1].parameters.length);
|
||||
assert.equal("test", formal.signatureGroup[1].parameters[0].name);
|
||||
assert.equal("string", formal.signatureGroup[1].parameters[0].type);
|
||||
assert.equal("clsOverload", formal.signatureGroup[1].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 15, 24), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 15, 26), actual.closeParenLimChar);
|
||||
|
||||
assert.equal(0, actual.parameters.length);
|
||||
|
||||
assert.equal(0, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Overloaded construct: call second overload", function () {
|
||||
var result = singatureAtPos(16, 25);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("clsOverload", formal.name);
|
||||
assert.equal(2, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(0, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("clsOverload", formal.signatureGroup[0].returnType);
|
||||
|
||||
assert.equal(1, formal.signatureGroup[1].parameters.length);
|
||||
assert.equal("test", formal.signatureGroup[1].parameters[0].name);
|
||||
assert.equal("string", formal.signatureGroup[1].parameters[0].type);
|
||||
assert.equal("clsOverload", formal.signatureGroup[1].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 16, 24), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 16, 28), actual.closeParenLimChar);
|
||||
|
||||
assert.equal(1, actual.parameters.length);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 16, 25), actual.parameters[0].minChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 16, 27), actual.parameters[0].limChar);
|
||||
|
||||
assert.equal(1, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Incomplete call (with statements after the incomple call)", function () {
|
||||
var result = singatureAtPos(31, 14);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("f1", formal.name);
|
||||
assert.equal(1, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(0, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("void", formal.signatureGroup[0].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 31, 13), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 34, 10), actual.closeParenLimChar);
|
||||
|
||||
assert.equal(1, actual.parameters.length);
|
||||
|
||||
assert.equal(-1, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Incomplete call 2 (inside another incomplete call)", function () {
|
||||
var result = singatureAtPos(32, 14);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("f2", formal.name);
|
||||
assert.equal(1, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(1, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("n", formal.signatureGroup[0].parameters[0].name);
|
||||
assert.equal("number", formal.signatureGroup[0].parameters[0].type);
|
||||
assert.equal("void", formal.signatureGroup[0].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 32, 13), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 34, 10), actual.closeParenLimChar);
|
||||
|
||||
assert.equal(2, actual.parameters.length);
|
||||
|
||||
assert.equal(-1, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Incomplete call 3 (close curly after incomplete call)", function () {
|
||||
var result = singatureAtPos(33, 14);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("f3", formal.name);
|
||||
assert.equal(1, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(2, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("n", formal.signatureGroup[0].parameters[0].name);
|
||||
assert.equal("number", formal.signatureGroup[0].parameters[0].type);
|
||||
assert.equal("s", formal.signatureGroup[0].parameters[1].name);
|
||||
assert.equal("string", formal.signatureGroup[0].parameters[1].type);
|
||||
assert.equal("void", formal.signatureGroup[0].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 33, 13), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 34, 10), actual.closeParenLimChar);
|
||||
|
||||
assert.equal(2, actual.parameters.length);
|
||||
|
||||
assert.equal(0, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Calling off a parameter function", function () {
|
||||
var result = singatureAtPos(44, 22);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("callback", formal.name);
|
||||
assert.equal(1, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(2, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("a", formal.signatureGroup[0].parameters[0].name);
|
||||
assert.equal("number", formal.signatureGroup[0].parameters[0].type);
|
||||
assert.equal("b", formal.signatureGroup[0].parameters[1].name);
|
||||
assert.equal("string", formal.signatureGroup[0].parameters[1].type);
|
||||
assert.equal("string", formal.signatureGroup[0].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 44, 21), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 44, 28), actual.closeParenLimChar);
|
||||
|
||||
assert.equal(2, actual.parameters.length);
|
||||
|
||||
assert.equal(0, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Calling off a returned function", function () {
|
||||
var result = singatureAtPos(53, 15);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("", formal.name);
|
||||
assert.equal(1, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(2, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("a", formal.signatureGroup[0].parameters[0].name);
|
||||
assert.equal("number", formal.signatureGroup[0].parameters[0].type);
|
||||
assert.equal("b", formal.signatureGroup[0].parameters[1].name);
|
||||
assert.equal("string", formal.signatureGroup[0].parameters[1].type);
|
||||
assert.equal("string", formal.signatureGroup[0].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 53, 14), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 53, 21), actual.closeParenLimChar);
|
||||
|
||||
assert.equal(2, actual.parameters.length);
|
||||
|
||||
assert.equal(0, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Calling off a object literal property function", function () {
|
||||
var result = singatureAtPos(58, 9);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("f", formal.name);
|
||||
assert.equal(1, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(2, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("a", formal.signatureGroup[0].parameters[0].name);
|
||||
assert.equal("number", formal.signatureGroup[0].parameters[0].type);
|
||||
assert.equal("b", formal.signatureGroup[0].parameters[1].name);
|
||||
assert.equal("string", formal.signatureGroup[0].parameters[1].type);
|
||||
assert.equal("string", formal.signatureGroup[0].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 58, 8), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 58, 15), actual.closeParenLimChar);
|
||||
|
||||
assert.equal(2, actual.parameters.length);
|
||||
|
||||
assert.equal(0, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Calling off super constructor", function() {
|
||||
var result = singatureAtPos(69, 19);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("base", formal.name);
|
||||
assert.equal(2, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(1, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("s", formal.signatureGroup[0].parameters[0].name);
|
||||
assert.equal("string", formal.signatureGroup[0].parameters[0].type);
|
||||
assert.equal("base", formal.signatureGroup[0].returnType);
|
||||
|
||||
assert.equal(1, formal.signatureGroup[1].parameters.length);
|
||||
assert.equal("n", formal.signatureGroup[1].parameters[0].name);
|
||||
assert.equal("number", formal.signatureGroup[1].parameters[0].type);
|
||||
assert.equal("base", formal.signatureGroup[1].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 69, 18), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 69, 22), actual.closeParenLimChar);
|
||||
|
||||
assert.equal(1, actual.parameters.length);
|
||||
assert.equal(0, result.activeFormal);
|
||||
});
|
||||
|
||||
it("Calling off super of super constructor", function() {
|
||||
var result = singatureAtPos(79, 19);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("B2", formal.name);
|
||||
assert.equal(2, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(1, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("s", formal.signatureGroup[0].parameters[0].name);
|
||||
assert.equal("string", formal.signatureGroup[0].parameters[0].type);
|
||||
assert.equal("B2", formal.signatureGroup[0].returnType);
|
||||
|
||||
assert.equal(1, formal.signatureGroup[1].parameters.length);
|
||||
assert.equal("n", formal.signatureGroup[1].parameters[0].name);
|
||||
assert.equal("number", formal.signatureGroup[1].parameters[0].type);
|
||||
assert.equal("B2", formal.signatureGroup[1].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 79, 18), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName, 79, 22), actual.closeParenLimChar);
|
||||
|
||||
assert.equal(1, actual.parameters.length);
|
||||
assert.equal(0, result.activeFormal);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Get signatures at EOF', function () {
|
||||
it("Function signature at EOF", function () {
|
||||
var result = singatureAtPos2(5, 5);
|
||||
assert.notNull(result);
|
||||
|
||||
var formal = result.formal;
|
||||
assert.notNull(formal);
|
||||
|
||||
assert.equal(false, formal.isNew);
|
||||
assert.equal("Foo", formal.name);
|
||||
assert.equal(1, formal.signatureGroup.length);
|
||||
|
||||
assert.equal(2, formal.signatureGroup[0].parameters.length);
|
||||
assert.equal("arg1", formal.signatureGroup[0].parameters[0].name);
|
||||
assert.equal("string", formal.signatureGroup[0].parameters[0].type);
|
||||
assert.equal("arg2", formal.signatureGroup[0].parameters[1].name);
|
||||
assert.equal("string", formal.signatureGroup[0].parameters[1].type);
|
||||
assert.equal("void", formal.signatureGroup[0].returnType);
|
||||
|
||||
var actual = result.actual;
|
||||
assert.notNull(actual);
|
||||
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName2, 5, 4), actual.openParenMinChar);
|
||||
assert.equal(mytypescriptLS.lineColToPosition(fileName2, 5, 5), actual.closeParenLimChar);
|
||||
assert.equal(0, actual.currentParameter);
|
||||
|
||||
assert.equal(1, actual.parameters.length);
|
||||
|
||||
assert.equal(-1, result.activeFormal);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,103 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
module IncrementalParserTest {
|
||||
export class State {
|
||||
private fileName: string;
|
||||
private typescriptLS: Harness.TypeScriptLS;
|
||||
private ls: Services.ILanguageServiceShim;
|
||||
private logger: TypeScript.BufferedLogger;
|
||||
private parser: TypeScript.IncrementalParser;
|
||||
private script: TypeScript.Script;
|
||||
private newSourceText: TypeScript.IScriptSnapshot;
|
||||
|
||||
public applyEditInRange(fileName, startLine, startCol, endLine, endCol, newText) {
|
||||
this.initFileName(fileName);
|
||||
|
||||
var result = this.applyIncrementalParser(startLine, startCol, endLine, endCol, newText);
|
||||
if (result === null) {
|
||||
var sep = "\r\n | ";
|
||||
throw new Error("Incremental parser should not have bailed out:" + sep + this.logger.logContents.join(sep));
|
||||
}
|
||||
|
||||
this.assertTreesAreEqual(result);
|
||||
}
|
||||
|
||||
public assertBailout(fileName, startLine, startCol, endLine, endCol, newText) {
|
||||
this.initFileName(fileName);
|
||||
var result = this.applyIncrementalParser(startLine, startCol, endLine, endCol, newText);
|
||||
assert.is(result == null, "Incremental parser should have bailed out");
|
||||
}
|
||||
|
||||
private applyIncrementalParser(startLine, startCol, endLine, endCol, newText): TypeScript.UpdateUnitResult {
|
||||
var fileName = this.fileName;
|
||||
var offset1 = this.typescriptLS.lineColToPosition(fileName, startLine, startCol);
|
||||
var offset2 = this.typescriptLS.lineColToPosition(fileName, endLine, endCol);
|
||||
var textEdit = new Services.TextEdit(offset1, offset2, newText);
|
||||
var newContent = this.typescriptLS.applyEdits(this.typescriptLS.getScriptContent(1), [textEdit]);
|
||||
this.newSourceText = new TypeScript.StringScriptSnapshot(newContent);
|
||||
|
||||
var result = this.parser.attemptIncrementalUpdateUnit(this.script, fileName, this.newSourceText,
|
||||
new TypeScript.TextChangeRange(TypeScript.TextSpan.fromBounds(offset1, offset2), newText.length));
|
||||
return result;
|
||||
}
|
||||
|
||||
private initFileName(fileName: string) {
|
||||
this.fileName = fileName;
|
||||
this.typescriptLS = this.createLS(fileName);
|
||||
this.ls = this.typescriptLS.getLanguageService();
|
||||
this.logger = new TypeScript.BufferedLogger();
|
||||
this.parser = new TypeScript.IncrementalParser(this.logger);
|
||||
this.script = this.ls.languageService.getScriptAST(fileName);
|
||||
assert.notNull(this.script);
|
||||
}
|
||||
|
||||
private assertTreesAreEqual(result: TypeScript.UpdateUnitResult) {
|
||||
assert.notNull(result);
|
||||
this.parser.mergeTrees(result);
|
||||
|
||||
var finalScript = result.script1;
|
||||
var nonIncrementalScript = this.typescriptLS.parseSourceText(this.fileName, this.newSourceText);
|
||||
|
||||
var logger1 = new TypeScript.BufferedLogger();
|
||||
var astLogger1 = new TypeScript.AstLogger(logger1);
|
||||
astLogger1.logScript(finalScript);
|
||||
|
||||
var logger2 = new TypeScript.BufferedLogger();
|
||||
var astLogger2 = new TypeScript.AstLogger(logger2);
|
||||
astLogger2.logScript(nonIncrementalScript);
|
||||
|
||||
var log1 = logger1.logContents.join("\r\n");
|
||||
var log2 = logger2.logContents.join("\r\n");
|
||||
|
||||
assert.noDiff(log1, log2);
|
||||
}
|
||||
|
||||
private createLS(fileName: string): Harness.TypeScriptLS {
|
||||
var typescriptLS = new Harness.TypeScriptLS();
|
||||
typescriptLS.addDefaultLibrary();
|
||||
typescriptLS.addFile(fileName);
|
||||
return typescriptLS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
describe('incrementalParser tests', function () {
|
||||
var fileName = 'tests/cases/unittests/services/testCode/incrementalParser.ts';
|
||||
var fileName2 = 'tests/cases/unittests/services/testCode/incrementalParser2.ts';
|
||||
|
||||
|
||||
describe('Incremental edits to unit', function () {
|
||||
it("Simple delete inside a function should be incremental", function () {
|
||||
new IncrementalParserTest.State().applyEditInRange(fileName, 10, 5, 10, 39, "");
|
||||
});
|
||||
it("Simple insert inside a function should be incremental", function () {
|
||||
new IncrementalParserTest.State().applyEditInRange(fileName, 10, 5, 10, 6, "test-test-test");
|
||||
});
|
||||
});
|
||||
|
||||
describe('Bail out tests', function () {
|
||||
it("Adding semicolon at end of interface function should force bailout", function () {
|
||||
new IncrementalParserTest.State().assertBailout(fileName2, 4, 16, 4, 16, ";");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,82 +0,0 @@
|
||||
///<reference path='_project.ts'/>
|
||||
|
||||
describe('overridesCollector', function () {
|
||||
var typescriptLS = new Harness.TypeScriptLS();
|
||||
|
||||
typescriptLS.addDefaultLibrary();
|
||||
|
||||
var fileName = 'tests/cases/unittests/services/testCode/overridesCollector.ts';
|
||||
|
||||
typescriptLS.addFile(fileName);
|
||||
|
||||
var ls = typescriptLS.getLanguageService();
|
||||
|
||||
|
||||
function getOverridesAtPos(fileName:string, line: number, col: number): Services.SymbolSet {
|
||||
var pos = typescriptLS.lineColToPosition(fileName, line, col);
|
||||
|
||||
var script = ls.languageService.getScriptAST(fileName);
|
||||
assert.notNull(script);
|
||||
|
||||
var sym = ls.languageService.getSymbolAtPosition(script, pos);
|
||||
assert.notNull(sym);
|
||||
|
||||
var symbolTree = ls.languageService.getSymbolTree();
|
||||
assert.notNull(symbolTree);
|
||||
|
||||
var collector = new Services.OverridesCollector(symbolTree);
|
||||
return collector.findMemberOverrides(sym);
|
||||
}
|
||||
|
||||
describe('Overrides Collector Simple Tests', function () {
|
||||
it("Find method override from base class", function() {
|
||||
var result = getOverridesAtPos(fileName, 3, 17);
|
||||
assert.notNull(result);
|
||||
assert.equal(2, result.getAll().length);
|
||||
});
|
||||
|
||||
it("Find method override from derived class", function() {
|
||||
var result = getOverridesAtPos(fileName, 7, 17);
|
||||
assert.notNull(result);
|
||||
assert.equal(2, result.getAll().length);
|
||||
});
|
||||
|
||||
it("Find method override from derived interface", function() {
|
||||
var result = getOverridesAtPos(fileName, 17, 10);
|
||||
assert.notNull(result);
|
||||
assert.equal(2, result.getAll().length);
|
||||
});
|
||||
|
||||
it("Find method override from base interface", function() {
|
||||
var result = getOverridesAtPos(fileName, 14, 10);
|
||||
assert.notNull(result);
|
||||
assert.equal(2, result.getAll().length);
|
||||
});
|
||||
|
||||
it("Find interface method override from derived class", function() {
|
||||
var result = getOverridesAtPos(fileName, 26, 17);
|
||||
assert.notNull(result);
|
||||
assert.equal(2, result.getAll().length);
|
||||
});
|
||||
|
||||
it("Find interface method override from base interface", function() {
|
||||
var result = getOverridesAtPos(fileName, 23, 11);
|
||||
assert.notNull(result);
|
||||
assert.equal(2, result.getAll().length);
|
||||
});
|
||||
});
|
||||
describe('Overrides Collector Complex Tests', function () {
|
||||
it("Find field override in deep hierarchy", function() {
|
||||
var result = getOverridesAtPos(fileName, 42, 12);
|
||||
assert.notNull(result);
|
||||
assert.equal(5, result.getAll().length);
|
||||
});
|
||||
|
||||
it("Find method override in deep hierarchy", function() {
|
||||
var result = getOverridesAtPos(fileName, 46, 13);
|
||||
assert.notNull(result);
|
||||
assert.equal(3, result.getAll().length);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
module Foo {
|
||||
class Bar {
|
||||
private f() {
|
||||
var a:any[] = [[1, 2], [3, 4], 5];
|
||||
return ((1 + 1));
|
||||
}
|
||||
|
||||
private f2() {
|
||||
if(true) { }{ };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// { }
|
||||
// ( )
|
||||
// [ ]
|
||||
// < >
|
||||
|
||||
class TemplateTest <T1, T2 extends Array> {
|
||||
public foo(a, b) {
|
||||
return <any> a;
|
||||
}
|
||||
public bar(a, b) {
|
||||
return a < b || a > b;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
module Foo { var testing = ""; test }
|
||||
|
||||
class C1 {
|
||||
public pubMeth() {this.} // test on 'this.'
|
||||
private privMeth() {}
|
||||
public pubProp = 0;
|
||||
private privProp = 0;
|
||||
}
|
||||
|
||||
var f = new C1();
|
||||
f. // test on F.
|
||||
module M {
|
||||
export class C { public pub = 0; private priv = 1; }
|
||||
export var V = 0;
|
||||
}
|
||||
|
||||
|
||||
var c = new M.C();
|
||||
|
||||
c. // test on c.
|
||||
|
||||
//Test for comment
|
||||
//c.
|
||||
@@ -1,5 +0,0 @@
|
||||
module Test10
|
||||
{
|
||||
var x: string[] = [];
|
||||
x.forEach(function(y) { y. });
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
module Foo {
|
||||
export class Bar {
|
||||
|
||||
}
|
||||
|
||||
|
||||
export module Blah {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var x:Foo.
|
||||
@@ -1,2 +0,0 @@
|
||||
//
|
||||
var
|
||||
@@ -1,4 +0,0 @@
|
||||
class
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
module
|
||||
{
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
interface
|
||||
@@ -1 +0,0 @@
|
||||
function
|
||||
@@ -1 +0,0 @@
|
||||
.
|
||||
@@ -1,10 +0,0 @@
|
||||
module Bar
|
||||
{
|
||||
export class Bleah {
|
||||
}
|
||||
export class Foo extends Bleah {
|
||||
}
|
||||
}
|
||||
|
||||
function Blah(x:Bar.Bleah) {
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
module Test1 {
|
||||
class Person {
|
||||
children: string[];
|
||||
constructor (public name:string, children:string[]) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
module BugFixes {
|
||||
enum Foo {
|
||||
bar,
|
||||
baz
|
||||
}
|
||||
|
||||
var f: Foo = Foo./*here*/;
|
||||
|
||||
import foo f = Foo;
|
||||
foo./*here*/;
|
||||
}
|
||||
|
||||
module BugFix2 {
|
||||
interface iFace { (event: string); }
|
||||
var foo: iFace = function (elem) { /*here*/ }
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
module ObjectLiterals {
|
||||
interface MyPoint {
|
||||
x1: number;
|
||||
y1: number;
|
||||
}
|
||||
|
||||
var p1: MyPoint = {
|
||||
/*here*/
|
||||
};
|
||||
|
||||
var p2: MyPoint = {
|
||||
x1: 5,
|
||||
/*here*/
|
||||
};
|
||||
|
||||
var p3: MyPoint = {
|
||||
x1 /*here*/
|
||||
};
|
||||
|
||||
var p4: MyPoint = {
|
||||
x1: 5,
|
||||
y1 /*here*/ : 6
|
||||
};
|
||||
|
||||
// Negative cases (global completion)
|
||||
var n4: MyPoint = {
|
||||
x1: /*here*/
|
||||
};
|
||||
|
||||
var n2: MyPoint = {
|
||||
x1: /*here*/,
|
||||
};
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
///<reference path='getDefinitionsAtPosition2.ts' />
|
||||
var locVar;
|
||||
function locFn() { }
|
||||
class locCls { }
|
||||
interface locInt{ }
|
||||
module locMod{ export var foo = 1;}
|
||||
|
||||
locVar = 1;
|
||||
locFn();
|
||||
var foo = new locCls();
|
||||
class fooCls implements locInt { }
|
||||
var fooVar = locMod.foo;
|
||||
|
||||
remVar = 1;
|
||||
remFn();
|
||||
var remfoo = new remCls();
|
||||
class remfooCls implements remInt { }
|
||||
var remfooVar = remMod.foo;
|
||||
|
||||
rem2Var = 1;
|
||||
rem2Fn();
|
||||
var rem2foo = new rem2Cls();
|
||||
class rem2fooCls implements rem2Int { }
|
||||
var rem2fooVar = rem2Mod.foo;
|
||||
|
||||
var shdVar = "foo";
|
||||
module shdModule {
|
||||
var shdVar;
|
||||
shdVar = 1;
|
||||
}
|
||||
|
||||
function fnOverload( );
|
||||
function fnOverload(foo: string);
|
||||
function fnOverload(foo: any) { };
|
||||
|
||||
fnOverload();
|
||||
fnOverload("test");
|
||||
|
||||
class clsOverload {
|
||||
constructor ();
|
||||
constructor (foo: string);
|
||||
constructor (foo: any) { }
|
||||
};
|
||||
|
||||
var clsOverloadVar = new clsOverload();
|
||||
clsOverloadVar = new clsOverload("test");
|
||||
|
||||
class clsInOverload {
|
||||
static fnOverload( );
|
||||
static fnOverload(foo: string);
|
||||
static fnOverload(foo: any) { };
|
||||
public fnOverload():any;
|
||||
public fnOverload(foo: string);
|
||||
public fnOverload(foo: any) { return "foo" };
|
||||
public fnOverload1():any;
|
||||
public fnOverload1(foo: string);
|
||||
public fnOverload1(foo: any) { return "foo" };
|
||||
|
||||
constructor () { }
|
||||
}
|
||||
|
||||
clsInOverload.fnOverload();
|
||||
clsInOverload.fnOverload("test");
|
||||
|
||||
var clsInOverloadVar = new clsInOverload();
|
||||
var foo3 = clsInOverloadVar.fnOverload();
|
||||
foo3 = clsInOverloadVar.fnOverload("test");
|
||||
|
||||
function fnInOverload() {
|
||||
static fnOverload():any;
|
||||
static fnOverload(foo: string);
|
||||
static fnOverload(foo: any){ return "foo" };
|
||||
}
|
||||
|
||||
fnInOverload.fnOverload();
|
||||
fnInOverload.fnOverload("test");
|
||||
|
||||
interface sInt {
|
||||
sVar: number;
|
||||
sFn: () => void;
|
||||
}
|
||||
|
||||
class iClass implements sInt {
|
||||
public sVar = 1;
|
||||
public sFn() {
|
||||
}
|
||||
}
|
||||
|
||||
declare var ambientVar;
|
||||
|
||||
ambientVar = 1;
|
||||
@@ -1,6 +0,0 @@
|
||||
///<reference path='getDefinitionsAtPosition3.ts' />
|
||||
var remVar;
|
||||
function remFn() { }
|
||||
class remCls { }
|
||||
interface remInt{ }
|
||||
module remMod{ export var foo;}
|
||||
@@ -1,5 +0,0 @@
|
||||
var rem2Var;
|
||||
function rem2Fn() { }
|
||||
class rem2Cls { }
|
||||
interface rem2Int{ }
|
||||
module rem2Mod{ export var foo; }
|
||||
@@ -1,5 +0,0 @@
|
||||
module A {
|
||||
export interface IA {
|
||||
y: string;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
/// <reference path="getDefinitionsAtPositionPartialInterface1.ts"/>
|
||||
|
||||
module A {
|
||||
export interface IA {
|
||||
x: number;
|
||||
}
|
||||
|
||||
var x: IA;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
module SimpleClassTest {
|
||||
class Foo {
|
||||
public foo(): void {
|
||||
}
|
||||
}
|
||||
class Bar extends Foo {
|
||||
public foo(): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module SimpleInterfaceTest {
|
||||
interface IFoo {
|
||||
foo(): void;
|
||||
}
|
||||
interface IBar extends IFoo {
|
||||
foo(): void;
|
||||
}
|
||||
}
|
||||
|
||||
module SimpleClassInterfaceTest {
|
||||
interface IFoo {
|
||||
foo(): void;
|
||||
}
|
||||
class Bar implements IFoo {
|
||||
public foo(): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module Test {
|
||||
interface IBase {
|
||||
field: string;
|
||||
method(): void;
|
||||
}
|
||||
|
||||
interface IBlah extends IBase {
|
||||
field: string;
|
||||
}
|
||||
|
||||
interface IBlah2 extends IBlah {
|
||||
field: string;
|
||||
}
|
||||
|
||||
interface IDerived extends IBlah2 {
|
||||
method(): void;
|
||||
}
|
||||
|
||||
class Bar implements IDerived {
|
||||
public field: string;
|
||||
public method(): void { }
|
||||
}
|
||||
|
||||
class BarBlah extends Bar {
|
||||
public field: string;
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
///<reference path='getReferencesAtPositionTest2.ts' />
|
||||
// Comment Refence Test: globalVar
|
||||
var globalVar: number = 2;
|
||||
|
||||
class fooCls {
|
||||
static clsSVar = 1;
|
||||
//Declare
|
||||
clsVar = 1;
|
||||
|
||||
constructor (public clsParam: number) {
|
||||
//Increments
|
||||
globalVar++;
|
||||
this.clsVar++;
|
||||
fooCls.clsSVar++;
|
||||
this.clsParam++;
|
||||
modTest.modVar++;
|
||||
}
|
||||
}
|
||||
|
||||
function foo(x: number) {
|
||||
//Declare
|
||||
var fnVar = 1;
|
||||
|
||||
//Increments
|
||||
fooCls.clsSVar++;
|
||||
globalVar++;
|
||||
modTest.modVar++;
|
||||
fnVar++;
|
||||
|
||||
//Return
|
||||
return x++;
|
||||
}
|
||||
|
||||
module modTest {
|
||||
//Declare
|
||||
export var modVar:number;
|
||||
|
||||
//Increments
|
||||
globalVar++;
|
||||
fooCls.clsSVar++;
|
||||
modVar++;
|
||||
|
||||
class testCls {
|
||||
static boo = foo;
|
||||
}
|
||||
|
||||
function testFn(){
|
||||
static boo = foo;
|
||||
|
||||
//Increments
|
||||
globalVar++;
|
||||
fooCls.clsSVar++;
|
||||
modVar++;
|
||||
}
|
||||
|
||||
module testMod {
|
||||
var boo = foo;
|
||||
}
|
||||
}
|
||||
|
||||
//Type test
|
||||
var clsTest: fooCls;
|
||||
|
||||
//Arguments
|
||||
clsTest = new fooCls(globalVar);
|
||||
foo(globalVar);
|
||||
|
||||
//Increments
|
||||
fooCls.clsSVar++;
|
||||
modTest.modVar++;
|
||||
globalVar = globalVar + globalVar;
|
||||
|
||||
//ETC - Other cases
|
||||
globalVar = 3;
|
||||
foo = foo + 1;
|
||||
err = err++;
|
||||
|
||||
//Shadowed fn Parameter
|
||||
function shdw(globalVar: number) {
|
||||
//Increments
|
||||
globalVar++;
|
||||
return globalVar;
|
||||
}
|
||||
|
||||
//Remotes
|
||||
//Type test
|
||||
var remoteclsTest: remotefooCls;
|
||||
|
||||
//Arguments
|
||||
remoteclsTest = new remotefooCls(remoteglobalVar);
|
||||
remotefoo(remoteglobalVar);
|
||||
|
||||
//Increments
|
||||
remotefooCls.remoteclsSVar++;
|
||||
remotemodTest.remotemodVar++;
|
||||
remoteglobalVar = remoteglobalVar + remoteglobalVar;
|
||||
|
||||
//ETC - Other cases
|
||||
remoteglobalVar = 3;
|
||||
|
||||
//Find References misses method param
|
||||
var
|
||||
|
||||
|
||||
|
||||
array = ["f", "o", "o"];
|
||||
|
||||
array.forEach(
|
||||
|
||||
|
||||
function(str) {
|
||||
|
||||
|
||||
|
||||
return str + " ";
|
||||
|
||||
});
|
||||
@@ -1,59 +0,0 @@
|
||||
var remoteglobalVar: number = 2;
|
||||
|
||||
class remotefooCls {
|
||||
//Declare
|
||||
remoteclsVar = 1;
|
||||
static remoteclsSVar = 1;
|
||||
|
||||
constructor (public remoteclsParam: number) {
|
||||
//Increments
|
||||
remoteglobalVar++;
|
||||
this.remoteclsVar++;
|
||||
remotefooCls.remoteclsSVar++;
|
||||
this.remoteclsParam++;
|
||||
remotemodTest.remotemodVar++;
|
||||
}
|
||||
}
|
||||
|
||||
function remotefoo(remotex: number) {
|
||||
//Declare
|
||||
var remotefnVar = 1;
|
||||
|
||||
//Increments
|
||||
remotefooCls.remoteclsSVar++;
|
||||
remoteglobalVar++;
|
||||
remotemodTest.remotemodVar++;
|
||||
remotefnVar++;
|
||||
|
||||
//Return
|
||||
return remotex++;
|
||||
}
|
||||
|
||||
module remotemodTest {
|
||||
//Declare
|
||||
export var remotemodVar:number;
|
||||
|
||||
//Increments
|
||||
remoteglobalVar++;
|
||||
remotefooCls.remoteclsSVar++;
|
||||
remotemodVar++;
|
||||
|
||||
class remotetestCls {
|
||||
static remoteboo = remotefoo;
|
||||
}
|
||||
|
||||
function remotetestFn(){
|
||||
static remoteboo = remotefoo;
|
||||
|
||||
//Increments
|
||||
remoteglobalVar++;
|
||||
remotefooCls.remoteclsSVar++;
|
||||
remotemodVar++;
|
||||
}
|
||||
|
||||
module remotetestMod {
|
||||
var remoteboo = remotefoo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
module FindRef3 {
|
||||
module SimpleClassTest {
|
||||
export class Foo {
|
||||
public foo(): void {
|
||||
}
|
||||
}
|
||||
export class Bar extends Foo {
|
||||
public foo(): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module SimpleInterfaceTest {
|
||||
export interface IFoo {
|
||||
foo(): void;
|
||||
}
|
||||
export interface IBar extends IFoo {
|
||||
foo(): void;
|
||||
}
|
||||
}
|
||||
|
||||
module SimpleClassInterfaceTest {
|
||||
export interface IFoo {
|
||||
foo(): void;
|
||||
}
|
||||
export class Bar implements IFoo {
|
||||
public foo(): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module Test {
|
||||
export interface IBase {
|
||||
field: string;
|
||||
method(): void;
|
||||
}
|
||||
|
||||
export interface IBlah extends IBase {
|
||||
field: string;
|
||||
}
|
||||
|
||||
export interface IBlah2 extends IBlah {
|
||||
field: string;
|
||||
}
|
||||
|
||||
export interface IDerived extends IBlah2 {
|
||||
method(): void;
|
||||
}
|
||||
|
||||
export class Bar implements IDerived {
|
||||
public field: string;
|
||||
public method(): void { }
|
||||
}
|
||||
|
||||
export class BarBlah extends Bar {
|
||||
public field: string;
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
var x = new SimpleClassTest.Bar();
|
||||
x.foo();
|
||||
|
||||
var y: SimpleInterfaceTest.IBar = null;
|
||||
y.foo();
|
||||
|
||||
var z = new Test.BarBlah();
|
||||
z.field = "";
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
module FindRef4 {
|
||||
module MixedStaticsClassTest {
|
||||
export class Foo {
|
||||
bar: Foo;
|
||||
static bar: Foo;
|
||||
|
||||
public foo(): void {
|
||||
}
|
||||
public static foo(): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
// instance function
|
||||
var x = new MixedStaticsClassTest.Foo();
|
||||
x.foo();
|
||||
x.bar;
|
||||
|
||||
var y = new MixedStaticsClassTest.Foo();
|
||||
y.foo();
|
||||
y.bar;
|
||||
|
||||
// static function
|
||||
MixedStaticsClassTest.Foo.foo();
|
||||
MixedStaticsClassTest.Foo.bar;
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
module Bar { // Module
|
||||
var x: number; // Variable
|
||||
function f(): void { } // Function
|
||||
|
||||
interface IFoo {
|
||||
(i: number): IFoo; // CallSignature
|
||||
new (): IFoo; // ConstructSignature
|
||||
[i: number]: number; // IndexSignature
|
||||
foo: number; // PropertySignature
|
||||
bar(): void; // FunctionSignature
|
||||
}
|
||||
|
||||
enum Blah {
|
||||
foo = 2 // EnumMemberDeclaration
|
||||
}
|
||||
|
||||
class Bar {
|
||||
constructor(private barVar: Bar) { } // ConstructorImplementation
|
||||
|
||||
public barProp: number; // MemberVariableDeclaration
|
||||
public barPropFunc(): void { } // MemberFunctionDeclaration
|
||||
public get prop1(): void { } // MemberAccessorDeclaration
|
||||
public set prop1() { } // MemberAccessorDeclaration
|
||||
|
||||
private barPropP: number; // MemberVariableDeclaration
|
||||
private barPropFuncP(): void { } // MemberFunctionDeclaration
|
||||
private get prop1P(): void { } // MemberAccessorDeclaration
|
||||
private set prop1P() { } // MemberAccessorDeclaration
|
||||
|
||||
static foo: number; // StaticVariableDeclaration
|
||||
static bar(): void { } // StaticFunctionDeclaration
|
||||
static get foo2(): void { } // StaticAccessorDeclaration
|
||||
static set foo2() { } // StaticAccessorDeclaration
|
||||
}
|
||||
}
|
||||
|
||||
module Bar2 { // Module
|
||||
export var x: number; // Variable
|
||||
export function f(): void { } // Function
|
||||
|
||||
export interface IFoo {
|
||||
(i: number): IFoo; // CallSignature
|
||||
new (): IFoo; // ConstructSignature
|
||||
[i: number]: number; // IndexSignature
|
||||
foo: number; // PropertySignature
|
||||
bar(): void; // FunctionSignature
|
||||
}
|
||||
|
||||
export enum Blah {
|
||||
foo = 2 // EnumMemberDeclaration
|
||||
}
|
||||
|
||||
export class Bar {
|
||||
constructor(private barVar: Bar) { } // ConstructorImplementation
|
||||
|
||||
public barProp: number; // MemberVariableDeclaration
|
||||
public barPropFunc(): void { } // MemberFunctionDeclaration
|
||||
public get prop1(): void { } // MemberAccessorDeclaration
|
||||
public set prop1() { } // MemberAccessorDeclaration
|
||||
|
||||
private barPropP: number; // MemberVariableDeclaration
|
||||
private barPropFuncP(): void { } // MemberFunctionDeclaration
|
||||
private get prop1P(): void { } // MemberAccessorDeclaration
|
||||
private set prop1P() { } // MemberAccessorDeclaration
|
||||
|
||||
static foo: number; // StaticVariableDeclaration
|
||||
static bar(): void { } // StaticFunctionDeclaration
|
||||
static get foo2(): void { } // StaticAccessorDeclaration
|
||||
static set foo2() { } // StaticAccessorDeclaration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare module Bar3 {
|
||||
|
||||
}
|
||||
|
||||
module Bar4 { // Module
|
||||
declare var x: number; // Variable
|
||||
declare function f(): void; // Function
|
||||
|
||||
declare interface IFoo {
|
||||
(i: number): IFoo; // CallSignature
|
||||
new (): IFoo; // ConstructSignature
|
||||
[i: number]: number; // IndexSignature
|
||||
foo: number; // PropertySignature
|
||||
bar(): void; // FunctionSignature
|
||||
}
|
||||
|
||||
declare enum Blah {
|
||||
foo = 2 // EnumMemberDeclaration
|
||||
}
|
||||
|
||||
declare class Bar {
|
||||
constructor (private barVar: Bar); // ConstructorImplementation
|
||||
|
||||
public barProp: number; // MemberVariableDeclaration
|
||||
public barPropFunc(): void; // MemberFunctionDeclaration
|
||||
public get prop1(): void; // MemberAccessorDeclaration
|
||||
public set prop1(); // MemberAccessorDeclaration
|
||||
|
||||
private barPropP: number; // MemberVariableDeclaration
|
||||
private barPropFuncP(): void; // MemberFunctionDeclaration
|
||||
private get prop1P(): void; // MemberAccessorDeclaration
|
||||
private set prop1P(); // MemberAccessorDeclaration
|
||||
|
||||
static foo: number; // StaticVariableDeclaration
|
||||
static bar(): void; // StaticFunctionDeclaration
|
||||
static get foo2(): void; // StaticAccessorDeclaration
|
||||
static set foo2(); // StaticAccessorDeclaration
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
//Comment
|
||||
class sampleCls { constructor (str: string, num: number) { } }
|
||||
var x = new sampleCls("", 5); // new() test
|
||||
sampleCls(); // negative test
|
||||
|
||||
function fnTest(str: string, num: number) { }
|
||||
fnTest(); // simple function test
|
||||
|
||||
function fnOverload();
|
||||
function fnOverload(test: string); function fnOverload(test: string) { }
|
||||
fnOverload()
|
||||
fnOverload("")
|
||||
|
||||
class clsOverload { constructor (); constructor (test: string); constructor (test?: string) { } }
|
||||
var x = new clsOverload();
|
||||
var x = new clsOverload("");
|
||||
|
||||
module SimpleTests {
|
||||
module CallExpressions {
|
||||
class Foo {
|
||||
public f1() { }
|
||||
public f2(n: number) { }
|
||||
public f3(n: number, s: string) { }
|
||||
|
||||
}
|
||||
|
||||
var x = new Foo();
|
||||
x.f1();
|
||||
x.f2(5);
|
||||
x.f3(5, "");
|
||||
x.f1(
|
||||
x.f2(5,
|
||||
x.f3(5,
|
||||
}
|
||||
|
||||
module NewExpressions {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module OverloadTests {
|
||||
module CallExpressions {
|
||||
function foo(callback: (a: number, b: string) => string) {
|
||||
callback(5, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module AnonymousFunctionTest {
|
||||
var x2 = function (n: number, s: string): (a: number, b: string) => string {
|
||||
return null;
|
||||
}
|
||||
x2(5, "")(1, "");
|
||||
}
|
||||
|
||||
module ObjectLiteralTest {
|
||||
var x = { n: 5, s: "", f: (a: number, b: string) => "" };
|
||||
x.f(4, "");
|
||||
}
|
||||
|
||||
module SuperCallTest {
|
||||
class base {
|
||||
constructor(s: string);
|
||||
constructor(n: number);
|
||||
constructor(a: any) { }
|
||||
}
|
||||
class A extends base {
|
||||
constructor() {
|
||||
super("");
|
||||
}
|
||||
}
|
||||
|
||||
class B extends base {
|
||||
}
|
||||
class B2 extends B {
|
||||
}
|
||||
class B3 extends B2 {
|
||||
constructor() {
|
||||
super("");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
function Foo(arg1: string, arg2: string) {
|
||||
|
||||
}
|
||||
|
||||
Foo(
|
||||
@@ -1,132 +0,0 @@
|
||||
module Foo {
|
||||
|
||||
class Bar {
|
||||
|
||||
private foo:string = "";
|
||||
|
||||
private f() {
|
||||
var a:any[] = [[1, 2], [3, 4], 5];
|
||||
|
||||
return ((1 + 1));
|
||||
}
|
||||
|
||||
private f2() {
|
||||
if(true) { }{ };
|
||||
}
|
||||
}
|
||||
|
||||
interface Foo {
|
||||
|
||||
x:number;
|
||||
|
||||
foo():number;
|
||||
|
||||
}
|
||||
|
||||
module Foo2 {
|
||||
|
||||
function f() {
|
||||
}
|
||||
|
||||
var x: number;
|
||||
|
||||
}
|
||||
|
||||
enum Foo3 {
|
||||
|
||||
val1,
|
||||
|
||||
val2,
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function foo(bar,
|
||||
blah,
|
||||
|
||||
);
|
||||
|
||||
|
||||
function test() {
|
||||
for (var i = 0; i < 10; i++) {
|
||||
|
||||
}
|
||||
|
||||
for (var e in foo.bar) {
|
||||
|
||||
}
|
||||
|
||||
with (foo.bar) {
|
||||
|
||||
}
|
||||
|
||||
switch(foo.bar) {
|
||||
|
||||
}
|
||||
|
||||
switch (foo.bar) {
|
||||
|
||||
case 1:
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function tryCatch() {
|
||||
|
||||
try {
|
||||
|
||||
}
|
||||
|
||||
catch(err) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function tryFinally() {
|
||||
|
||||
try {
|
||||
|
||||
}
|
||||
|
||||
finally {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function tryCatchFinally() {
|
||||
|
||||
try {
|
||||
|
||||
}
|
||||
|
||||
catch(err) {
|
||||
|
||||
}
|
||||
|
||||
finally {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
module SwitchTest {
|
||||
var a = 3;
|
||||
|
||||
if (a == 5) {
|
||||
switch (a) {
|
||||
case 1:
|
||||
if (a == 5) {
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
//
|
||||
// Note: Do not add more tests at the end of this file, as
|
||||
// the purpose of this test is to verity smart indent
|
||||
// works for unterminated function arguments at the end of a file.
|
||||
//
|
||||
|
||||
function foo(a,
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
//
|
||||
// Note: Do not add more tests at the end of this file, as
|
||||
// the purpose of this test is to verity smart indent
|
||||
// works for unterminated if statements at the end of a file.
|
||||
//
|
||||
if (true)
|
||||
@@ -1,24 +0,0 @@
|
||||
// djf dasjkfh asdkfjhsa dfjhgsdfhjdfg dasfg asdjfhg asdfjga sfjhgdf jhfg asfsadfhg afjh gfjds
|
||||
// djf dasjkfh asdkfjhsa dfjhgsdfhjdfg dasfg asdjfhg asdfjga sfjhgdf jhfg asfsadfhg afjh gfjds
|
||||
// djf dasjkfh asdkfjhsa dfjhgsdfhjdfg dasfg asdjfhg asdfjga sfjhgdf jhfg asfsadfhg afjh gfjds
|
||||
// djf dasjkfh asdkfjhsa dfjhgsdfhjdfg dasfg asdjfhg asdfjga sfjhgdf jhfg asfsadfhg afjh gfjds
|
||||
// djf dasjkfh asdkfjhsa dfjhgsdfhjdfg dasfg asdjfhg asdfjga sfjhgdf jhfg asfsadfhg afjh gfjds
|
||||
// djf dasjkfh asdkfjhsa dfjhgsdfhjdfg dasfg asdjfhg asdfjga sfjhgdf jhfg asfsadfhg afjh gfjds
|
||||
// djf dasjkfh asdkfjhsa dfjhgsdfhjdfg dasfg asdjfhg asdfjga sfjhgdf jhfg asfsadfhg afjh gfjds
|
||||
|
||||
function tryCatchFinally() {
|
||||
addsdfsdafsdafsdfdsfdsfsfsaafdsddfsdaf;
|
||||
try {
|
||||
|
||||
}
|
||||
|
||||
catch(err) {
|
||||
|
||||
}
|
||||
|
||||
finally {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
interface bah {
|
||||
(y: number);
|
||||
x: number;
|
||||
(z: string)
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
module SimpleClassTest {
|
||||
class Foo {
|
||||
public foo(): void {
|
||||
}
|
||||
}
|
||||
class Bar extends Foo {
|
||||
public foo(): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module SimpleInterfaceTest {
|
||||
interface IFoo {
|
||||
foo(): void;
|
||||
}
|
||||
interface IBar extends IFoo {
|
||||
foo(): void;
|
||||
}
|
||||
}
|
||||
|
||||
module SimpleClassInterfaceTest {
|
||||
interface IFoo {
|
||||
foo(): void;
|
||||
}
|
||||
class Bar implements IFoo {
|
||||
public foo(): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module Test {
|
||||
interface IBase {
|
||||
field: string;
|
||||
method(): void;
|
||||
}
|
||||
|
||||
interface IBlah extends IBase {
|
||||
field: string;
|
||||
}
|
||||
|
||||
interface IBlah2 extends IBlah {
|
||||
field: string;
|
||||
}
|
||||
|
||||
interface IDerived extends IBlah2 {
|
||||
method(): void;
|
||||
}
|
||||
|
||||
class Bar implements IDerived {
|
||||
public field: string;
|
||||
public method(): void { }
|
||||
}
|
||||
|
||||
class BarBlah extends Bar {
|
||||
public field: string;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
// Local inside a class
|
||||
|
||||
var n = 14;
|
||||
|
||||
class foo {
|
||||
private ^^[|n|] = 0;
|
||||
|
||||
public bar() {
|
||||
this.[|n|] = 9;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.[|n|]^^ = 4;
|
||||
}
|
||||
|
||||
public bar2() {
|
||||
var n = 12;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
// Reference to a class parameter
|
||||
|
||||
var p = 2;
|
||||
|
||||
class p { }
|
||||
|
||||
class foo {
|
||||
constructor (public p: any) {
|
||||
}
|
||||
|
||||
public f(p) {
|
||||
this.^^[|p|] = p;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var n = new foo(undefined);
|
||||
n.^^[|p|] = null;
|
||||
@@ -1,4 +0,0 @@
|
||||
// References to ^^foo or b^^ar
|
||||
/* in comments should not find fo^^o or bar^^ */
|
||||
class foo { }
|
||||
var bar = 0;
|
||||
@@ -1,6 +0,0 @@
|
||||
// function overloads should be highlighted together
|
||||
|
||||
function [|^^foo|](x: string);
|
||||
function [|^^foo|](x: string, y: number) {
|
||||
[|^^foo|]('', 43);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
var x;
|
||||
var n;
|
||||
|
||||
function n(x: number, [|n|]^^: number) {
|
||||
^^[|n|] = 32;
|
||||
x = [|n|];
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// Global variable reference
|
||||
|
||||
var ^^global = 2;
|
||||
|
||||
class foo {
|
||||
constructor (public global) { }
|
||||
public f(global) { }
|
||||
public f2(global) { }
|
||||
}
|
||||
|
||||
class bar {
|
||||
constructor () {
|
||||
var n = [|global|];
|
||||
|
||||
var f = new foo('');
|
||||
f.global = '';
|
||||
}
|
||||
}
|
||||
|
||||
var k = [|global|];
|
||||
|
||||
================
|
||||
var m = [|global|];
|
||||
@@ -1,2 +0,0 @@
|
||||
// Neither should cause highlighting to occur
|
||||
f^^oo = fo^^o;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Should still highlight even though it's invalid assignment
|
||||
var ^^[|foo|] = function() { };
|
||||
|
||||
[|fo^^o|] = [|f^^oo|] + 1;
|
||||
@@ -1,20 +0,0 @@
|
||||
module modTest {
|
||||
//Declare
|
||||
export var modVar:number;
|
||||
^^
|
||||
|
||||
//Increments
|
||||
modVar++;
|
||||
|
||||
class testCls{
|
||||
^^
|
||||
}
|
||||
|
||||
function testFn(){
|
||||
//Increments
|
||||
modVar++;
|
||||
} ^^
|
||||
^^
|
||||
module testMod {
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// Class references should work across file and not find local variables
|
||||
class [|foo|]^^ {
|
||||
public n: ^^[|foo|];
|
||||
public foo: number;
|
||||
}
|
||||
|
||||
class bar {
|
||||
public n: [|f^^o^^o|];
|
||||
public k = new [|foo|]();
|
||||
}
|
||||
|
||||
module mod {
|
||||
var k: [|foo|] = null;
|
||||
}
|
||||
|
||||
===================
|
||||
var k: ^^[|foo|];
|
||||
@@ -1,28 +0,0 @@
|
||||
// reference a class static
|
||||
|
||||
var n = 43;
|
||||
|
||||
class foo {
|
||||
static [|n|] = '';
|
||||
|
||||
public bar() {
|
||||
foo.^^[|n|] = "'";
|
||||
if(foo.[|n|]) {
|
||||
var x = foo.[|n|];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class foo2 {
|
||||
private x = foo.[|n|]^^;
|
||||
constructor() {
|
||||
foo.^^[|n|] = x;
|
||||
}
|
||||
|
||||
function b(n) {
|
||||
n = foo.[|n|];
|
||||
}
|
||||
}
|
||||
|
||||
=================
|
||||
var q = foo.[|n|];
|
||||
Reference in new issue
Block a user