mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Merge branch 'master' into useReturnedThisFromSuperCalls
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export var x;
|
||||
export = {};
|
||||
36
tests/cases/compiler/maxNodeModuleJsDepthDefaultsToZero.ts
Normal file
36
tests/cases/compiler/maxNodeModuleJsDepthDefaultsToZero.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
// @module: commonjs
|
||||
// @moduleResolution: node
|
||||
// @allowJs: true
|
||||
// @traceResolution: true
|
||||
// @noEmit: true
|
||||
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "bin"
|
||||
},
|
||||
"exclude": [ "node_modules" ]
|
||||
}
|
||||
// @filename: /node_modules/shortid/node_modules/z/index.js
|
||||
// z will not be found because maxNodeModulesJsDepth: 0
|
||||
module.exports = { z: 'no' };
|
||||
|
||||
// @filename: /node_modules/shortid/index.js
|
||||
var z = require('z');
|
||||
var y = { y: 'foo' };
|
||||
module.exports = y;
|
||||
|
||||
// @filename: /typings/index.d.ts
|
||||
declare module "shortid" {
|
||||
export var x: number;
|
||||
}
|
||||
|
||||
// @filename: /index.ts
|
||||
/// <reference path="/typings/index.d.ts" />
|
||||
import * as foo from "shortid";
|
||||
foo.x // found in index.d.ts
|
||||
foo.y // ignored from shortid/index.js
|
||||
|
||||
14
tests/cases/compiler/noImplicitAnyMissingGetAccessor.ts
Normal file
14
tests/cases/compiler/noImplicitAnyMissingGetAccessor.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// @noImplicitAny : true
|
||||
// @target: es5
|
||||
|
||||
abstract class Parent
|
||||
{
|
||||
public abstract set message(str);
|
||||
}
|
||||
|
||||
class Child extends Parent {
|
||||
_x: any;
|
||||
public set message(str) {
|
||||
this._x = str;
|
||||
}
|
||||
}
|
||||
13
tests/cases/compiler/noImplicitAnyMissingSetAccessor.ts
Normal file
13
tests/cases/compiler/noImplicitAnyMissingSetAccessor.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
// @noImplicitAny: true
|
||||
// @target: es5
|
||||
|
||||
abstract class Parent
|
||||
{
|
||||
public abstract get message();
|
||||
}
|
||||
|
||||
class Child extends Parent {
|
||||
public get message() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
3
tests/cases/compiler/parseObjectLiteralsWithoutTypes.ts
Normal file
3
tests/cases/compiler/parseObjectLiteralsWithoutTypes.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
let x: { foo, bar }
|
||||
let y: { foo: number, bar }
|
||||
let z: { foo, bar: number }
|
||||
@@ -4,7 +4,7 @@
|
||||
// @traceResolution: true
|
||||
// @types: lib
|
||||
// @out: output.js
|
||||
// @module: amd
|
||||
|
||||
// @currentDirectory: /
|
||||
|
||||
// @filename: /types/lib/index.d.ts
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// @typeRoots: /types
|
||||
// @traceResolution: true
|
||||
// @out: output.js
|
||||
// @module: amd
|
||||
|
||||
// @currentDirectory: /
|
||||
|
||||
// @filename: /types/lib/index.d.ts
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// @noImplicitReferences: true
|
||||
// @traceResolution: true
|
||||
// @currentDirectory: /src
|
||||
|
||||
// @Filename: /node_modules/@types/dopey/index.d.ts
|
||||
declare module "xyz" {
|
||||
export const x: number;
|
||||
}
|
||||
|
||||
// @Filename: /foo/node_modules/@types/grumpy/index.d.ts
|
||||
declare module "pdq" {
|
||||
export const y: number;
|
||||
}
|
||||
|
||||
// @Filename: /foo/node_modules/@types/sneezy/index.d.ts
|
||||
declare module "abc" {
|
||||
export const z: number;
|
||||
}
|
||||
|
||||
// @Filename: /foo/bar/a.ts
|
||||
import { x } from "xyz";
|
||||
import { y } from "pdq";
|
||||
import { z } from "abc";
|
||||
x + y + z;
|
||||
|
||||
// @Filename: /foo/bar/tsconfig.json
|
||||
{}
|
||||
@@ -0,0 +1,15 @@
|
||||
// @noImplicitReferences: true
|
||||
// @traceResolution: true
|
||||
// @currentDirectory: /src
|
||||
|
||||
// @Filename: /node_modules/@types/foo/index.d.ts
|
||||
declare module "xyz" {
|
||||
export const x: number;
|
||||
}
|
||||
|
||||
// @Filename: /src/a.ts
|
||||
import { x } from "xyz";
|
||||
x;
|
||||
|
||||
// @Filename: /src/tsconfig.json
|
||||
{}
|
||||
15
tests/cases/compiler/umdGlobalConflict.ts
Normal file
15
tests/cases/compiler/umdGlobalConflict.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
//@filename: v1/index.d.ts
|
||||
export as namespace Alpha;
|
||||
export var x: string;
|
||||
|
||||
//@filename: v2/index.d.ts
|
||||
export as namespace Alpha;
|
||||
export var y: number;
|
||||
|
||||
//@filename: consumer.ts
|
||||
import * as v1 from './v1';
|
||||
import * as v2 from './v2';
|
||||
|
||||
//@filename: global.ts
|
||||
// Should be OK, first in wins
|
||||
const p: string = Alpha.x;
|
||||
@@ -0,0 +1,8 @@
|
||||
// @experimentalDecorators: true
|
||||
|
||||
class CtorDtor {}
|
||||
|
||||
@CtorDtor
|
||||
class C {
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
var name: string = "my name";
|
||||
|
||||
var person: { b: string; id: number } = { name, id }; // error
|
||||
var person1: { name, id }; // error: can't use short-hand property assignment in type position
|
||||
var person1: { name, id }; // ok
|
||||
function foo(name: string, id: number): { id: string, name: number } { return { name, id }; } // error
|
||||
function bar(obj: { name: string; id: boolean }) { }
|
||||
bar({ name, id }); // error
|
||||
|
||||
@@ -4,5 +4,5 @@ var name: string = "my name";
|
||||
var person: { b: string; id: number } = { name, id }; // error
|
||||
function bar(name: string, id: number): { name: number, id: string } { return { name, id }; } // error
|
||||
function foo(name: string, id: number): { name: string, id: number } { return { name, id }; } // error
|
||||
var person1: { name, id }; // error : Can't use shorthand in the type position
|
||||
var person2: { name: string, id: number } = bar("hello", 5);
|
||||
var person1: { name, id }; // ok
|
||||
var person2: { name: string, id: number } = bar("hello", 5);
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
var tag: Function;
|
||||
tag `Hello world!`;
|
||||
@@ -0,0 +1,3 @@
|
||||
class CtorTag { }
|
||||
|
||||
CtorTag `Hello world!`;
|
||||
@@ -0,0 +1,6 @@
|
||||
interface I {
|
||||
new (...args: any[]): string;
|
||||
new (): number;
|
||||
}
|
||||
var tag: I;
|
||||
tag `Hello world!`;
|
||||
985
tests/cases/conformance/fixSignatureCaching.ts
Normal file
985
tests/cases/conformance/fixSignatureCaching.ts
Normal file
File diff suppressed because one or more lines are too long
@@ -12,28 +12,25 @@
|
||||
|
||||
goTo.marker("useFoo");
|
||||
verify.quickInfoIs("import foo");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("importFoo");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
verify.goToDefinition({
|
||||
useFoo: "importFoo",
|
||||
importFoo: "module"
|
||||
});
|
||||
|
||||
goTo.marker("useBar");
|
||||
verify.quickInfoIs("import bar");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
verify.goToDefinition("useBar", "module");
|
||||
|
||||
goTo.marker("useBaz");
|
||||
verify.quickInfoIs("import baz");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("importBaz");
|
||||
goTo.marker("idBaz");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
verify.goToDefinition({
|
||||
useBaz: "importBaz",
|
||||
idBaz: "module"
|
||||
});
|
||||
|
||||
goTo.marker("useBang");
|
||||
verify.quickInfoIs("import bang = require(\"jquery\")");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("importBang");
|
||||
goTo.marker("idBang");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
verify.goToDefinition({
|
||||
useBang: "importBang",
|
||||
idBang: "module"
|
||||
});
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
////d./*1*/
|
||||
////D./*2*/
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker('1');
|
||||
verify.completionListContains('foo');
|
||||
verify.completionListContains('foo2');
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
////d./*1*/
|
||||
////D./*2*/
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker('1');
|
||||
verify.completionListContains('foo');
|
||||
verify.completionListContains('foo2');
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
|
||||
goTo.marker('1');
|
||||
verify.completionListContains('f');
|
||||
verify.completionListContains('foo');
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('var M.C.C: typeof M.C');
|
||||
verify.numberOfErrorsInCurrentFile(0);
|
||||
@@ -58,9 +58,6 @@
|
||||
////}
|
||||
////var myVar = new m.m2.c/*33*/1();
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs("class c2", "This is class c2 without constuctor");
|
||||
|
||||
|
||||
@@ -31,9 +31,6 @@
|
||||
/////*10*/extMod./*11*/m1./*12*/fooExp/*13q*/ort(/*13*/);
|
||||
////var new/*14*/Var = new extMod.m1.m2./*15*/c();
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.file("commentsExternalModules_file0.ts");
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs("namespace m1", "Namespace comment");
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
////}
|
||||
////new /*7*/mu/*8*/ltiM.d();
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
goTo.marker('1');
|
||||
verify.completionListContains("multiM", "namespace multiM", "this is multi declare namespace\nthi is multi namespace 2\nthis is multi namespace 3 comment");
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
////new /*1*/mu/*4*/ltiM.b();
|
||||
////new mu/*5*/ltiM.c();
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker('1');
|
||||
verify.completionListContains("multiM", "namespace multiM", "this is multi declare namespace\nthi is multi namespace 2");
|
||||
|
||||
|
||||
33
tests/cases/fourslash/completionForStringLiteralImport1.ts
Normal file
33
tests/cases/fourslash/completionForStringLiteralImport1.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should define spans for replacement that appear after the last directory seperator in import statements
|
||||
|
||||
// @typeRoots: my_typings
|
||||
|
||||
// @Filename: test.ts
|
||||
//// import * as foo0 from "./[|some|]/*0*/
|
||||
//// import * as foo1 from "./sub/[|some|]/*1*/
|
||||
//// import * as foo2 from "[|some-|]/*2*/"
|
||||
//// import * as foo3 from "../[||]/*3*/";
|
||||
|
||||
|
||||
// @Filename: someFile1.ts
|
||||
//// /*someFile1*/
|
||||
|
||||
// @Filename: sub/someFile2.ts
|
||||
//// /*someFile2*/
|
||||
|
||||
// @Filename: my_typings/some-module/index.d.ts
|
||||
//// export var x = 9;
|
||||
|
||||
goTo.marker("0");
|
||||
verify.completionListContains("someFile1", undefined, undefined, undefined, 0);
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("someFile2", undefined, undefined, undefined, 1);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("some-module", undefined, undefined, undefined, 2);
|
||||
|
||||
goTo.marker("3");
|
||||
verify.completionListContains("fourslash", undefined, undefined, undefined, 3);
|
||||
33
tests/cases/fourslash/completionForStringLiteralImport2.ts
Normal file
33
tests/cases/fourslash/completionForStringLiteralImport2.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should define spans for replacement that appear after the last directory seperator in triple slash references
|
||||
|
||||
// @typeRoots: my_typings
|
||||
|
||||
// @Filename: test.ts
|
||||
//// /// <reference path="./[|some|]/*0*/
|
||||
//// /// <reference types="[|some|]/*1*/
|
||||
|
||||
//// /// <reference path="./sub/[|some|]/*2*/" />
|
||||
//// /// <reference types="[|some|]/*3*/" />
|
||||
|
||||
// @Filename: someFile.ts
|
||||
//// /*someFile*/
|
||||
|
||||
// @Filename: sub/someOtherFile.ts
|
||||
//// /*someOtherFile*/
|
||||
|
||||
// @Filename: my_typings/some-module/index.d.ts
|
||||
//// export var x = 9;
|
||||
|
||||
goTo.marker("0");
|
||||
verify.completionListContains("someFile.ts", undefined, undefined, undefined, 0);
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("some-module", undefined, undefined, undefined, 1);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("someOtherFile.ts", undefined, undefined, undefined, 2);
|
||||
|
||||
goTo.marker("3");
|
||||
verify.completionListContains("some-module", undefined, undefined, undefined, 3);
|
||||
@@ -0,0 +1,63 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for node modules and files within those modules with ts file extensions
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "f/*import_as0*/
|
||||
//// import * as foo2 from "fake-module//*import_as1*/
|
||||
//// import * as foo3 from "fake-module/*import_as2*/
|
||||
|
||||
//// import foo4 = require("f/*import_equals0*/
|
||||
//// import foo5 = require("fake-module//*import_equals1*/
|
||||
//// import foo6 = require("fake-module/*import_equals2*/
|
||||
|
||||
//// var foo7 = require("f/*require0*/
|
||||
//// var foo8 = require("fake-module//*require1*/
|
||||
//// var foo9 = require("fake-module/*require2*/
|
||||
|
||||
// @Filename: package.json
|
||||
//// { "dependencies": { "fake-module": "latest" }, "devDependencies": { "fake-module-dev": "latest" } }
|
||||
|
||||
// @Filename: node_modules/fake-module/index.js
|
||||
//// /*fake-module*/
|
||||
// @Filename: node_modules/fake-module/index.d.ts
|
||||
//// /*fakemodule-d-ts*/
|
||||
// @Filename: node_modules/fake-module/ts.ts
|
||||
//// /*ts*/
|
||||
// @Filename: node_modules/fake-module/dts.d.ts
|
||||
//// /*dts*/
|
||||
// @Filename: node_modules/fake-module/tsx.tsx
|
||||
//// /*tsx*/
|
||||
// @Filename: node_modules/fake-module/js.js
|
||||
//// /*js*/
|
||||
// @Filename: node_modules/fake-module/jsx.jsx
|
||||
//// /*jsx*/
|
||||
|
||||
// @Filename: node_modules/fake-module-dev/index.js
|
||||
//// /*fakemodule-dev*/
|
||||
// @Filename: node_modules/fake-module-dev/index.d.ts
|
||||
//// /*fakemodule-dev-d-ts*/
|
||||
|
||||
// @Filename: node_modules/unlisted-module/index.ts
|
||||
//// /*unlisted-module*/
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListContains("fake-module");
|
||||
verify.completionListContains("fake-module-dev");
|
||||
verify.not.completionListItemsCountIsGreaterThan(2);
|
||||
|
||||
goTo.marker(kind + "1");
|
||||
verify.completionListContains("index");
|
||||
verify.completionListContains("ts");
|
||||
verify.completionListContains("dts");
|
||||
verify.completionListContains("tsx");
|
||||
verify.not.completionListItemsCountIsGreaterThan(4);
|
||||
|
||||
goTo.marker(kind + "2");
|
||||
verify.completionListContains("fake-module");
|
||||
verify.completionListContains("fake-module-dev");
|
||||
verify.not.completionListItemsCountIsGreaterThan(2);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should not give node module completions if classic module resolution is enabled
|
||||
|
||||
// @moduleResolution: classic
|
||||
|
||||
// @Filename: dir1/dir2/dir3/dir4/test0.ts
|
||||
//// import * as foo1 from "f/*import_as0*/
|
||||
//// import * as foo3 from "fake-module/*import_as1*/
|
||||
|
||||
//// import foo4 = require("f/*import_equals0*/
|
||||
//// import foo6 = require("fake-module/*import_equals1*/
|
||||
|
||||
//// var foo7 = require("f/*require0*/
|
||||
//// var foo9 = require("fake-module/*require1*/
|
||||
|
||||
// @Filename: package.json
|
||||
//// { "dependencies": { "fake-module": "latest" } }
|
||||
// @Filename: node_modules/fake-module/ts.ts
|
||||
//// /*module1*/
|
||||
|
||||
// @Filename: dir1/dir2/dir3/package.json
|
||||
//// { "dependencies": { "fake-module3": "latest" } }
|
||||
// @Filename: dir1/dir2/dir3/node_modules/fake-module3/ts.ts
|
||||
//// /*module3*/
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListIsEmpty();
|
||||
|
||||
goTo.marker(kind + "1");
|
||||
verify.completionListIsEmpty();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should handle nested files in folders discovered via the baseUrl compiler option
|
||||
|
||||
// @baseUrl: tests/cases/fourslash/modules
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "subfolder//*import_as0*/
|
||||
//// import foo2 = require("subfolder//*import_equals0*/
|
||||
//// var foo3 = require("subfolder//*require0*/
|
||||
|
||||
//// import * as foo1 from "module-from-node//*import_as1*/
|
||||
//// import foo2 = require("module-from-node//*import_equals1*/
|
||||
//// var foo3 = require("module-from-node//*require1*/
|
||||
|
||||
// @Filename: modules/subfolder/module.ts
|
||||
//// export var x = 5;
|
||||
|
||||
// @Filename: package.json
|
||||
//// { "dependencies": { "module-from-node": "latest" } }
|
||||
// @Filename: node_modules/module-from-node/index.ts
|
||||
//// /*module1*/
|
||||
|
||||
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
|
||||
verify.completionListContains("module");
|
||||
verify.not.completionListItemsCountIsGreaterThan(1);
|
||||
|
||||
goTo.marker(kind + "1");
|
||||
|
||||
verify.completionListContains("index");
|
||||
verify.not.completionListItemsCountIsGreaterThan(1);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for all dependencies in package.json
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "m/*import_as0*/
|
||||
//// import foo2 = require("m/*import_equals0*/
|
||||
//// var foo3 = require("m/*require0*/
|
||||
|
||||
// @Filename: package.json
|
||||
//// {
|
||||
//// "dependencies": { "module": "latest" },
|
||||
//// "devDependencies": { "dev-module": "latest" },
|
||||
//// "optionalDependencies": { "optional-module": "latest" },
|
||||
//// "peerDependencies": { "peer-module": "latest" }
|
||||
//// }
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
|
||||
verify.completionListContains("module");
|
||||
verify.completionListContains("dev-module");
|
||||
verify.completionListContains("optional-module");
|
||||
verify.completionListContains("peer-module");
|
||||
verify.not.completionListItemsCountIsGreaterThan(4);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should not give duplicate entries for similarly named files with different extensions
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "fake-module//*import_as0*/
|
||||
//// import foo2 = require("fake-module//*import_equals0*/
|
||||
//// var foo3 = require("fake-module//*require0*/
|
||||
|
||||
// @Filename: package.json
|
||||
//// { "dependencies": { "fake-module": "latest" }, "devDependencies": { "fake-module-dev": "latest" } }
|
||||
|
||||
// @Filename: node_modules/fake-module/repeated.ts
|
||||
//// /*repeatedts*/
|
||||
// @Filename: node_modules/fake-module/repeated.tsx
|
||||
//// /*repeatedtsx*/
|
||||
// @Filename: node_modules/fake-module/repeated.d.ts
|
||||
//// /*repeateddts*/
|
||||
// @Filename: node_modules/fake-module/other.js
|
||||
//// /*other*/
|
||||
// @Filename: node_modules/fake-module/other2.js
|
||||
//// /*other2*/
|
||||
|
||||
// @Filename: node_modules/unlisted-module/index.js
|
||||
//// /*unlisted-module*/
|
||||
|
||||
// @Filename: ambient.ts
|
||||
//// declare module "fake-module/other"
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListContains("repeated");
|
||||
verify.completionListContains("other");
|
||||
verify.not.completionListItemsCountIsGreaterThan(2);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for js files in node modules when allowJs is set to true
|
||||
|
||||
// @allowJs: true
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "fake-module//*import_as0*/
|
||||
//// import foo2 = require("fake-module//*import_equals0*/
|
||||
//// var foo3 = require("fake-module//*require0*/
|
||||
|
||||
// @Filename: package.json
|
||||
//// { "dependencies": { "fake-module": "latest" } }
|
||||
|
||||
// @Filename: node_modules/fake-module/ts.ts
|
||||
//// /*ts*/
|
||||
// @Filename: node_modules/fake-module/tsx.tsx
|
||||
//// /*tsx*/
|
||||
// @Filename: node_modules/fake-module/dts.d.ts
|
||||
//// /*dts*/
|
||||
// @Filename: node_modules/fake-module/js.js
|
||||
//// /*js*/
|
||||
// @Filename: node_modules/fake-module/jsx.jsx
|
||||
//// /*jsx*/
|
||||
// @Filename: node_modules/fake-module/repeated.js
|
||||
//// /*repeatedjs*/
|
||||
// @Filename: node_modules/fake-module/repeated.jsx
|
||||
//// /*repeatedjsx*/
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListContains("ts");
|
||||
verify.completionListContains("tsx");
|
||||
verify.completionListContains("dts");
|
||||
verify.not.completionListItemsCountIsGreaterThan(3);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for all node modules visible to the script
|
||||
|
||||
// @Filename: dir1/dir2/dir3/dir4/test0.ts
|
||||
//// import * as foo1 from "f/*import_as0*/
|
||||
//// import foo4 = require("f/*import_equals0*/
|
||||
//// var foo7 = require("f/*require0*/
|
||||
|
||||
// @Filename: package.json
|
||||
//// { "dependencies": { "fake-module": "latest" } }
|
||||
// @Filename: node_modules/fake-module/ts.ts
|
||||
//// /*module1*/
|
||||
|
||||
// @Filename: dir1/package.json
|
||||
//// { "dependencies": { "fake-module2": "latest" } }
|
||||
// @Filename: dir1/node_modules/fake-module2/index.ts
|
||||
//// /*module2*/
|
||||
|
||||
// @Filename: dir1/dir2/dir3/package.json
|
||||
//// { "dependencies": { "fake-module3": "latest" } }
|
||||
// @Filename: dir1/dir2/dir3/node_modules/fake-module3/ts.ts
|
||||
//// /*module3*/
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
|
||||
verify.completionListContains("fake-module");
|
||||
verify.completionListContains("fake-module2");
|
||||
verify.completionListContains("fake-module3");
|
||||
verify.not.completionListItemsCountIsGreaterThan(3);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for ambiently declared modules
|
||||
|
||||
// @Filename: test0.ts
|
||||
//// /// <reference path="./ambientModules.d.ts" />
|
||||
//// /// <reference path="./ambientModules2.d.ts" />
|
||||
//// import * as foo1 from "/*import_as0*/
|
||||
//// import * as foo2 from "a/*import_as1*/
|
||||
|
||||
//// import foo3 = require("/*import_equals0*/
|
||||
//// import foo4 = require("a/*import_equals1*/
|
||||
|
||||
//// var foo5 = require("/*require0*/
|
||||
//// var foo6 = require("a/*require1*/
|
||||
|
||||
// @Filename: ambientModules.d.ts
|
||||
//// declare module "ambientModule" {}
|
||||
//// declare module "otherAmbientModule" {} /*dummy0*/
|
||||
|
||||
// @Filename: ambientModules2.d.ts
|
||||
//// declare module "otherOtherAmbientModule" {} /*dummy1*/
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
|
||||
verify.completionListContains("ambientModule");
|
||||
verify.completionListContains("otherAmbientModule");
|
||||
verify.completionListContains("otherOtherAmbientModule");
|
||||
verify.not.completionListItemsCountIsGreaterThan(3);
|
||||
|
||||
goTo.marker(kind + "1");
|
||||
|
||||
verify.completionListContains("ambientModule");
|
||||
verify.not.completionListItemsCountIsGreaterThan(1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for files that are discovered via the baseUrl compiler option
|
||||
|
||||
// @baseUrl: tests/cases/fourslash/modules
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "mod/*import_as0*/
|
||||
//// import foo2 = require("mod/*import_equals0*/
|
||||
//// var foo3 = require("mod/*require0*/
|
||||
|
||||
// @Filename: modules/module.ts
|
||||
//// export var x = 5;
|
||||
|
||||
// @Filename: package.json
|
||||
//// { "dependencies": { "module-from-node": "latest" } }
|
||||
// @Filename: node_modules/module-from-node/index.ts
|
||||
//// /*module1*/
|
||||
|
||||
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
|
||||
verify.completionListContains("module");
|
||||
verify.completionListContains("module-from-node");
|
||||
verify.not.completionListItemsCountIsGreaterThan(2);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for modules referenced via baseUrl and paths compiler options with wildcards
|
||||
|
||||
// @Filename: tsconfig.json
|
||||
//// {
|
||||
//// "compilerOptions": {
|
||||
//// "baseUrl": "./modules",
|
||||
//// "paths": {
|
||||
//// "*": [
|
||||
//// "prefix/0*/suffix.ts",
|
||||
//// "prefix-only/*",
|
||||
//// "*/suffix-only.ts"
|
||||
//// ]
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "0/*import_as0*/
|
||||
//// import foo2 = require("0/*import_equals0*/
|
||||
//// var foo3 = require("0/*require0*/
|
||||
|
||||
//// import * as foo1 from "1/*import_as1*/
|
||||
//// import foo2 = require("1/*import_equals1*/
|
||||
//// var foo3 = require("1/*require1*/
|
||||
|
||||
//// import * as foo1 from "2/*import_as2*/
|
||||
//// import foo2 = require("2/*import_equals2*/
|
||||
//// var foo3 = require("2/*require2*/
|
||||
|
||||
|
||||
// @Filename: modules/prefix/00test/suffix.ts
|
||||
//// export var x = 5;
|
||||
|
||||
// @Filename: modules/prefix-only/1test.ts
|
||||
//// export var y = 5;
|
||||
|
||||
// @Filename: modules/2test/suffix-only.ts
|
||||
//// export var z = 5;
|
||||
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListContains("0test");
|
||||
|
||||
goTo.marker(kind + "1");
|
||||
verify.completionListContains("1test");
|
||||
|
||||
goTo.marker(kind + "2");
|
||||
verify.completionListContains("2test");
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for modules referenced via baseUrl and paths compiler options with explicit name mappings
|
||||
|
||||
// @Filename: tsconfig.json
|
||||
//// {
|
||||
//// "compilerOptions": {
|
||||
//// "baseUrl": "./modules",
|
||||
//// "paths": {
|
||||
//// "module1": ["some/path/whatever.ts"],
|
||||
//// "module2": ["some/other/path.ts"]
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "m/*import_as0*/
|
||||
//// import foo2 = require("m/*import_equals0*/
|
||||
//// var foo3 = require("m/*require0*/
|
||||
|
||||
// @Filename: some/path/whatever.ts
|
||||
//// export var x = 9;
|
||||
|
||||
// @Filename: some/other/path.ts
|
||||
//// export var y = 10;
|
||||
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListContains("module1");
|
||||
verify.completionListContains("module2");
|
||||
verify.not.completionListItemsCountIsGreaterThan(2);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for typings discovered via the typeRoots compiler option
|
||||
|
||||
// @typeRoots: my_typings,my_other_typings
|
||||
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// /// <reference types="m/*types_ref0*/" />
|
||||
//// import * as foo1 from "m/*import_as0*/
|
||||
//// import foo2 = require("m/*import_equals0*/
|
||||
//// var foo3 = require("m/*require0*/
|
||||
|
||||
// @Filename: my_typings/module-x/index.d.ts
|
||||
//// export var x = 9;
|
||||
|
||||
// @Filename: my_typings/module-x/whatever.d.ts
|
||||
//// export var w = 9;
|
||||
|
||||
// @Filename: my_typings/module-y/index.d.ts
|
||||
//// export var y = 9;
|
||||
|
||||
// @Filename: my_other_typings/module-z/index.d.ts
|
||||
//// export var z = 9;
|
||||
|
||||
|
||||
const kinds = ["types_ref", "import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListContains("module-x");
|
||||
verify.completionListContains("module-y");
|
||||
verify.completionListContains("module-z");
|
||||
verify.not.completionListItemsCountIsGreaterThan(3);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should respect the types compiler option when giving completions
|
||||
|
||||
// @typeRoots: my_typings,my_other_typings
|
||||
// @types: module-x,module-z
|
||||
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// /// <reference types="m/*types_ref0*/" />
|
||||
//// import * as foo1 from "m/*import_as0*/
|
||||
//// import foo2 = require("m/*import_equals0*/
|
||||
//// var foo3 = require("m/*require0*/
|
||||
|
||||
// @Filename: my_typings/module-x/index.d.ts
|
||||
//// export var x = 9;
|
||||
|
||||
// @Filename: my_typings/module-y/index.d.ts
|
||||
//// export var y = 9;
|
||||
|
||||
// @Filename: my_other_typings/module-z/index.d.ts
|
||||
//// export var z = 9;
|
||||
|
||||
|
||||
const kinds = ["types_ref", "import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListContains("module-x");
|
||||
verify.completionListContains("module-z");
|
||||
verify.not.completionListItemsCountIsGreaterThan(2);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for typings discovered in all visible @types directories
|
||||
|
||||
// @Filename: subdirectory/test0.ts
|
||||
//// /// <reference types="m/*types_ref0*/" />
|
||||
//// import * as foo1 from "m/*import_as0*/
|
||||
//// import foo2 = require("m/*import_equals0*/
|
||||
//// var foo3 = require("m/*require0*/
|
||||
|
||||
// @Filename: subdirectory/node_modules/@types/module-x/index.d.ts
|
||||
//// export var x = 9;
|
||||
// @Filename: subdirectory/package.json
|
||||
//// { "dependencies": { "@types/module-x": "latest" } }
|
||||
|
||||
// @Filename: node_modules/@types/module-y/index.d.ts
|
||||
//// export var y = 9;
|
||||
// @Filename: package.json
|
||||
//// { "dependencies": { "@types/module-y": "latest" } }
|
||||
|
||||
const kinds = ["types_ref", "import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListContains("module-x");
|
||||
verify.completionListContains("module-y");
|
||||
verify.not.completionListItemsCountIsGreaterThan(2);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for ts files when allowJs is false
|
||||
|
||||
// @Filename: test0.ts
|
||||
//// import * as foo1 from "./*import_as0*/
|
||||
//// import * as foo2 from ".//*import_as1*/
|
||||
//// import * as foo4 from "./folder//*import_as2*/
|
||||
|
||||
//// import foo6 = require("./*import_equals0*/
|
||||
//// import foo7 = require(".//*import_equals1*/
|
||||
//// import foo9 = require("./folder//*import_equals2*/
|
||||
|
||||
//// var foo11 = require("./*require0*/
|
||||
//// var foo12 = require(".//*require1*/
|
||||
//// var foo14 = require("./folder//*require2*/
|
||||
|
||||
// @Filename: parentTest/sub/test5.ts
|
||||
//// import * as foo16 from "../g/*import_as3*/
|
||||
//// import foo17 = require("../g/*import_equals3*/
|
||||
//// var foo18 = require("../g/*require3*/
|
||||
|
||||
|
||||
// @Filename: f1.ts
|
||||
//// /*f1*/
|
||||
// @Filename: f1.js
|
||||
//// /*f1j*/
|
||||
// @Filename: f1.d.ts
|
||||
//// /*f1d*/
|
||||
// @Filename: f2.tsx
|
||||
//// /f2*/
|
||||
// @Filename: f3.js
|
||||
//// /*f3*/
|
||||
// @Filename: f4.jsx
|
||||
//// /*f4*/
|
||||
// @Filename: e1.ts
|
||||
//// /*e1*/
|
||||
// @Filename: folder/f3.ts
|
||||
//// /*subf1*/
|
||||
// @Filename: folder/h1.ts
|
||||
//// /*subh1*/
|
||||
// @Filename: parentTest/f4.ts
|
||||
//// /*parentf1*/
|
||||
// @Filename: parentTest/g1.ts
|
||||
//// /*parentg1*/
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListIsEmpty();
|
||||
|
||||
goTo.marker(kind + "1");
|
||||
verify.completionListContains("f1");
|
||||
verify.completionListContains("f2");
|
||||
verify.completionListContains("e1");
|
||||
verify.completionListContains("folder");
|
||||
verify.completionListContains("parentTest");
|
||||
verify.not.completionListItemsCountIsGreaterThan(5);
|
||||
|
||||
goTo.marker(kind + "2");
|
||||
verify.completionListContains("f3");
|
||||
verify.completionListContains("h1");
|
||||
verify.not.completionListItemsCountIsGreaterThan(2);
|
||||
|
||||
goTo.marker(kind + "3");
|
||||
verify.completionListContains("f4");
|
||||
verify.completionListContains("g1");
|
||||
verify.completionListContains("sub");
|
||||
verify.not.completionListItemsCountIsGreaterThan(3);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for ts and js files when allowJs is true
|
||||
|
||||
// @allowJs: true
|
||||
|
||||
// @Filename: test0.ts
|
||||
//// import * as foo1 from ".//*import_as0*/
|
||||
//// import * as foo2 from "./f/*import_as1*/
|
||||
|
||||
//// import foo3 = require(".//*import_equals0*/
|
||||
//// import foo4 = require("./f/*import_equals1*/
|
||||
|
||||
//// var foo5 = require(".//*require0*/
|
||||
//// var foo6 = require("./f/*require1*/
|
||||
|
||||
// @Filename: f1.ts
|
||||
//// /f1*/
|
||||
// @Filename: f1.js
|
||||
//// /*f1j*/
|
||||
// @Filename: f1.d.ts
|
||||
//// /*f1d*/
|
||||
// @Filename: f2.tsx
|
||||
//// /*f2*/
|
||||
// @Filename: f3.js
|
||||
//// /*f3*/
|
||||
// @Filename: f4.jsx
|
||||
//// /*f4*/
|
||||
// @Filename: e1.ts
|
||||
//// /*e1*/
|
||||
// @Filename: e2.js
|
||||
//// /*e2*/
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListContains("f1");
|
||||
verify.completionListContains("f2");
|
||||
verify.completionListContains("f3");
|
||||
verify.completionListContains("f4");
|
||||
verify.completionListContains("e1");
|
||||
verify.completionListContains("e2");
|
||||
verify.not.completionListItemsCountIsGreaterThan(6);
|
||||
|
||||
goTo.marker(kind + "1");
|
||||
verify.completionListContains("f1");
|
||||
verify.completionListContains("f2");
|
||||
verify.completionListContains("f3");
|
||||
verify.completionListContains("f4");
|
||||
verify.completionListContains("e1");
|
||||
verify.completionListContains("e2");
|
||||
verify.not.completionListItemsCountIsGreaterThan(6);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for absolute paths
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "/tests/cases/f/*import_as0*/
|
||||
//// import * as foo2 from "/tests/cases/fourslash/*import_as1*/
|
||||
//// import * as foo3 from "/tests/cases/fourslash//*import_as2*/
|
||||
|
||||
//// import foo4 = require("/tests/cases/f/*import_equals0*/
|
||||
//// import foo5 = require("/tests/cases/fourslash/*import_equals1*/
|
||||
//// import foo6 = require("/tests/cases/fourslash//*import_equals2*/
|
||||
|
||||
//// var foo7 = require("/tests/cases/f/*require0*/
|
||||
//// var foo8 = require("/tests/cases/fourslash/*require1*/
|
||||
//// var foo9 = require("/tests/cases/fourslash//*require2*/
|
||||
|
||||
// @Filename: f1.ts
|
||||
//// /*f1*/
|
||||
// @Filename: f2.tsx
|
||||
//// /*f2*/
|
||||
// @Filename: folder/f1.ts
|
||||
//// /*subf1*/
|
||||
// @Filename: f3.js
|
||||
//// /*f3*/
|
||||
// @Filename: f4.jsx
|
||||
//// /*f4*/
|
||||
// @Filename: e1.ts
|
||||
//// /*e1*/
|
||||
// @Filename: e2.js
|
||||
//// /*e2*/
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
verify.completionListContains("fourslash");
|
||||
verify.not.completionListItemsCountIsGreaterThan(1);
|
||||
|
||||
goTo.marker(kind + "1");
|
||||
verify.completionListContains("fourslash");
|
||||
verify.not.completionListItemsCountIsGreaterThan(1);
|
||||
|
||||
goTo.marker(kind + "2");
|
||||
verify.completionListContains("f1");
|
||||
verify.completionListContains("f2");
|
||||
verify.completionListContains("e1");
|
||||
verify.completionListContains("folder");
|
||||
verify.completionListContains("tests");
|
||||
verify.not.completionListItemsCountIsGreaterThan(5);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for directories that are merged via the rootDirs compiler option
|
||||
|
||||
// @rootDirs: tests/cases/fourslash/sub/src1,tests/cases/fourslash/src2
|
||||
|
||||
// @Filename: src2/test0.ts
|
||||
//// import * as foo1 from "./mo/*import_as0*/
|
||||
//// import foo2 = require("./mo/*import_equals0*/
|
||||
//// var foo3 = require("./mo/*require0*/
|
||||
|
||||
// @Filename: src2/module0.ts
|
||||
//// export var w = 0;
|
||||
|
||||
// @Filename: sub/src1/module1.ts
|
||||
//// export var x = 0;
|
||||
|
||||
// @Filename: sub/src1/module2.ts
|
||||
//// export var y = 0;
|
||||
|
||||
// @Filename: sub/src1/more/module3.ts
|
||||
//// export var z = 0;
|
||||
|
||||
|
||||
// @Filename: f1.ts
|
||||
//// /*f1*/
|
||||
// @Filename: f2.tsx
|
||||
//// /*f2*/
|
||||
// @Filename: folder/f1.ts
|
||||
//// /*subf1*/
|
||||
// @Filename: f3.js
|
||||
//// /*f3*/
|
||||
// @Filename: f4.jsx
|
||||
//// /*f4*/
|
||||
// @Filename: e1.ts
|
||||
//// /*e1*/
|
||||
// @Filename: e2.js
|
||||
//// /*e2*/
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
|
||||
verify.completionListContains("module0");
|
||||
verify.completionListContains("module1");
|
||||
verify.completionListContains("module2");
|
||||
verify.completionListContains("more");
|
||||
|
||||
// Should not contain itself
|
||||
verify.not.completionListItemsCountIsGreaterThan(4);
|
||||
}
|
||||
51
tests/cases/fourslash/completionForTripleSlashReference1.ts
Normal file
51
tests/cases/fourslash/completionForTripleSlashReference1.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for relative references to ts files when allowJs is false
|
||||
|
||||
// @Filename: test0.ts
|
||||
//// /// <reference path="/*0*/
|
||||
//// /// <reference path="./*1*/
|
||||
//// /// <reference path="../*2*/
|
||||
//// /// <reference path=".//*3*/
|
||||
//// /// <reference path="./f/*4*/" />
|
||||
//// /// <reference path="./parentTest//*5*/
|
||||
|
||||
// @Filename: parentTest/sub/test1.ts
|
||||
//// /// <reference path="../g/*6*/
|
||||
|
||||
// @Filename: f1.ts
|
||||
//// /*f1*/
|
||||
// @Filename: f1.js
|
||||
//// /*f1j*/
|
||||
// @Filename: f1.d.ts
|
||||
//// /*f1d*/
|
||||
// @Filename: f2.tsx
|
||||
//// /f2*/
|
||||
// @Filename: f3.js
|
||||
//// /*f3*/
|
||||
// @Filename: f4.jsx
|
||||
//// /*f4*/
|
||||
// @Filename: e1.ts
|
||||
//// /*e1*/
|
||||
// @Filename: parentTest/g1.ts
|
||||
//// /*parentg1*/
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
goTo.marker("" + i);
|
||||
verify.completionListContains("f1.ts");
|
||||
verify.completionListContains("f1.d.ts");
|
||||
verify.completionListContains("f2.tsx");
|
||||
verify.completionListContains("e1.ts");
|
||||
verify.completionListContains("parentTest");
|
||||
verify.not.completionListItemsCountIsGreaterThan(5);
|
||||
}
|
||||
|
||||
goTo.marker("5");
|
||||
verify.completionListContains("g1.ts");
|
||||
verify.completionListContains("sub");
|
||||
verify.not.completionListItemsCountIsGreaterThan(2);
|
||||
|
||||
goTo.marker("6");
|
||||
verify.completionListContains("g1.ts");
|
||||
verify.completionListContains("sub");
|
||||
verify.not.completionListItemsCountIsGreaterThan(2);
|
||||
33
tests/cases/fourslash/completionForTripleSlashReference2.ts
Normal file
33
tests/cases/fourslash/completionForTripleSlashReference2.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for relative references to js and ts files when allowJs is true
|
||||
|
||||
// @allowJs: true
|
||||
|
||||
// @Filename: test0.ts
|
||||
//// /// <reference path="/*0*/
|
||||
//// /// <reference path="./*1*/
|
||||
//// /// <reference path="../*2*/
|
||||
//// /// <reference path=".//*3*/
|
||||
//// /// <reference path="./f/*4*/" />
|
||||
|
||||
// @Filename: f1.ts
|
||||
//// /*f1*/
|
||||
// @Filename: f1.js
|
||||
//// /*f1j*/
|
||||
// @Filename: f1.d.ts
|
||||
//// /*f1d*/
|
||||
// @Filename: f2.tsx
|
||||
//// /f2*/
|
||||
// @Filename: f4.jsx
|
||||
//// /*f4*/
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
goTo.marker("" + i);
|
||||
verify.completionListContains("f1.ts");
|
||||
verify.completionListContains("f1.js");
|
||||
verify.completionListContains("f1.d.ts");
|
||||
verify.completionListContains("f2.tsx");
|
||||
verify.completionListContains("f4.jsx");
|
||||
verify.not.completionListItemsCountIsGreaterThan(5);
|
||||
}
|
||||
43
tests/cases/fourslash/completionForTripleSlashReference3.ts
Normal file
43
tests/cases/fourslash/completionForTripleSlashReference3.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for absolute paths
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// /// <reference path="/tests/cases/f/*0*/
|
||||
|
||||
// @Filename: tests/test1.ts
|
||||
//// /// <reference path="/tests/cases/fourslash/*1*/
|
||||
|
||||
// @Filename: tests/test2.ts
|
||||
//// /// <reference path="/tests/cases/fourslash//*2*/
|
||||
|
||||
// @Filename: f1.ts
|
||||
//// /*f1*/
|
||||
// @Filename: f2.tsx
|
||||
//// /*f2*/
|
||||
// @Filename: folder/f1.ts
|
||||
//// /*subf1*/
|
||||
// @Filename: f3.js
|
||||
//// /*f3*/
|
||||
// @Filename: f4.jsx
|
||||
//// /*f4*/
|
||||
// @Filename: e1.ts
|
||||
//// /*e1*/
|
||||
// @Filename: e2.js
|
||||
//// /*e2*/
|
||||
|
||||
goTo.marker("0");
|
||||
verify.completionListContains("fourslash");
|
||||
verify.not.completionListItemsCountIsGreaterThan(1);
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("fourslash");
|
||||
verify.not.completionListItemsCountIsGreaterThan(1);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("f1.ts");
|
||||
verify.completionListContains("f2.tsx");
|
||||
verify.completionListContains("e1.ts");
|
||||
verify.completionListContains("folder");
|
||||
verify.completionListContains("tests");
|
||||
verify.not.completionListItemsCountIsGreaterThan(5);
|
||||
43
tests/cases/fourslash/completionForTripleSlashReference4.ts
Normal file
43
tests/cases/fourslash/completionForTripleSlashReference4.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should NOT give completions for directories that are merged via the rootDirs compiler option
|
||||
|
||||
// @rootDirs: sub/src1,src2
|
||||
|
||||
// @Filename: src2/test0.ts
|
||||
//// /// <reference path="./mo/*0*/
|
||||
|
||||
// @Filename: src2/module0.ts
|
||||
//// export var w = 0;
|
||||
|
||||
// @Filename: sub/src1/module1.ts
|
||||
//// export var x = 0;
|
||||
|
||||
// @Filename: sub/src1/module2.ts
|
||||
//// export var y = 0;
|
||||
|
||||
// @Filename: sub/src1/more/module3.ts
|
||||
//// export var z = 0;
|
||||
|
||||
|
||||
// @Filename: f1.ts
|
||||
//// /*f1*/
|
||||
// @Filename: f2.tsx
|
||||
//// /*f2*/
|
||||
// @Filename: folder/f1.ts
|
||||
//// /*subf1*/
|
||||
// @Filename: f3.js
|
||||
//// /*f3*/
|
||||
// @Filename: f4.jsx
|
||||
//// /*f4*/
|
||||
// @Filename: e1.ts
|
||||
//// /*e1*/
|
||||
// @Filename: e2.js
|
||||
//// /*e2*/
|
||||
|
||||
|
||||
goTo.marker("0");
|
||||
|
||||
verify.completionListContains("module0.ts");
|
||||
|
||||
verify.not.completionListItemsCountIsGreaterThan(1);
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
////var a;
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.eof();
|
||||
verify.completionListContains("a");
|
||||
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
////var f = new Foo();
|
||||
////f/*c3*/;
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker("c1");
|
||||
edit.insert(".");
|
||||
verify.memberListContains("x");
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
////Foo./**/;
|
||||
/////*1*/var bar;
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker();
|
||||
verify.memberListContains("fun");
|
||||
verify.not.errorExistsAfterMarker("1");
|
||||
@@ -4,9 +4,6 @@
|
||||
////var baz = Foo/**/;
|
||||
/////*1*/baz.concat("y");
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker();
|
||||
edit.insert(".b");
|
||||
verify.not.errorExistsAfterMarker("1");
|
||||
|
||||
@@ -194,9 +194,6 @@
|
||||
//// }
|
||||
////};
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs("(property) C1T5.foo: (i: number, s: string) => number");
|
||||
goTo.marker('2');
|
||||
|
||||
@@ -7,6 +7,4 @@
|
||||
// @Filename: a.ts
|
||||
//// /*2*/export class Foo {}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
////var enumMember = e./*1*/thirdMember;
|
||||
|
||||
goTo.marker("1");
|
||||
verify.verifyDefinitionsName("thirdMember", "e");
|
||||
verify.goToDefinitionName("thirdMember", "e");
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
////var b: B<number>;
|
||||
////var /**/x = b.foo2().foo(5).foo(); // 'x' is of type 'void'
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('var x: void');
|
||||
verify.numberOfErrorsInCurrentFile(0);
|
||||
|
||||
46
tests/cases/fourslash/findAllReferencesOfConstructor.ts
Normal file
46
tests/cases/fourslash/findAllReferencesOfConstructor.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: a.ts
|
||||
////export class C {
|
||||
//// [|constructor|](n: number);
|
||||
//// [|constructor|]();
|
||||
//// [|constructor|](n?: number){}
|
||||
//// static f() {
|
||||
//// this.f();
|
||||
//// new [|this|]();
|
||||
//// }
|
||||
////}
|
||||
////new [|C|]();
|
||||
// Does not handle alias.
|
||||
////const D = C;
|
||||
////new D();
|
||||
|
||||
// @Filename: b.ts
|
||||
////import { C } from "./a";
|
||||
////new [|C|]();
|
||||
|
||||
// @Filename: c.ts
|
||||
////import { C } from "./a";
|
||||
////class D extends C {
|
||||
//// constructor() {
|
||||
//// [|super|]();
|
||||
//// super.method();
|
||||
//// }
|
||||
//// method() { super(); }
|
||||
////}
|
||||
// Does not find 'super()' calls for a class that merely implements 'C',
|
||||
// since those must be calling a different constructor.
|
||||
////class E implements C {
|
||||
//// constructor() { super(); }
|
||||
////}
|
||||
|
||||
// Works with qualified names too
|
||||
// @Filename: d.ts
|
||||
////import * as a from "./a";
|
||||
////new a.[|C|]();
|
||||
////class d extends a.C { constructor() { [|super|](); }
|
||||
|
||||
const ranges = test.ranges();
|
||||
for (const ctr of ranges.slice(0, 3)) {
|
||||
verify.referencesOf(ctr, ranges);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////class C {
|
||||
//// [|constructor|](n: number);
|
||||
//// [|constructor|](){}
|
||||
////}
|
||||
|
||||
verify.rangesReferenceEachOther();
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class Gre/*1*/eter {
|
||||
//// someFunction() { th/*2*/is; }
|
||||
//// }
|
||||
////
|
||||
//// type Options = "opt/*3*/ion 1" | "option 2";
|
||||
//// let myOption: Options = "option 1";
|
||||
////
|
||||
//// some/*4*/Label:
|
||||
//// break someLabel;
|
||||
|
||||
goTo.marker("1");
|
||||
verify.findReferencesDefinitionDisplayPartsAtCaretAre([{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }, { text: "Greeter", kind: "className" }]);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.findReferencesDefinitionDisplayPartsAtCaretAre([{ text: "this", kind: "keyword" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "this", kind: "keyword" }]);
|
||||
|
||||
goTo.marker("3");
|
||||
verify.findReferencesDefinitionDisplayPartsAtCaretAre([{ text: "\"option 1\"", kind: "stringLiteral" }]);
|
||||
|
||||
goTo.marker("4");
|
||||
verify.findReferencesDefinitionDisplayPartsAtCaretAre([{ text: "someLabel", kind: "text" }]);
|
||||
@@ -12,6 +12,7 @@
|
||||
////}
|
||||
/////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) {
|
||||
////}
|
||||
/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1};
|
||||
|
||||
runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];");
|
||||
runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);");
|
||||
@@ -23,6 +24,7 @@ runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];
|
||||
runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`");
|
||||
runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {");
|
||||
runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {");
|
||||
runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 };", "{var t = 1};");
|
||||
|
||||
|
||||
function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) {
|
||||
|
||||
@@ -99,6 +99,7 @@ declare namespace FourSlashInterface {
|
||||
}
|
||||
class test_ {
|
||||
markers(): Marker[];
|
||||
markerNames(): string[];
|
||||
marker(name?: string): Marker;
|
||||
ranges(): Range[];
|
||||
rangesByText(): { [text: string]: Range[] };
|
||||
@@ -108,7 +109,6 @@ declare namespace FourSlashInterface {
|
||||
marker(name?: string): void;
|
||||
bof(): void;
|
||||
eof(): void;
|
||||
definition(definitionIndex?: number): void;
|
||||
type(definitionIndex?: number): void;
|
||||
position(position: number, fileIndex?: number): any;
|
||||
position(position: number, fileName?: string): any;
|
||||
@@ -121,7 +121,7 @@ declare namespace FourSlashInterface {
|
||||
constructor(negative?: boolean);
|
||||
memberListContains(symbol: string, text?: string, documenation?: string, kind?: string): void;
|
||||
memberListCount(expectedCount: number): void;
|
||||
completionListContains(symbol: string, text?: string, documentation?: string, kind?: string): void;
|
||||
completionListContains(symbol: string, text?: string, documentation?: string, kind?: string, spanIndex?: number): void;
|
||||
completionListItemsCountIsGreaterThan(count: number): void;
|
||||
completionListIsEmpty(): void;
|
||||
completionListAllowsNewIdentifier(): void;
|
||||
@@ -132,10 +132,7 @@ declare namespace FourSlashInterface {
|
||||
errorExistsBeforeMarker(markerName?: string): void;
|
||||
quickInfoIs(expectedText?: string, expectedDocumentation?: string): void;
|
||||
quickInfoExists(): void;
|
||||
definitionCountIs(expectedCount: number): void;
|
||||
typeDefinitionCountIs(expectedCount: number): void;
|
||||
definitionLocationExists(): void;
|
||||
verifyDefinitionsName(name: string, containerName: string): void;
|
||||
isValidBraceCompletionAtPosition(openingBrace?: string): void;
|
||||
}
|
||||
class verify extends verifyNegatable {
|
||||
@@ -152,6 +149,21 @@ declare namespace FourSlashInterface {
|
||||
eval(expr: string, value: any): void;
|
||||
currentLineContentIs(text: string): void;
|
||||
currentFileContentIs(text: string): void;
|
||||
/** Verifies that goToDefinition at the current position would take you to `endMarker`. */
|
||||
goToDefinitionIs(endMarkers: string | string[]): void;
|
||||
goToDefinitionName(name: string, containerName: string): void;
|
||||
/**
|
||||
* `verify.goToDefinition("a", "b");` verifies that go-to-definition at marker "a" takes you to marker "b".
|
||||
* `verify.goToDefinition(["a", "aa"], "b");` verifies that markers "a" and "aa" have the same definition "b".
|
||||
* `verify.goToDefinition("a", ["b", "bb"]);` verifies that "a" has multiple definitions available.
|
||||
*/
|
||||
goToDefinition(startMarkerNames: string | string[], endMarkerNames: string | string[]): void;
|
||||
/** Performs `goToDefinition` for each pair. */
|
||||
goToDefinition(startsAndEnds: [string | string[], string | string[]][]): void;
|
||||
/** Performs `goToDefinition` on each key and value. */
|
||||
goToDefinition(startsAndEnds: { [startMarkerName: string]: string | string[] }): void;
|
||||
/** Verifies goToDefinition for each `${markerName}Reference` -> `${markerName}Definition` */
|
||||
goToDefinitionForMarkers(...markerNames: string[]): void;
|
||||
verifyGetEmitOutputForCurrentFile(expected: string): void;
|
||||
verifyGetEmitOutputContentsForCurrentFile(expected: ts.OutputFile[]): void;
|
||||
referencesCountIs(count: number): void;
|
||||
@@ -172,6 +184,7 @@ declare namespace FourSlashInterface {
|
||||
* If `ranges` is omitted, this is `test.ranges()`.
|
||||
*/
|
||||
rangesReferenceEachOther(ranges?: Range[]): void;
|
||||
findReferencesDefinitionDisplayPartsAtCaretAre(expected: ts.SymbolDisplayPart[]): void;
|
||||
rangesWithSameTextReferenceEachOther(): void;
|
||||
currentParameterHelpArgumentNameIs(name: string): void;
|
||||
currentParameterSpanIs(parameter: string): void;
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('var M.C.C: typeof M.C');
|
||||
verify.numberOfErrorsInCurrentFile(0);
|
||||
@@ -50,9 +50,6 @@
|
||||
|
||||
////var /*23*/r8a = _.map</*error1*/B/*error2*/, string>(c5, (/*8*/x) => { return x.foo() });
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs('(parameter) x: number');
|
||||
goTo.marker('2');
|
||||
|
||||
@@ -56,9 +56,6 @@
|
||||
////
|
||||
////var /*23*/r8a = _.map<number, /*error1*/B/*error2*/, string>(c5, (/*8a*/x,/*8b*/y) => { return y.foo() });
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker('2a');
|
||||
verify.quickInfoIs('(parameter) x: Collection<number, number>');
|
||||
goTo.marker('2b');
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// @module: CommonJS
|
||||
// @declaration: true
|
||||
// @out: declSingleFile.js
|
||||
// @outDir: tests/cases/fourslash/
|
||||
// @outDir: /tests/cases/fourslash/
|
||||
|
||||
// @Filename: inputFile1.ts
|
||||
//// var x: number = 5;
|
||||
|
||||
19
tests/cases/fourslash/goToDeclarationDecoratorOverloads.ts
Normal file
19
tests/cases/fourslash/goToDeclarationDecoratorOverloads.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
// @Target: ES6
|
||||
// @experimentaldecorators: true
|
||||
|
||||
////async function f() {}
|
||||
////
|
||||
/////*defDecString*/function dec(target: any, propertyKey: string): void;
|
||||
/////*defDecSymbol*/function dec(target: any, propertyKey: symbol): void;
|
||||
////function dec(target: any, propertyKey: string | symbol) {}
|
||||
////
|
||||
////declare const s: symbol;
|
||||
////class C {
|
||||
//// @/*useDecString*/dec f() {}
|
||||
//// @/*useDecSymbol*/dec [s]() {}
|
||||
////}
|
||||
|
||||
verify.goToDefinition({
|
||||
useDecString: "defDecString",
|
||||
useDecSymbol: "defDecSymbol"
|
||||
});
|
||||
@@ -1,17 +1,14 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//@Filename: a.ts
|
||||
////var x: number;
|
||||
////var /*def1*/x: number;
|
||||
|
||||
//@Filename: b.ts
|
||||
////var x: number;
|
||||
////var /*def2*/x: number;
|
||||
|
||||
//@Filename: c.ts
|
||||
/////// <reference path="a.ts" />
|
||||
/////// <reference path="b.ts" />
|
||||
/////**/x++;
|
||||
/////*use*/x++;
|
||||
|
||||
goTo.file("c.ts");
|
||||
goTo.marker();
|
||||
|
||||
verify.definitionCountIs(2);
|
||||
verify.goToDefinition("use", ["def1", "def2"]);
|
||||
|
||||
@@ -23,20 +23,7 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
|
||||
goTo.marker('alias1Type');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('alias1Definition');
|
||||
|
||||
goTo.marker('alias2Type');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('alias2Definition');
|
||||
|
||||
|
||||
goTo.marker('alias1Value');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('alias1Definition');
|
||||
|
||||
goTo.marker('alias2Value');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('alias2Definition');
|
||||
verify.goToDefinition([
|
||||
[["alias1Type", "alias1Value"], "alias1Definition"],
|
||||
[["alias2Type", "alias2Value"], "alias2Definition"]
|
||||
]);
|
||||
|
||||
@@ -14,16 +14,4 @@
|
||||
////ambientClass./*staticMethodReference*/method();
|
||||
////ambientClassVariable./*instanceMethodReference*/method();
|
||||
|
||||
var markerList = [
|
||||
"ambientVariable",
|
||||
"ambientFunction",
|
||||
"constructor",
|
||||
"staticMethod",
|
||||
"instanceMethod",
|
||||
];
|
||||
|
||||
markerList.forEach((marker) => {
|
||||
goTo.marker(marker + 'Reference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(marker + 'Definition');
|
||||
});
|
||||
verify.goToDefinitionForMarkers("ambientVariable", "ambientFunction", "constructor", "staticMethod", "instanceMethod");
|
||||
|
||||
@@ -8,10 +8,4 @@
|
||||
////o./*reference1*/myObjectMethod();
|
||||
////o["/*reference2*/myObjectMethod"]();
|
||||
|
||||
goTo.marker("reference1");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("definition");
|
||||
|
||||
goTo.marker("reference2");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("definition");
|
||||
verify.goToDefinition(["reference1", "reference2"], "definition");
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
////var b: /*boolean*/boolean;
|
||||
////var v: /*void*/void;
|
||||
|
||||
test.markers().forEach((m, i, a) => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.not.definitionLocationExists();
|
||||
});
|
||||
for (const marker of test.markerNames()) {
|
||||
verify.goToDefinition(marker, []);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
////var t = /*true*/true;
|
||||
////var f = /*false*/false;
|
||||
|
||||
test.markers().forEach((m, i, a) => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.not.definitionLocationExists();
|
||||
});
|
||||
for (const marker of test.markerNames()) {
|
||||
verify.goToDefinition(marker, []);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,4 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
goTo.marker("usage");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("definition");
|
||||
verify.goToDefinition("usage", "definition");
|
||||
|
||||
@@ -11,6 +11,4 @@
|
||||
////
|
||||
////var x = new /*usage*/Foo();
|
||||
|
||||
goTo.marker("usage");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("definition");
|
||||
verify.goToDefinition("usage", "definition");
|
||||
|
||||
@@ -9,14 +9,8 @@
|
||||
////var constructorOverload = new /*constructorOverloadReference1*/ConstructorOverload();
|
||||
////var constructorOverload = new /*constructorOverloadReference2*/ConstructorOverload("foo");
|
||||
|
||||
goTo.marker('constructorOverloadReference1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('constructorDefinition');
|
||||
|
||||
goTo.marker('constructorOverloadReference2');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('constructorDefinition');
|
||||
|
||||
goTo.marker('constructorOverload1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('constructorDefinition');
|
||||
verify.goToDefinition({
|
||||
constructorOverloadReference1: "constructorOverload1",
|
||||
constructorOverloadReference2: "constructorOverload2",
|
||||
constructorOverload1: "constructorDefinition"
|
||||
});
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
//// return target => target;
|
||||
////}
|
||||
|
||||
|
||||
goTo.marker('decoratorUse');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('decoratorDefinition');
|
||||
|
||||
goTo.marker('decoratorFactoryUse');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('decoratorFactoryDefinition');
|
||||
verify.goToDefinition({
|
||||
decoratorUse: "decoratorDefinition",
|
||||
decoratorFactoryUse: "decoratorFactoryDefinition"
|
||||
});
|
||||
|
||||
@@ -14,16 +14,4 @@
|
||||
////class fooCls implements /*remoteInterfaceReference*/remoteInterface { }
|
||||
////var fooVar = /*remoteModuleReference*/remoteModule.foo;
|
||||
|
||||
var markerList = [
|
||||
"remoteVariable",
|
||||
"remoteFunction",
|
||||
"remoteClass",
|
||||
"remoteInterface",
|
||||
"remoteModule",
|
||||
];
|
||||
|
||||
markerList.forEach((marker) => {
|
||||
goTo.marker(marker + 'Reference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(marker + 'Definition');
|
||||
});
|
||||
verify.goToDefinitionForMarkers("remoteVariable", "remoteFunction", "remoteClass", "remoteInterface", "remoteModule");
|
||||
|
||||
@@ -21,16 +21,4 @@
|
||||
////class rem2fooCls implements /*remoteInterfaceReference*/rem2Int { }
|
||||
////var rem2fooVar = /*remoteModuleReference*/rem2Mod.foo;
|
||||
|
||||
var markerList = [
|
||||
"remoteVariable",
|
||||
"remoteFunction",
|
||||
"remoteClass",
|
||||
"remoteInterface",
|
||||
"remoteModule",
|
||||
];
|
||||
|
||||
markerList.forEach((marker) => {
|
||||
goTo.marker(marker + 'Reference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(marker + 'Definition');
|
||||
});
|
||||
verify.goToDefinitionForMarkers("remoteVariable", "remoteFunction", "remoteClass", "remoteInterface", "remoteModule")
|
||||
|
||||
@@ -7,6 +7,4 @@
|
||||
// @Filename: a.ts
|
||||
//// /*2*/export class Foo {}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@@ -8,6 +8,4 @@
|
||||
/////*2*/class Foo {}
|
||||
////export var x = 0;
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@@ -9,6 +9,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@@ -3,5 +3,4 @@
|
||||
// @Filename: b.ts
|
||||
////import n = require('unknown/*1*/');
|
||||
|
||||
goTo.marker('1');
|
||||
verify.not.definitionLocationExists();
|
||||
verify.goToDefinition("1", []);
|
||||
|
||||
@@ -5,6 +5,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@@ -8,6 +8,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@@ -8,6 +8,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@@ -8,6 +8,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@@ -8,6 +8,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
/////*functionOverload1*/function /*functionOverload*/functionOverload();
|
||||
/////*functionOverload1*/function /*functionOverload*/functionOverload(value: number);
|
||||
/////*functionOverload2*/function functionOverload(value: string);
|
||||
/////*functionOverloadDefinition*/function functionOverload() {}
|
||||
////
|
||||
/////*functionOverloadReference1*/functionOverload();
|
||||
/////*functionOverloadReference1*/functionOverload(123);
|
||||
/////*functionOverloadReference2*/functionOverload("123");
|
||||
/////*brokenOverload*/functionOverload({});
|
||||
|
||||
goTo.marker('functionOverloadReference1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('functionOverloadDefinition');
|
||||
|
||||
goTo.marker('functionOverloadReference2');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('functionOverloadDefinition');
|
||||
|
||||
goTo.marker('functionOverload');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('functionOverloadDefinition');
|
||||
verify.goToDefinition({
|
||||
functionOverloadReference1: "functionOverload1",
|
||||
functionOverloadReference2: "functionOverload2",
|
||||
brokenOverload: "functionOverload1",
|
||||
functionOverload: "functionOverloadDefinition"
|
||||
});
|
||||
|
||||
@@ -11,13 +11,7 @@
|
||||
//// constructor() { }
|
||||
////}
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker('staticFunctionOverload');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('staticFunctionOverloadDefinition');
|
||||
|
||||
goTo.marker('functionOverload');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('functionOverloadDefinition');
|
||||
verify.goToDefinition({
|
||||
staticFunctionOverload: "staticFunctionOverloadDefinition",
|
||||
functionOverload: "functionOverloadDefinition"
|
||||
});
|
||||
|
||||
@@ -4,6 +4,4 @@
|
||||
////}
|
||||
////var implicitConstructor = new /*constructorReference*/ImplicitConstructor();
|
||||
|
||||
goTo.marker('constructorReference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('constructorDefinition');
|
||||
verify.goToDefinitionForMarkers("constructor");
|
||||
|
||||
@@ -14,8 +14,5 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition("classAliasDefinition", "classDefinition");
|
||||
|
||||
@@ -14,8 +14,4 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition("classAliasDefinition", "classDefinition");
|
||||
|
||||
@@ -27,12 +27,4 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("e.ts");
|
||||
|
||||
goTo.marker('classReference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition(["classReference", "classAliasDefinition"], "classDefinition");
|
||||
|
||||
@@ -14,8 +14,4 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition("classAliasDefinition", "classDefinition");
|
||||
|
||||
@@ -14,8 +14,4 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition("classAliasDefinition", "classDefinition");
|
||||
|
||||
@@ -14,8 +14,4 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('moduleAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('moduleDefinition');
|
||||
verify.goToDefinition("moduleAliasDefinition", "moduleDefinition");
|
||||
|
||||
@@ -10,8 +10,4 @@
|
||||
////}
|
||||
////export default Class;
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition("classAliasDefinition", "classDefinition");
|
||||
|
||||
@@ -19,35 +19,9 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
|
||||
goTo.marker("interfaceReference");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("interfaceDefinition");
|
||||
|
||||
goTo.marker("interfaceReferenceInList");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("interfaceDefinition");
|
||||
|
||||
goTo.marker("interfaceReferenceInConstructor");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("interfaceDefinition");
|
||||
|
||||
goTo.marker("classReference");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("classDefinition");
|
||||
|
||||
goTo.marker("classReferenceInInitializer");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("classDefinition");
|
||||
|
||||
goTo.marker("enumReference");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("enumDefinition");
|
||||
|
||||
goTo.marker("enumReferenceInInitializer");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("enumDefinition");
|
||||
|
||||
goTo.marker("selfReference");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("selfDefinition");
|
||||
verify.goToDefinition([
|
||||
[["interfaceReference", "interfaceReferenceInList", "interfaceReferenceInConstructor"], "interfaceDefinition"],
|
||||
[["classReference", "classReferenceInInitializer"], "classDefinition"],
|
||||
[["enumReference", "enumReferenceInInitializer"], "enumDefinition"],
|
||||
["selfReference", "selfDefinition"]
|
||||
]);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user