_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/completionsInExport_moduleBlock.ts_0_1070 | /// <reference path="fourslash.ts" />
////const outOfScope = 0;
////
////declare module 'mod' {
//// const a: string;
//// type T = number;
//// export { /**/ };
////}
const type = { name: "type", sortText: completion.SortText.GlobalsOrKeywords };
verify.completions({
marker: "",
exact: ["a", "T", type]
});
// Deprioritize 'a' since it has been exported already.
// (Keep it in the list because you can still do 'a as b'.)
edit.insert("a, ");
verify.completions({
exact: ["T", { name: "a", sortText: completion.SortText.OptionalMember }, type]
});
// No completions for new name
edit.insert("T as ");
verify.completions({
exact: []
});
// 'T' still hasn't been exported by name
edit.insert("U, ");
verify.completions({
exact: ["T", { name: "a", sortText: completion.SortText.OptionalMember }, type]
});
// 'a' and 'T' are back to the same priority
edit.insert("T, ");
verify.completions({
exact: [
{ name: "a", sortText: completion.SortText.OptionalMember },
{ name: "T", sortText: completion.SortText.OptionalMember },
type,
]
});
| {
"end_byte": 1070,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsInExport_moduleBlock.ts"
} |
TypeScript/tests/cases/fourslash/codeFixOverrideModifier8.ts_0_284 | /// <reference path='fourslash.ts' />
// @noImplicitOverride: true
//// function ff () {
//// return class {
//// [|override foo () {}|]
//// }
//// }
verify.codeFix({
description: "Remove 'override' modifier",
newRangeContent: "foo () {}",
index: 0
})
| {
"end_byte": 284,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier8.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInPropertyAccess_js.ts_0_639 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @Filename: /a.js
//// /**
//// * @typedef Foo
//// * @property foo
//// */
//// /**
//// * @param {Foo.foo} inst
//// */
//// function blah(inst) {
//// return false;
//// }
verify.codeFix({
index: 0,
description: ignoreInterpolations(ts.Diagnostics.Rewrite_as_the_indexed_access_type_0),
newFileContent:
`/**
* @typedef Foo
* @property foo
*/
/**
* @param {Foo["foo"]} inst
*/
function blah(inst) {
return false;
}`,
});
/**
* @typedef Foo
* @property foo
*/
/**
* @param {Foo.foo} inst
*/
function blah(inst) {
return false;
} | {
"end_byte": 639,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInPropertyAccess_js.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_jsx.ts_0_204 | /// <reference path='fourslash.ts' />
// @Filename: /a.tsx
////[|<div>a</div>;|]
verify.moveToNewFile({
newFileContents: {
"/a.tsx":
``,
"/newFile.tsx":
`<div>a</div>;
`,
}
});
| {
"end_byte": 204,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_jsx.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesIfElse2.ts_0_437 | /// <reference path='fourslash.ts' />
////if (true) {
//// [|if|] (false) {
//// }
//// [|else|]{
//// }
//// if (true) {
//// }
//// else {
//// if (false)
//// if (true)
//// var x = undefined;
//// }
////}
////else if (null) {
////}
////else /* whar garbl */ if (undefined) {
////}
////else
////if (false) {
////}
////else { }
verify.baselineDocumentHighlights();
| {
"end_byte": 437,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesIfElse2.ts"
} |
TypeScript/tests/cases/fourslash/jsDocFunctionSignatures3.ts_0_830 | ///<reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: Foo.js
//// var someObject = {
//// /**
//// * @param {string} param1 Some string param.
//// * @param {number} parm2 Some number param.
//// */
//// someMethod: function(param1, param2) {
//// console.log(param1/*1*/);
//// return false;
//// },
//// /**
//// * @param {number} p1 Some number param.
//// */
//// otherMethod(p1) {
//// p1/*2*/
//// }
////
//// };
goTo.marker('1');
edit.insert('.');
verify.completions({ includes: { name: "substring", kind: "method", kindModifiers: "declare" } });
edit.backspace();
goTo.marker('2');
edit.insert('.');
verify.completions({ includes: { name: "toFixed", kind: "method", kindModifiers: "declare" } });
edit.backspace();
| {
"end_byte": 830,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocFunctionSignatures3.ts"
} |
TypeScript/tests/cases/fourslash/getEditsForFileRename_tsconfig_empty_include.ts_0_242 | /// <reference path="fourslash.ts" />
// @Filename: /a/foo.ts
////const x = 1
// @Filename: /a/tsconfig.json
////{ "include": [] }
verify.getEditsForFileRename({
oldPath: "/a/foo.ts",
newPath: "/a/bar.ts",
newFileContents: {
}
});
| {
"end_byte": 242,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEditsForFileRename_tsconfig_empty_include.ts"
} |
TypeScript/tests/cases/fourslash/quickInforForSucessiveInferencesIsNotAny.ts_0_366 | /// <reference path="fourslash.ts" />
////declare function schema<T> (value : T) : {field : T};
////
////declare const b: boolean;
////const obj/*1*/ = schema(b);
////const actualTypeOfNested/*2*/ = schema(obj);
verify.quickInfos({
1: `const obj: {
field: boolean;
}`,
2: `const actualTypeOfNested: {
field: {
field: boolean;
};
}`
});
| {
"end_byte": 366,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInforForSucessiveInferencesIsNotAny.ts"
} |
TypeScript/tests/cases/fourslash/processInvalidSyntax1.ts_0_436 | /// <reference path="fourslash.ts" />
// @allowJs: true
// Test validates that language service getChildren() doesn't
// crash due to invalid identifier in unicode.js.
// @Filename: decl.js
//// var obj = {};
// @Filename: unicode1.js
//// obj.𝒜 ;
// @Filename: unicode2.js
//// obj.¬ ;
// @Filename: unicode3.js
//// obj¬
// @Filename: forof.js
//// for (obj/**/.prop of arr) {
////
//// }
verify.baselineRename("", {});
| {
"end_byte": 436,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/processInvalidSyntax1.ts"
} |
TypeScript/tests/cases/fourslash/commentsVariables.ts_0_2971 | /// <reference path='fourslash.ts' />
/////** This is my variable*/
////var myV/*1*/ariable = 10;
/////*2*/
/////** d variable*/
////var d = 10;
////myVariable = d;
/////*3*/
/////** foos comment*/
////function foo() {
////}
/////** fooVar comment*/
////var foo/*12*/Var: () => void;
/////*4*/
////f/*5q*/oo(/*5*/);
////fo/*6q*/oVar(/*6*/);
////fo/*13*/oVar = f/*14*/oo;
/////*7*/
////f/*8q*/oo(/*8*/);
////foo/*9q*/Var(/*9*/);
////var fooVarVar = /*9aq*/fooVar;
/////**class comment*/
////class c {
//// /** constructor comment*/
//// constructor() {
//// }
////}
/////**instance comment*/
////var i = new c();
/////*10*/
/////** interface comments*/
////interface i1 {
////}
/////**interface instance comments*/
////var i1_i: i1;
/////*11*/
////function foo2(a: number): void;
////function foo2(b: string): void;
////function foo2(aOrb) {
////}
////var x = fo/*15*/o2;
verify.quickInfoAt("1", "var myVariable: number", "This is my variable");
verify.completions(
{
marker: "2",
includes: { name: "myVariable", text: "var myVariable: number", documentation: "This is my variable" },
},
{
marker: "3",
includes: [
{ name: "myVariable", text: "var myVariable: number", documentation: "This is my variable" },
{ name: "d", text: "var d: number", documentation: "d variable" }
],
},
{
marker: "4",
includes: [
{ name: "foo", text: "function foo(): void", documentation: "foos comment" },
{ name: "fooVar", text: "var fooVar: () => void", documentation:"fooVar comment" },
]
},
)
verify.signatureHelp({ marker: "5", docComment: "foos comment" });
verify.quickInfoAt("5q", "function foo(): void", "foos comment");
verify.signatureHelp({ marker: "6", docComment: "fooVar comment" });
verify.quickInfoAt("6q", "var fooVar: () => void", "fooVar comment");
verify.completions({
marker: "7",
includes: [
{ name: "foo", text: "function foo(): void", documentation: "foos comment" },
{ name: "fooVar", text: "var fooVar: () => void", documentation:"fooVar comment" },
],
});
verify.signatureHelp({ marker: "8", docComment: "foos comment" });
verify.quickInfoAt("8q", "function foo(): void", "foos comment");
verify.signatureHelp({ marker: "9", docComment: "fooVar comment" });
verify.quickInfos({
"9q": ["var fooVar: () => void", "fooVar comment"],
"9aq": ["var fooVar: () => void", "fooVar comment"]
});
verify.completions({ marker: "10", includes: { name: "i", text: "var i: c", documentation: "instance comment" } });
verify.completions({ marker: "11", includes: { name: "i1_i", text: "var i1_i: i1", documentation: "interface instance comments" } });
verify.quickInfos({
12: ["var fooVar: () => void", "fooVar comment"],
13: ["var fooVar: () => void", "fooVar comment"],
14: ["function foo(): void", "foos comment"],
15: "function foo2(a: number): void (+1 overload)"
});
| {
"end_byte": 2971,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsVariables.ts"
} |
TypeScript/tests/cases/fourslash/completionListOutsideOfClosedArrowFunction02.ts_0_139 | /// <reference path='fourslash.ts' />
////// no a or b
////(a, b) => { }/*1*/
verify.completions({ marker: "1", excludes: ["a", "b"] });
| {
"end_byte": 139,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListOutsideOfClosedArrowFunction02.ts"
} |
TypeScript/tests/cases/fourslash/completionListForNonExportedMemberInAmbientModuleWithExportAssignment1.ts_0_545 | /// <reference path="fourslash.ts"/>
// @Filename: completionListForNonExportedMemberInAmbientModuleWithExportAssignment1_file0.ts
////var x: Date;
////export = x;
// @Filename: completionListForNonExportedMemberInAmbientModuleWithExportAssignment1_file1.ts
///////<reference path='completionListForNonExportedMemberInAmbientModuleWithExportAssignment1_file0.ts'/>
//// import test = require("completionListForNonExportedMemberInAmbientModuleWithExportAssignment1_file0");
//// test./**/
verify.completions({ marker: "", exact: undefined });
| {
"end_byte": 545,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListForNonExportedMemberInAmbientModuleWithExportAssignment1.ts"
} |
TypeScript/tests/cases/fourslash/genericArityEnforcementAfterEdit.ts_0_217 | /// <reference path="fourslash.ts" />
//// interface G<T, U> { }
//// /**/
//// var v4: G<G<any>, any>;
verify.numberOfErrorsInCurrentFile(1);
goTo.marker();
edit.insert(' ');
verify.numberOfErrorsInCurrentFile(1);
| {
"end_byte": 217,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericArityEnforcementAfterEdit.ts"
} |
TypeScript/tests/cases/fourslash/findReferencesBindingPatternInJsdocNoCrash1.ts_0_787 | /// <reference path='fourslash.ts' />
// @moduleResolution: node
// @Filename: node_modules/use-query/package.json
////{
//// "name": "use-query",
//// "types": "index.d.ts"
////}
// @Filename: node_modules/use-query/index.d.ts
////declare function useQuery(): {
//// data: string[];
////};
// @Filename: node_modules/other/package.json
////{
//// "name": "other",
//// "types": "index.d.ts"
////}
// @Filename: node_modules/other/index.d.ts
////interface BottomSheetModalProps {
//// /**
//// * A scrollable node or normal view.
//// * @type {({ data: any }?) => any}
//// */
//// children: ({ data: any }?) => any;
////}
// @Filename: src/index.ts
////import { useQuery } from "use-query";
////const { /*1*/data } = useQuery();
verify.baselineFindAllReferences('1');
| {
"end_byte": 787,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findReferencesBindingPatternInJsdocNoCrash1.ts"
} |
TypeScript/tests/cases/fourslash/completionsClassMembers2.ts_0_301 | /// <reference path="fourslash.ts" />
////interface I {
//// method(): void;
////}
////
////export class C implements I {
//// property = "foo"
//// /**/
////}
verify.baselineCompletions({
includeCompletionsWithInsertText: true,
includeCompletionsWithClassMemberSnippets: true,
});
| {
"end_byte": 301,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsClassMembers2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties28.ts_0_430 | /// <reference path="fourslash.ts" />
////interface Foo {
//// a: number;
//// b: string;
////}
////
////interface Bar {
//// value: Foo;
////}
////
////[|const bar: Bar = {
//// value: {
//// a: 10
//// }
////}|]
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent:
`const bar: Bar = {
value: {
a: 10,
b: ""
}
}`,
});
| {
"end_byte": 430,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties28.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_default_exportDefaultIdentifier.ts_0_784 | /// <reference path="fourslash.ts" />
// Tests that we use the name "foo".
// @module: esnext
// @Filename: /a.ts
////const foo = 0;
////export default foo;
// @Filename: /b.ts
////f/**/;
goTo.marker("");
verify.completions({
marker: "",
includes: {
name: "foo",
source: "/a",
sourceDisplay: "./a",
text: "(alias) const foo: 0\nexport default foo",
kind: "alias",
kindModifiers: "export",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
preferences: { includeCompletionsForModuleExports: true },
});
verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/a",
description: `Add import from "./a"`,
newFileContent: `import foo from "./a";
f;`,
});
| {
"end_byte": 784,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_default_exportDefaultIdentifier.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingEnumMember13.ts_0_140 | /// <reference path="fourslash.ts" />
////enum E { A, B }
////declare var a: E;
////a.C;
verify.not.codeFixAvailable("fixMissingMember");
| {
"end_byte": 140,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingEnumMember13.ts"
} |
TypeScript/tests/cases/fourslash/highlightsForExportFromUnfoundModule.ts_0_259 | /// <reference path='fourslash.ts'/>
// @allowJs: true
// @Filename: a.js
//// import foo from 'unfound';
//// export {
//// foo,
//// };
// @Filename: b.js
//// export {
//// /**/foo
//// } from './a';
goTo.marker();
verify.baselineRename("", { });
| {
"end_byte": 259,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/highlightsForExportFromUnfoundModule.ts"
} |
TypeScript/tests/cases/fourslash/importStatementCompletions_noPatternAmbient.ts_0_516 | /// <reference path="fourslash.ts" />
// @Filename: /types.d.ts
//// declare module "*.css" {
//// const styles: any;
//// export = styles;
//// }
// @Filename: /index.ts
//// import style/**/
verify.completions({
isNewIdentifierLocation: true,
marker: "",
exact: [{
name: "type",
sortText: completion.SortText.GlobalsOrKeywords,
}],
preferences: {
includeCompletionsForImportStatements: true,
includeInsertTextCompletions: true,
includeCompletionsWithSnippetText: true,
}
});
| {
"end_byte": 516,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importStatementCompletions_noPatternAmbient.ts"
} |
TypeScript/tests/cases/fourslash/multiModuleFundule.ts_0_698 | /// <reference path='fourslash.ts'/>
////function C(x: number) { }
////
////module C {
//// export var x = 1;
////}
////module C {
//// export function foo() { }
////}
////
////var /*2*/r = C(/*1*/
////var /*4*/r2 = new C(/*3*/ // using void returning function as constructor
////var r3 = C./*5*/
verify.completions({ marker: "1", includes: "C", isNewIdentifierLocation: true });
edit.insert('C.x);');
verify.quickInfoAt("2", "var r: void");
verify.completions({ marker: "3", includes: "C", isNewIdentifierLocation: true });
edit.insert('C.x);');
verify.quickInfoAt("4", "var r2: any");
verify.completions({ marker: "5", includes: ["x", "foo"] });
edit.insert('x;');
verify.noErrors(); | {
"end_byte": 698,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/multiModuleFundule.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsReExports.ts_0_1989 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////[|export function /*foo0*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}foo|](): void {}|]
// @Filename: /b.ts
////[|export { /*foo1*/[|{| "contextRangeIndex": 2 |}foo|] as /*bar0*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}bar|] } from "./a";|]
// @Filename: /c.ts
////[|export { /*foo2*/[|{| "contextRangeIndex": 5 |}foo|] as /*defaultC*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 5 |}default|] } from "./a";|]
// @Filename: /d.ts
////[|export { /*defaultD*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 8 |}default|] } from "./c";|]
// @Filename: /e.ts
////[|import { /*bar1*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 10 |}bar|] } from "./b";|]
////[|import /*baz0*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 12 |}baz|] from "./c";|]
////[|import { /*defaultE*/[|{| "contextRangeIndex": 14 |}default|] as /*bang0*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 14 |}bang|] } from "./c";|]
////[|import /*boom0*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 17 |}boom|] from "./d";|]
/////*bar2*/[|bar|](); /*baz1*/[|baz|](); /*bang1*/[|bang|](); /*boom1*/[|boom|]();
verify.noErrors();
verify.baselineFindAllReferences(
'foo0', 'foo1', 'foo2',
'bar0', 'bar1', 'bar2',
'defaultC', 'defaultE', 'defaultD',
'baz0', 'baz1',
'bang0', 'bang1',
'boom0', 'boom1'
);
test.rangesByText().forEach((ranges, text) => {
if (text.indexOf("export") === 0 || text.indexOf("import") === 0) return;
switch (text) {
case "default":
for (const range of ranges) {
goTo.rangeStart(range);
verify.renameInfoFailed();
}
break;
default:
verify.baselineRename(ranges);
break;
}
}); | {
"end_byte": 1989,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsReExports.ts"
} |
TypeScript/tests/cases/fourslash/completionListInvalidMemberNames_withExistingIdentifier.ts_0_560 | /// <reference path='fourslash.ts' />
////declare const x: { "foo ": "space in the name", };
////x[|.fo/*0*/|];
////x[|./*1*/|]
////unrelatedIdentifier;
const [r0, r1] = test.ranges();
verify.completions(
{
marker: "0",
exact: [{ name: "foo ", insertText: '["foo "]', replacementSpan: r0 }],
preferences: { includeInsertTextCompletions: true },
},
{
marker: "1",
exact: [{ name: "foo ", insertText: '["foo "]', replacementSpan: r1 }],
preferences: { includeInsertTextCompletions: true },
},
);
| {
"end_byte": 560,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInvalidMemberNames_withExistingIdentifier.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoForContextuallyTypedIife.ts_0_838 | /// <reference path='fourslash.ts' />
////(({ q/*1*/, qq/*2*/ }, x/*3*/, { p/*4*/ }) => {
//// var s: number = q/*5*/;
//// var t: number = qq/*6*/;
//// var u: number = p/*7*/;
//// var v: number = x/*8*/;
//// return q; })({ q: 13, qq: 12 }, 1, { p: 14 });
////((a/*9*/, b/*10*/, c/*11*/) => [a/*12*/,b/*13*/,c/*14*/])("foo", 101, false);
verify.quickInfos({
1: "(parameter) q: number",
2: "(parameter) qq: number",
3: "(parameter) x: number",
4: "(parameter) p: number",
5: "(parameter) q: number",
6: "(parameter) qq: number",
7: "(parameter) p: number",
8: "(parameter) x: number",
9: "(parameter) a: string",
10: "(parameter) b: number",
11: "(parameter) c: boolean",
12: "(parameter) a: string",
13: "(parameter) b: number",
14: "(parameter) c: boolean"
});
| {
"end_byte": 838,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForContextuallyTypedIife.ts"
} |
TypeScript/tests/cases/fourslash/completionListInsideTargetTypedFunction.ts_0_256 | /// <reference path='fourslash.ts'/>
////module Fix2 {
//// interface iFace { (event: string); }
//// var foo: iFace = function (elem) { /**/ }
////}
verify.completions({ marker: "", includes: { name: "elem", text: "(parameter) elem: string" } });
| {
"end_byte": 256,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInsideTargetTypedFunction.ts"
} |
TypeScript/tests/cases/fourslash/gotoDefinitionLinkTag6.ts_0_159 | /// <reference path="fourslash.ts" />
////enum E {
//// /** {@link E./*1*/[|A|]} */
//// [|/*2*/A|]
////}
verify.baselineGetDefinitionAtPosition("1");
| {
"end_byte": 159,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/gotoDefinitionLinkTag6.ts"
} |
TypeScript/tests/cases/fourslash/paste.ts_0_137 | /// <reference path="fourslash.ts" />
//// fn(/**/);
goTo.marker();
edit.paste('x,y,z');
verify.currentLineContentIs('fn(x, y, z);');
| {
"end_byte": 137,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/paste.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpOnNestedOverloads.ts_0_555 | /// <reference path='fourslash.ts'/>
////declare function fn(x: string);
////declare function fn(x: string, y: number);
////declare function fn2(x: string);
////declare function fn2(x: string, y: number);
////fn('', fn2(/*1*/
verify.signatureHelp({
marker: "1",
overloadsCount: 2,
text: "fn2(x: string): any",
parameterName: "x",
parameterSpan: "x: string",
});
edit.insert("'',");
verify.signatureHelp({
overloadsCount: 2,
text: "fn2(x: string, y: number): any",
parameterName: "y",
parameterSpan: "y: number",
});
| {
"end_byte": 555,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpOnNestedOverloads.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionMethodOverloads.ts_0_1013 | /// <reference path='fourslash.ts' />
////class MethodOverload {
//// static [|/*staticMethodOverload1*/method|]();
//// static /*staticMethodOverload2*/method(foo: string);
//// static /*staticMethodDefinition*/method(foo?: any) { }
//// public [|/*instanceMethodOverload1*/method|](): any;
//// public /*instanceMethodOverload2*/method(foo: string);
//// public /*instanceMethodDefinition*/method(foo?: any) { return "foo" }
////}
////// static method
////MethodOverload.[|/*staticMethodReference1*/method|]();
////MethodOverload.[|/*staticMethodReference2*/method|]("123");
////// instance method
////var methodOverload = new MethodOverload();
////methodOverload.[|/*instanceMethodReference1*/method|]();
////methodOverload.[|/*instanceMethodReference2*/method|]("456");
verify.baselineGoToDefinition(
"staticMethodReference1",
"staticMethodReference2",
"instanceMethodReference1",
"instanceMethodReference2",
"staticMethodOverload1",
"instanceMethodOverload1"
);
| {
"end_byte": 1013,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionMethodOverloads.ts"
} |
TypeScript/tests/cases/fourslash/referencesForClassLocal.ts_0_407 | /// <reference path='fourslash.ts'/>
// References to local inside a class.
////var n = 14;
////
////class foo {
//// /*1*/private /*2*/n = 0;
////
//// public bar() {
//// this./*3*/n = 9;
//// }
////
//// constructor() {
//// this./*4*/n = 4;
//// }
////
//// public bar2() {
//// var n = 12;
//// }
////}
verify.baselineFindAllReferences('1', '2', '3', '4');
| {
"end_byte": 407,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForClassLocal.ts"
} |
TypeScript/tests/cases/fourslash/completionsSpecialAssignmentNotContextuallyTyped.ts_0_566 | /// <reference path="fourslash.ts" />
// @checkJs: true
// @allowJs: true
// @Filename: index.js
//// module.exports = {
//// a/*1*/
//// }
////
//// exports.foo = {
//// a/*2*/
//// }
////
//// function F() {
//// this.blah = {
//// a/*3*/
//// };
//// }
////
//// F.foo = {
//// a/*4*/
//// }
////
//// F.prototype = {
//// a/*5*/
//// }
////
//// F.prototype.x = {
//// a/*6*/
//// }
[1, 2, 3, 4, 5, 6].forEach(marker => {
verify.completions({
marker: `${marker}`,
excludes: "a",
isNewIdentifierLocation: true,
});
});
| {
"end_byte": 566,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsSpecialAssignmentNotContextuallyTyped.ts"
} |
TypeScript/tests/cases/fourslash/findAllReferencesLinkTag3.ts_0_997 | /// <reference path="fourslash.ts" />
//// namespace NPR/*5*/ {
//// export class Consider/*4*/ {
//// This/*3*/ = class {
//// show/*2*/() { }
//// }
//// m/*1*/() { }
//// }
//// /**
//// * {@linkcode Consider.prototype.m}
//// * {@linkplain Consider#m}
//// * {@linkcode Consider#This#show}
//// * {@linkplain Consider.This.show}
//// * {@linkcode NPR.Consider#This#show}
//// * {@linkplain NPR.Consider.This#show}
//// * {@linkcode NPR.Consider#This.show} # doesn't parse trailing .
//// * {@linkcode NPR.Consider.This.show}
//// */
//// export function ref() { }
//// }
//// /**
//// * {@linkplain NPR.Consider#This#show hello hello}
//// * {@linkplain NPR.Consider.This#show}
//// * {@linkcode NPR.Consider#This.show} # doesn't parse trailing .
//// * {@linkcode NPR.Consider.This.show}
//// */
//// export function outerref() { }
verify.baselineFindAllReferences('1', '2', '3', '4', '5')
| {
"end_byte": 997,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferencesLinkTag3.ts"
} |
TypeScript/tests/cases/fourslash/autoImportPackageJsonImportsConditions.ts_0_528 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /package.json
//// {
//// "imports": {
//// "#thing": {
//// "types": { "import": "./types-esm/thing.d.mts", "require": "./types/thing.d.ts" },
//// "default": { "import": "./esm/thing.mjs", "require": "./dist/thing.js" }
//// }
//// }
//// }
// @Filename: /src/.ts
//// something/*a*/
// @Filename: /types/thing.d.ts
//// export function something(name: string): any;
verify.importFixModuleSpecifiers("a", ["#thing"]);
| {
"end_byte": 528,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportPackageJsonImportsConditions.ts"
} |
TypeScript/tests/cases/fourslash/toggleMultilineComment3.ts_0_539 | /// <reference path="fourslash.ts">
// If range is inside a single line comment, just add the multiline comment.
//// // let va[|r1 = 1;
//// let var2 = 2;
//// // let var3|] = 3;
////
//// // let va[|r4 = 1;
//// let var5 = 2;
//// /* let var6|] = 3;*/
////
//// /* let va[|r7 = 1;*/
//// let var8 = 2;
//// // let var9|] = 3;
verify.toggleMultilineComment(
`/*// let var1 = 1;
let var2 = 2;
// let var3*/ = 3;
/*// let var4 = 1;
let var5 = 2;
*//* let var6*//* = 3;*/
/* let va*//*r7 = 1;*//*
let var8 = 2;
// let var9*/ = 3;`); | {
"end_byte": 539,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/toggleMultilineComment3.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteralNonrelativeImport15.ts_0_824 | /// <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;
verify.completions({ marker: test.markerNames(), exact: ["/module1", "/module2"], isNewIdentifierLocation: true });
| {
"end_byte": 824,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteralNonrelativeImport15.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassPropertyInitialization11.ts_0_309 | /// <reference path='fourslash.ts' />
// @strict: true
//// class TT { constructor () {} }
////
//// class T {
//// a: TT;
//// }
verify.codeFix({
description: `Add initializer to property 'a'`,
newFileContent: `class TT { constructor () {} }
class T {
a: TT = new TT;
}`,
index: 2
}) | {
"end_byte": 309,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassPropertyInitialization11.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts_0_397 | /// <reference path='fourslash.ts'/>
//// /** @return *crunch* */
//// function /*1*/foo(/*2*/param: string, /*3*/optionalParam?: string, /*4*/paramWithInitializer = "hello", .../*5*/restParam: string[]) {
//// /*6*/param = "Hello";
//// /*7*/optionalParam = "World";
//// /*8*/paramWithInitializer = "Hello";
//// /*9*/restParam[0] = "World";
//// }
verify.baselineQuickInfo();
| {
"end_byte": 397,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationInterface_08.ts_0_438 | /// <reference path='fourslash.ts'/>
// Should not hang on inheritance loops
//// interface Base {
//// hello (): void;
//// }
////
//// interface A extends Base {}
//// interface B extends C, A {}
//// interface C extends B, A {}
////
//// class X implements B {
//// [|hello|]() {}
//// }
////
//// function someFunction(d : A) {
//// d.he/*function_call*/llo();
//// }
verify.baselineGoToImplementation("function_call"); | {
"end_byte": 438,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterface_08.ts"
} |
TypeScript/tests/cases/fourslash/unusedLocalsInFunction1.ts_0_175 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
//// [| function greeter() {
//// var x = 0;
////} |]
verify.rangeAfterCodeFix(`
function greeter() {
}`);
| {
"end_byte": 175,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedLocalsInFunction1.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToAnon_MapArgument.ts_0_379 | /// <reference path='fourslash.ts' />
//// [9,8,7].map(/*x*/n/*y*/ => n + 418);
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to anonymous function",
actionDescription: "Convert to anonymous function",
newContent: `[9,8,7].map(function(n) {
return n + 418;
});`,
});
| {
"end_byte": 379,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToAnon_MapArgument.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Arrow.ts_0_2210 | /// <reference path='fourslash.ts' />
//// /*z*/c/*y*/onst /*x*/f/*w*/oo = /*v*/(/*u*//*t*/a/*s*/, b) /*r*/=/*q*/> /*p*/4/*o*/2;
goTo.select("z", "y");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
goTo.select("x", "w");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
goTo.select("v", "u");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
goTo.select("t", "s");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
goTo.select("r", "q");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
goTo.select("p", "o");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
| {
"end_byte": 2210,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Arrow.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts_3_220 | / <reference path="fourslash.ts"/>
/////*1*/interface /*2*/Base { }
////namespace n {
//// var Base = class { };
//// interface I extends /*3*/Base { }
////}
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 220,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceOptionalProperty.ts_0_392 | /// <reference path='fourslash.ts' />
////interface IPerson {
//// name: string;
//// birthday?: string;
////}
////class Person implements IPerson {}
verify.codeFix({
description: "Implement interface 'IPerson'",
newFileContent:
`interface IPerson {
name: string;
birthday?: string;
}
class Person implements IPerson {
name: string;
birthday?: string;
}`,
});
| {
"end_byte": 392,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceOptionalProperty.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoForFunctionDeclaration.ts_0_343 | /// <reference path='fourslash.ts' />
////interface A<T> { }
////
////function ma/*makeA*/keA<T>(t: T): A<T> { return null; }
////
////function /*f*/f<T>(t: T) {
//// return makeA(t);
////}
////
////var x = f(0);
////var y = makeA(0);
verify.quickInfos({
makeA: "function makeA<T>(t: T): A<T>",
f: "function f<T>(t: T): A<T>"
});
| {
"end_byte": 343,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForFunctionDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesDeclare1.ts_0_1436 | /// <reference path='fourslash.ts' />
////module m {
//// export class C1 {
//// public pub1;
//// public pub2;
//// private priv1;
//// private priv2;
//// protected prot1;
//// protected prot2;
////
//// public public;
//// private private;
//// protected protected;
////
//// public constructor(public a, private b, protected c, public d, private e, protected f) {
//// this.public = 10;
//// this.private = 10;
//// this.protected = 10;
//// }
////
//// public get x() { return 10; }
//// public set x(value) { }
////
//// public static statPub;
//// private static statPriv;
//// protected static statProt;
//// }
////
//// export interface I1 {
//// }
////
//// export [|declare|] module ma.m1.m2.m3 {
//// interface I2 {
//// }
//// }
////
//// export module mb.m1.m2.m3 {
//// declare var foo;
////
//// export class C2 {
//// public pub1;
//// private priv1;
//// protected prot1;
////
//// protected constructor(public public, protected protected, private private) {
//// }
//// }
//// }
////
//// [|declare|] var ambientThing: number;
//// export var exportedThing = 10;
//// [|declare|] function foo(): string;
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 1436,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesDeclare1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromFunctionThisUsageExplicitAny.ts_0_437 | /// <reference path='fourslash.ts' />
// @noImplicitThis: true
//// function returnThisMember([| |]) {
//// return this.member;
//// }
////
//// const container: any = {
//// member: "sample",
//// returnThisMember: returnThisMember,
//// };
////
//// container.returnThisMember();
verify.codeFix({
description: "Infer 'this' type of 'returnThisMember' from usage",
index: 0,
newRangeContent: "this: any ",
});
| {
"end_byte": 437,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromFunctionThisUsageExplicitAny.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionOverloadsInMultiplePropertyAccesses.ts_0_419 | /// <reference path='fourslash.ts' />
// Test that we can climb past more than one property access to reach a call expression.
////namespace A {
//// export namespace B {
//// export function f(value: number): void;
//// export function /*1*/f(value: string): void;
//// export function f(value: number | string) {}
//// }
////}
////A.B.[|/*2*/f|]("");
verify.baselineGoToDefinition("2");
| {
"end_byte": 419,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionOverloadsInMultiplePropertyAccesses.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_EmptySpanBinaryReturnStatement.ts_0_646 | /// <reference path='fourslash.ts' />
////let a = { b: { c: 0 } };
////function f(){
//// return a && a.b && /*a*//*b*/a.b.c;
////}
// verify that the refactor is offered for empty spans in return statements.
goTo.select("a", "b");
verify.not.refactorAvailableForTriggerReason("implicit", "Convert to optional chain expression");
edit.applyRefactor({
refactorName: "Convert to optional chain expression",
actionName: "Convert to optional chain expression",
actionDescription: "Convert to optional chain expression",
newContent:
`let a = { b: { c: 0 } };
function f(){
return a?.b?.c;
}`,
triggerReason: "invoked"
}); | {
"end_byte": 646,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_EmptySpanBinaryReturnStatement.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpConstructorInheritance.ts_0_519 | /// <reference path='fourslash.ts' />
////class base {
//// constructor(s: string);
//// constructor(n: number);
//// constructor(a: any) { }
////}
////class B1 extends base { }
////class B2 extends B1 { }
////class B3 extends B2 {
//// constructor() {
//// super(/*indirectSuperCall*/3);
//// }
////}
verify.signatureHelp({
marker: "indirectSuperCall",
overloadsCount: 2,
text: "B2(n: number): B2",
parameterCount: 1,
parameterName: "n",
parameterSpan: "n: number",
});
| {
"end_byte": 519,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpConstructorInheritance.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsClassIncomplete.ts_0_95 | /// <reference path='fourslash.ts'/>
/////*1*/class /*2*/ {
////}
verify.baselineQuickInfo(); | {
"end_byte": 95,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsClassIncomplete.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionOverriddenMember13.ts_0_224 | /// <reference path="./fourslash.ts"/>
// @noImplicitOverride: true
////class Foo {
//// static /*2*/m() {}
////}
////class Bar extends Foo {
//// static [|/*1*/override|] m() {}
////}
verify.baselineGoToDefinition("1");
| {
"end_byte": 224,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionOverriddenMember13.ts"
} |
TypeScript/tests/cases/fourslash/inlayHintsEnumMemberValue.ts_0_221 | /// <reference path="fourslash.ts" />
//// enum E {
//// A,
//// AA,
//// B = 10,
//// BB,
//// C = 'C',
//// }
verify.baselineInlayHints(undefined, {
includeInlayEnumMemberValueHints: true,
});
| {
"end_byte": 221,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsEnumMemberValue.ts"
} |
TypeScript/tests/cases/fourslash/extract-const6.ts_0_365 | /// <reference path='fourslash.ts' />
// @filename: foo.ts
////const foo = /*a*/1 as number/*b*/;
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_0",
actionDescription: "Extract to constant in enclosing scope",
newContent:
`const newLocal = 1 as number;
const foo = /*RENAME*/newLocal;`
});
| {
"end_byte": 365,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const6.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInFunction.ts_0_287 | /// <reference path='fourslash.ts'/>
////function /*1*/foo</*2*/U>(/*3*/a: /*4*/U) {
//// return /*5*/a;
////}
/////*6*/foo("Hello");
////function /*7*/foo2</*8*/U extends string>(/*9*/a: /*10*/U) {
//// return /*11*/a;
////}
/////*12*/foo2("hello");
verify.baselineQuickInfo(); | {
"end_byte": 287,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInFunction.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesThis2.ts_0_2907 | /// <reference path='fourslash.ts' />
////this;
////this;
////
////function f() {
//// [|this|];
//// [|this|];
//// () => [|this|];
//// () => {
//// if ([|this|]) {
//// [|this|];
//// }
//// else {
//// [|t/**/his|].this;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
////}
////
////module m {
//// function f() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this.this;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////}
////
////class A {
//// public b = this.method1;
////
//// public method1() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this.this;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////
//// private method2() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this.this;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////
//// public static staticB = this.staticMethod1;
////
//// public static staticMethod1() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this.this;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////
//// private static staticMethod2() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this.this;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////}
////
////var x = {
//// f() {
//// this;
//// },
//// g() {
//// this;
//// }
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 2907,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesThis2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration19.ts_0_154 | /// <reference path="fourslash.ts" />
////declare function f(x: number): any;
////f(foo);
verify.not.codeFixAvailable("fixMissingFunctionDeclaration");
| {
"end_byte": 154,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration19.ts"
} |
TypeScript/tests/cases/fourslash/formatWithStatement.ts_0_803 | /// <reference path='fourslash.ts' />
////with /*1*/(foo.bar)
////
//// {/*2*/
////
//// }/*3*/
////
////with (bar.blah)/*4*/
////{/*5*/
////}/*6*/
format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", false);
format.document();
goTo.marker("1");
verify.currentLineContentIs("with (foo.bar) {");
goTo.marker("3");
verify.currentLineContentIs("}");
goTo.marker("4");
verify.currentLineContentIs("with (bar.blah) {");
goTo.marker("6");
verify.currentLineContentIs("}");
format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", true);
format.document();
goTo.marker("1");
verify.currentLineContentIs("with (foo.bar)");
goTo.marker("2");
verify.currentLineContentIs("{");
goTo.marker("4");
verify.currentLineContentIs("with (bar.blah)");
goTo.marker("5");
verify.currentLineContentIs("{"); | {
"end_byte": 803,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatWithStatement.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertImport_namedToNamespace5.ts_0_550 | /// <reference path='fourslash.ts' />
/////*a*/import { a, b, foo } from "./foo";/*b*/
////a;
////b;
////foo;
////export { foo };
////export { foo as bar };
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert import",
actionName: "Convert named imports to namespace import",
actionDescription: "Convert named imports to namespace import",
triggerReason: "invoked",
newContent:
`import * as foo_1 from "./foo";
import { foo } from "./foo";
foo_1.a;
foo_1.b;
foo_1.foo;
export { foo };
export { foo as bar };`,
});
| {
"end_byte": 550,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertImport_namedToNamespace5.ts"
} |
TypeScript/tests/cases/fourslash/docCommentTemplateFunctionWithParameters.ts_0_551 | /// <reference path='fourslash.ts' />
// @Filename: functionWithParams.ts
/////*0*/
//// /*1*/
//// function foo(x: number, y: string): boolean {}
const noIndentScaffolding = "/**\n * \n * @param x\n * @param y\n */";
const oneIndentScaffolding = "/**\n * \n * @param x\n * @param y\n */";
const noIndentOffset = 7;
const oneIndentOffset = noIndentOffset + 4;
goTo.marker("0");
verify.docCommentTemplateAt("0", noIndentOffset, noIndentScaffolding);
verify.docCommentTemplateAt("1", oneIndentOffset, oneIndentScaffolding);
| {
"end_byte": 551,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateFunctionWithParameters.ts"
} |
TypeScript/tests/cases/fourslash/forwardReference.ts_0_199 | /// <reference path='fourslash.ts' />
////function f() {
//// var x = new t();
//// x./**/
////}
////class t {
//// public n: number;
////}
verify.completions({ marker: "", exact: "n" });
| {
"end_byte": 199,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/forwardReference.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoForObjectBindingElementName02.ts_0_222 | /// <reference path='fourslash.ts'/>
////interface I {
//// property1: number;
//// property2: string;
////}
////
////var foo: I;
////var { property1: /**/prop1 } = foo;
verify.quickInfoAt("", "var prop1: number"); | {
"end_byte": 222,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForObjectBindingElementName02.ts"
} |
TypeScript/tests/cases/fourslash/completionListPrivateNames.ts_0_691 | /// <reference path="fourslash.ts"/>
////class Foo {
//// #x;
//// y;
////}
////
////class Bar extends Foo {
//// #z;
//// t;
//// constructor() {
//// this./*1*/
//// class Baz {
//// #z;
//// #u;
//// v;
//// constructor() {
//// this./*2*/
//// new Bar()./*3*/
//// }
//// }
//// }
////}
////
////new Foo()./*4*/
verify.completions({ marker: "1", unsorted: ["#z", "t", "y"] });
verify.completions({ marker: "2", unsorted: ["#z", "#u", "v"] });
verify.completions({ marker: "3", unsorted: ["#z", "t", "y"] });
verify.completions({ marker: "4", exact: ["y"] });
| {
"end_byte": 691,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListPrivateNames.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoOnClassMergedWithFunction.ts_0_437 | /// <reference path="fourslash.ts" />
////module Test {
//// class Mocked {
//// myProp: string;
//// }
//// class Tester {
//// willThrowError() {
//// Mocked = Mocked || function () { // => Error: Invalid left-hand side of assignment expression.
//// return { /**/myProp: "test" };
//// };
//// }
//// }
////}
verify.quickInfoAt("", "(property) myProp: string");
| {
"end_byte": 437,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnClassMergedWithFunction.ts"
} |
TypeScript/tests/cases/fourslash/linkedEditingJsxTag2.ts_0_1203 | /// <reference path='fourslash.ts' />
// for readability
////const jsx = (
//// <div style={{ color: 'red' }}>
//// <p>
//// <img />
//// </p>
//// </div>
////);
// @Filename: /attrs.tsx
////const jsx = (
//// </*0*/div/*1*/ /*2*/styl/*3*/e={{ color: 'red' }}/*4*/>/*5*/
//// <p>
//// <img />
//// </p>
//// </di/*6*/v>
////);
// this case is missing a closing brace in the attributes
// @Filename: /attrsError.tsx
////const jsx = (
//// </*10*/div/*11*/ /*12*/styl/*13*/e={{ color: 'red' }/*14*/>/*15*/
//// </*16*/p />
//// <//*17*/div>
////);
const startPos = test.markerByName("0").position;
const endPos = test.markerByName("6").position - 2;
const wordPattern = "[a-zA-Z0-9:\\-\\._$]*";
const linkedCursors = {
ranges: [{ start: startPos, length: 3 }, { start: endPos, length: 3 }],
wordPattern,
};
verify.linkedEditing( {
"0": linkedCursors,
"1": linkedCursors,
"2": undefined,
"3": undefined,
"4": undefined,
"5": undefined,
"6": linkedCursors,
"10": undefined,
"11": undefined,
"12": undefined,
"13": undefined,
"14": undefined,
"15": undefined,
"16": undefined,
}); | {
"end_byte": 1203,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/linkedEditingJsxTag2.ts"
} |
TypeScript/tests/cases/fourslash/tsxFindAllReferences4.ts_0_464 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// }
//// interface ElementAttributesProperty { props }
//// }
//// /*1*/class /*2*/MyClass {
//// props: {
//// name?: string;
//// size?: number;
//// }
////
////
//// var x = /*3*/</*4*/MyClass name='hello'><//*5*/MyClass>;
verify.baselineFindAllReferences('1', '2', '3', '4', '5');
| {
"end_byte": 464,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxFindAllReferences4.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingCallParentheses6.ts_0_492 | /// <reference path='fourslash.ts'/>
// @strictNullChecks: true
////function foo(fn: () => boolean) {
//// if (fn/**/) {
//// console.log('test');
//// }
////}
verify.codeFixAvailable([
{ description: ts.Diagnostics.Add_missing_call_parentheses.message }
]);
verify.codeFix({
description: ts.Diagnostics.Add_missing_call_parentheses.message,
index: 0,
newFileContent:
`function foo(fn: () => boolean) {
if (fn()) {
console.log('test');
}
}`,
});
| {
"end_byte": 492,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingCallParentheses6.ts"
} |
TypeScript/tests/cases/fourslash/completionListBeforeKeyword.ts_0_560 | /// <reference path="fourslash.ts" />
////// Completion after dot in named type, when the following line has a keyword
////module TypeModule1 {
//// export class C1 {}
//// export class C2 {}
////}
////var x : TypeModule1./*TypeReference*/
////module TypeModule2 {
//// export class Test3 {}
////}
////
////// Completion after dot in named type, when the following line has a keyword
////TypeModule1./*ValueReference*/
////module TypeModule3 {
//// export class Test3 {}
////}
verify.completions({ marker: test.markers(), exact: ["C1", "C2"] });
| {
"end_byte": 560,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListBeforeKeyword.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_destructure_allUnused_for.ts_0_273 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @noUnusedParameters: true
////for (const { x } of o) {}
verify.codeFix({
description: ts.Diagnostics.Remove_unused_destructuring_declaration.message,
newFileContent:
`for (const {} of o) {}`,
});
| {
"end_byte": 273,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_destructure_allUnused_for.ts"
} |
TypeScript/tests/cases/fourslash/renameStringLiteralTypes2.ts_0_512 | /// <reference path='fourslash.ts' />
////type Foo = "[|a|]" | "b";
////
////class C {
//// p: Foo = "[|a|]";
//// m() {
//// if (this.p === "[|a|]") {}
//// if ("[|a|]" === this.p) {}
////
//// if (this.p !== "[|a|]") {}
//// if ("[|a|]" !== this.p) {}
////
//// if (this.p == "[|a|]") {}
//// if ("[|a|]" == this.p) {}
////
//// if (this.p != "[|a|]") {}
//// if ("[|a|]" != this.p) {}
//// }
////}
verify.baselineRenameAtRangesWithText("a");
| {
"end_byte": 512,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameStringLiteralTypes2.ts"
} |
TypeScript/tests/cases/fourslash/syntacticClassificationsConflictDiff3Markers1.ts_0_934 | /// <reference path="fourslash.ts"/>
////class C {
////<<<<<<< HEAD
//// v = 1;
////||||||| merged common ancestors
//// v = 3;
////=======
//// v = 2;
////>>>>>>> Branch - a
////}
const c = classification("original");
verify.syntacticClassificationsAre(
c.keyword("class"), c.className("C"), c.punctuation("{"),
c.comment("<<<<<<< HEAD"),
c.identifier("v"), c.operator("="), c.numericLiteral("1"), c.punctuation(";"),
c.comment("||||||| merged common ancestors"),
c.identifier("v"), c.punctuation("="), c.numericLiteral("3"), c.punctuation(";"),
c.comment("======="),
c.identifier("v"), c.punctuation("="), c.numericLiteral("2"), c.punctuation(";"),
c.comment(">>>>>>> Branch - a"),
c.punctuation("}"));
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("class.declaration", "C"),
c2.semanticToken("property.declaration", "v"),
);
| {
"end_byte": 934,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsConflictDiff3Markers1.ts"
} |
TypeScript/tests/cases/fourslash/jsdocPropertyTagCompletion.ts_0_182 | ///<reference path="fourslash.ts" />
/////**
//// * @typedef {Object} Foo
//// * @property {/**/}
//// */
verify.completions(
{ marker: "", exact: completion.globalTypes },
);
| {
"end_byte": 182,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocPropertyTagCompletion.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationFunctions.ts_0_1465 | /// <reference path='fourslash.ts' />
// @BaselineFile: bpSpan_functions.baseline
// @Filename: bpSpan_functions.ts
////var greetings = 0;
////function greet(greeting: string): number {
//// greetings++;
//// return greetings;
////}
////function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
//// greetings++;
//// return greetings;
////}
////function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
////{
//// return;
////}
////module m {
//// var greetings = 0;
//// function greet(greeting: string): number {
//// greetings++;
//// return greetings;
//// }
//// function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
//// greetings++;
//// return greetings;
//// }
//// function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
//// {
//// return;
//// }
////}
////module m1 {
//// var greetings = 0;
//// export function greet(greeting: string): number {
//// greetings++;
//// return greetings;
//// }
//// export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
//// greetings++;
//// return greetings;
//// }
//// export function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
//// {
//// return;
//// }
////}
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 1465,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationFunctions.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentNamedImport.ts_0_416 | /// <reference path='fourslash.ts' />
////import {/*0*/
//// numbers as bn,/*1*/
//// list/*2*/
////} from '@bykov/basics';/*3*/
format.document();
goTo.marker("0"); verify.currentLineContentIs("import {");
goTo.marker("1"); verify.currentLineContentIs(" numbers as bn,");
goTo.marker("2"); verify.currentLineContentIs(" list");
goTo.marker("3"); verify.currentLineContentIs("} from '@bykov/basics';"); | {
"end_byte": 416,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentNamedImport.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceConstructSignature.ts_0_170 | /// <reference path='fourslash.ts' />
//// interface I {
//// new (x: number, b: string);
//// }
//// class C implements I {[| |]}
verify.not.codeFixAvailable();
| {
"end_byte": 170,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceConstructSignature.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete9.ts_0_445 | /// <reference path='fourslash.ts' />
//// function f(templateStrings, x, y, z) { return 10; }
//// function g(templateStrings, x, y, z) { return ""; }
////
//// f `/*1*/ \\\/*2*/`/*3*/ /*4*/
verify.signatureHelp({
marker: test.markers(),
text: "f(templateStrings: any, x: any, y: any, z: any): number",
argumentCount: 1,
parameterCount: 4,
parameterName: "templateStrings",
parameterSpan: "templateStrings: any",
});
| {
"end_byte": 445,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete9.ts"
} |
TypeScript/tests/cases/fourslash/completionListAfterRegularExpressionLiteral1.ts_0_357 | /// <reference path="fourslash.ts" />
/////a/./**/
verify.completions({
marker: "",
unsorted: [
"exec",
"test",
"source",
"global",
"ignoreCase",
"multiline",
"lastIndex",
{ name: "compile", sortText: completion.SortText.Deprecated(completion.SortText.LocationPriority) },
]
});
| {
"end_byte": 357,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAfterRegularExpressionLiteral1.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess4.ts_0_509 | /// <reference path='fourslash.ts' />
//// class A {
//// /*a*/private _a: string;/*b*/
//// }
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Generate 'get' and 'set' accessors",
actionName: "Generate 'get' and 'set' accessors",
actionDescription: "Generate 'get' and 'set' accessors",
newContent: `class A {
private _a: string;
public get /*RENAME*/a(): string {
return this._a;
}
public set a(value: string) {
this._a = value;
}
}`,
});
| {
"end_byte": 509,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess4.ts"
} |
TypeScript/tests/cases/fourslash/completionsAtTypeArguments.ts_0_243 | /// <reference path="fourslash.ts" />
////interface I {
//// a: string;
//// b: number;
////}
////type T1 = Pick<I, "/*1*/">;
////interface T2 extends Pick<I, "/*2*/"> {}
verify.completions({ marker: ["1", "2"], exact: ["a", "b"] });
| {
"end_byte": 243,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsAtTypeArguments.ts"
} |
TypeScript/tests/cases/fourslash/completionsWithDeprecatedTag3.ts_0_362 | /// <reference path="fourslash.ts" />
/////** @deprecated foo */
////declare function foo<T>();
/////** ok */
////declare function foo<T>(x);
////
////foo/**/
verify.completions({
marker: "",
includes: [{
name: "foo",
kind: "function",
kindModifiers: "declare",
sortText: completion.SortText.LocationPriority
}]
});
| {
"end_byte": 362,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsWithDeprecatedTag3.ts"
} |
TypeScript/tests/cases/fourslash/unusedImports8FS.ts_0_485 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @Filename: file2.ts
//// [|import {Calculator as calc, test as t1, test2 as t2} from "./file1"|]
////
//// var x = new calc();
//// x.handleChar();
//// t1();
// @Filename: file1.ts
//// export class Calculator {
//// handleChar() { }
//// }
//// export function test() {
////
//// }
//// export function test2() {
////
//// }
verify.rangeAfterCodeFix(`import {Calculator as calc, test as t1} from "./file1"`); | {
"end_byte": 485,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedImports8FS.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingCallParentheses15.ts_0_565 | /// <reference path='fourslash.ts'/>
// @strictNullChecks: true
////class Foo {
//// test() {
//// return true;
//// }
//// run() {
//// this.test/**/ && console.log('test');
//// }
////}
verify.codeFixAvailable([
{ description: ts.Diagnostics.Add_missing_call_parentheses.message }
]);
verify.codeFix({
description: ts.Diagnostics.Add_missing_call_parentheses.message,
index: 0,
newFileContent:
`class Foo {
test() {
return true;
}
run() {
this.test() && console.log('test');
}
}`,
});
| {
"end_byte": 565,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingCallParentheses15.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoTemplateTag.ts_0_469 | /// <reference path='fourslash.ts'/>
// @allowJs: true
// @checkJs: true
// @Filename: /foo.js
/////**
//// * Doc
//// * @template {new (...args: any[]) => any} T
//// * @param {T} cls
//// */
////function /**/myMixin(cls) {
//// return class extends cls {}
////}
verify.quickInfoAt("",
`function myMixin<T extends new (...args: any[]) => any>(cls: T): {
new (...args: any[]): (Anonymous class);
prototype: myMixin<any>.(Anonymous class);
} & T`,
"Doc");
| {
"end_byte": 469,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoTemplateTag.ts"
} |
TypeScript/tests/cases/fourslash/completionsObjectLiteralExpressions8.ts_0_946 | /// <reference path="fourslash.ts" />
//// interface A {
//// b: string,
//// c?: number,
//// }
//// const b = ""
//// const a: A = {
//// b
//// /**/
//// }
verify.completions({
marker: "",
includes: [{
name: "c",
sortText: completion.SortText.OptionalMember,
hasAction: true,
source: completion.CompletionSource.ObjectLiteralMemberWithComma,
}],
preferences: {
allowIncompleteCompletions: true,
includeInsertTextCompletions: true,
},
});
verify.applyCodeActionFromCompletion("", {
name: "c",
description: `Add missing comma for object member completion 'c'.`,
source: completion.CompletionSource.ObjectLiteralMemberWithComma,
newFileContent:
`interface A {
b: string,
c?: number,
}
const b = ""
const a: A = {
b,
}`,
preferences: {
allowIncompleteCompletions: true,
includeInsertTextCompletions: true,
},
});
| {
"end_byte": 946,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralExpressions8.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUndeclaredPropertyNumericLiteral.ts_0_300 | /// <reference path='fourslash.ts' />
//// [|class A {
//// constructor() {
//// this.x = 10;
//// }
//// }|]
verify.rangeAfterCodeFix(`
class A {
x: number;
constructor() {
this.x = 10;
}
}
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); | {
"end_byte": 300,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUndeclaredPropertyNumericLiteral.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsFunctions.ts_0_3194 | /// <reference path="fourslash.ts"/>
////function foo() {
//// var x = 10;
//// function bar() {
//// var y = 10;
//// function biz() {
//// var z = 10;
//// }
//// function qux() {
//// // A function with an empty body should not be top level
//// }
//// }
////}
////
////function baz() {
//// var v = 10;
////}
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "baz",
"kind": "function",
"childItems": [
{
"text": "v",
"kind": "var"
}
]
},
{
"text": "foo",
"kind": "function",
"childItems": [
{
"text": "bar",
"kind": "function",
"childItems": [
{
"text": "biz",
"kind": "function",
"childItems": [
{
"text": "z",
"kind": "var"
}
]
},
{
"text": "qux",
"kind": "function"
},
{
"text": "y",
"kind": "var"
}
]
},
{
"text": "x",
"kind": "var"
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "baz",
"kind": "function"
},
{
"text": "foo",
"kind": "function"
}
]
},
{
"text": "baz",
"kind": "function",
"childItems": [
{
"text": "v",
"kind": "var"
}
],
"indent": 1
},
{
"text": "foo",
"kind": "function",
"childItems": [
{
"text": "bar",
"kind": "function"
},
{
"text": "x",
"kind": "var"
}
],
"indent": 1
},
{
"text": "bar",
"kind": "function",
"childItems": [
{
"text": "biz",
"kind": "function"
},
{
"text": "qux",
"kind": "function"
},
{
"text": "y",
"kind": "var"
}
],
"indent": 2
},
{
"text": "biz",
"kind": "function",
"childItems": [
{
"text": "z",
"kind": "var"
}
],
"indent": 3
},
]);
| {
"end_byte": 3194,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsFunctions.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesConstructor.ts_0_478 | /// <reference path='fourslash.ts' />
////class C {
//// [|const/**/ructor|]();
//// [|constructor|](x: number);
//// [|constructor|](y: string, x: number);
//// [|constructor|](a?: any, ...r: any[]) {
//// if (a === undefined && r.length === 0) {
//// return;
//// }
////
//// return;
//// }
////}
////
////class D {
//// constructor(public x: number, public y: number) {
//// }
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 478,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesConstructor.ts"
} |
TypeScript/tests/cases/fourslash/uncommentSelection3.ts_0_536 | // Remove all comments within the selection
//// let var1/* = 1;
//// let var2 [|= 2;
//// let var3 */= 3;|]
////
//// [|let var4/* = 1;
//// let var5 |]= 2;
//// let var6 */= 3;
////
//// [|let var7/* = 1;
//// let var8 = 2;
//// let var9 */= 3;|]
////
//// /*let va[|r10 = 1;*/
//// let var11 = 2;
//// /*let var12|] = 3;*/
verify.uncommentSelection(
`let var1 = 1;
let var2 = 2;
let var3 = 3;
let var4 = 1;
let var5 = 2;
let var6 = 3;
let var7 = 1;
let var8 = 2;
let var9 = 3;
let var10 = 1;
let var11 = 2;
let var12 = 3;`); | {
"end_byte": 536,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/uncommentSelection3.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertImport_useDefault.ts_0_383 | /// <reference path='fourslash.ts' />
// @allowSyntheticDefaultImports: true
/////*a*/import * as m from "m";/*b*/
////m();
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert import",
actionName: "Convert namespace import to named imports",
actionDescription: "Convert namespace import to named imports",
newContent:
`import m from "m";
m();`,
});
| {
"end_byte": 383,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertImport_useDefault.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_Comment.ts_0_485 | /// <reference path='fourslash.ts' />
//// const foo = /*x*/a/*y*/ => {
//// // secret word
//// return a + 1;
//// /*
//// hidden msg
//// */
//// };
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to named function",
actionDescription: "Convert to named function",
newContent: `function foo(a) {
// secret word
return a + 1;
/*
hidden msg
*/
}`,
});
| {
"end_byte": 485,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_Comment.ts"
} |
TypeScript/tests/cases/fourslash/codeFixSpellingCaseSensitive3.ts_0_133 | /// <reference path='fourslash.ts' />
////class Node {}
////let node = new Node();
////[|nodes|]
verify.rangeAfterCodeFix('node');
| {
"end_byte": 133,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpellingCaseSensitive3.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToEsModule_preserveQuotes.ts_0_236 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @target: esnext
// @Filename: /a.js
////const a = require('a'); a;
verify.codeFix({
description: "Convert to ES module",
newFileContent: "import a from 'a'; a;",
});
| {
"end_byte": 236,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToEsModule_preserveQuotes.ts"
} |
TypeScript/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts_0_472 | /// <reference path='fourslash.ts' />
////interface I {
//// [|[|{| "contextRangeIndex": 0 |}property1|]: number;|]
//// property2: string;
////}
////var elems: I[];
////
////for ([|let { [|{| "contextRangeIndex": 2 |}property1|] } of elems|]) {
//// [|property1|]++;
////}
////for ([|let { [|{| "contextRangeIndex": 5 |}property1|]: p2 } of elems|]) {
////}
const [r0Def, r0, r1Def, r1, r2, r3Def, r3] = test.ranges();
verify.baselineRename([r0, r3, r1, r2]);
| {
"end_byte": 472,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoUntypedModuleImport.ts_0_475 | /// <reference path='fourslash.ts' />
// @Filename: node_modules/foo/index.js
//// /*index*/{}
// @Filename: a.ts
////import /*foo*/foo from /*fooModule*/"foo";
/////*fooCall*/foo();
goTo.file("a.ts");
verify.numberOfErrorsInCurrentFile(0);
goTo.marker("fooModule");
verify.quickInfoIs("");
goTo.marker("foo");
verify.quickInfoIs("import foo");
verify.baselineFindAllReferences('foo', 'fooModule', 'fooCall');
verify.baselineGetDefinitionAtPosition("fooModule", "foo");
| {
"end_byte": 475,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoUntypedModuleImport.ts"
} |
TypeScript/tests/cases/fourslash/autoImportPackageJsonImports_capsInPath2.ts_0_363 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /Dev/package.json
//// {
//// "imports": {
//// "#thing/*": "./src/*.js"
//// }
//// }
// @Filename: /Dev/src/something.ts
//// export function something(name: string): any;
// @Filename: /Dev/a.ts
//// something/**/
verify.importFixModuleSpecifiers("", ["#thing/something"]);
| {
"end_byte": 363,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportPackageJsonImports_capsInPath2.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationDebugger.ts_0_177 | /// <reference path='fourslash.ts' />
// @BaselineFile: bpSpan_debugger.baseline
// @Filename: bpSpan_debugger.ts
////debugger;
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 177,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDebugger.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_shorthandPropertyAssignment2.ts_0_239 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////const a = 1;
////export default a;
// @Filename: /b.ts
////const b = { /**/a };
goTo.file("/b.ts");
verify.importFixAtPosition([
`import a from "./a";
const b = { a };`
]);
| {
"end_byte": 239,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_shorthandPropertyAssignment2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_destructure_partlyUnused.ts_0_923 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
////{
//// const { x, y } = o;
//// x;
////}
////{
//// const { x, y } = o;
//// y;
////}
////{
//// const { x, y, z } = o;
//// y;
////}
////{
//// const { x, y, z } = o;
//// x; z;
////}
////{
//// const [x, y] = o;
//// x;
////}
////{
//// const [x, y] = o;
//// y;
////}
////{
//// const [x, y, z] = o;
//// y;
////}
////{
//// const [x, y, z] = o;
//// x; z;
////}
verify.codeFixAll({
fixId: "unusedIdentifier_delete",
fixAllDescription: ts.Diagnostics.Delete_all_unused_declarations.message,
newFileContent:
`{
const { x } = o;
x;
}
{
const { y } = o;
y;
}
{
const { y } = o;
y;
}
{
const { x, z } = o;
x; z;
}
{
const [x, y] = o;
x;
}
{
const [x, y] = o;
y;
}
{
const [x, y, z] = o;
y;
}
{
const [x, y, z] = o;
x; z;
}`,
});
| {
"end_byte": 923,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_destructure_partlyUnused.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_impossibleImport.ts_0_712 | /// <reference path='fourslash.ts' />
// @module: nodenext
// @Filename: /bar.cts
////const a = 2;
// @Filename: /node_modules/esm-only/package.json
//// {
//// "name": "esm-only",
//// "version": "1.0.0",
//// "type": "module",
//// "exports": {
//// ".": {
//// "import": "./index.js"
//// }
//// }
//// }
// @Filename: /node_modules/esm-only/index.d.ts
//// export declare const esm: any;
// @Filename: /main.mts
//// import { esm } from "esm-only";
//// [|esm.ohno;|]
verify.moveToFile({
newFileContents: {
"/main.mts":``,
"/bar.cts":
`const a = 2;
esm.ohno;
`,
},
interactiveRefactorArguments: { targetFile: "/bar.cts" }
}); | {
"end_byte": 712,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_impossibleImport.ts"
} |
TypeScript/tests/cases/fourslash/incrementalUpdateToClassImplementingGenericClass.ts_0_518 | /// <reference path="fourslash.ts" />
////declare function alert(message?: string): void;
////class Animal<T> {
//// constructor(public name: T) { }
//// move(meters: number) {
//// alert(this.name + " moved " + meters + "m.");
//// }
////}
////class Animal2 extends Animal<string> {
//// constructor(name: string) { super(name); }
//// /*1*/get name2() { return this.name; }
////}
////var a = new Animal2('eprst');
goTo.marker('1');
verify.noErrors();
edit.insert("//");
verify.noErrors();
| {
"end_byte": 518,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/incrementalUpdateToClassImplementingGenericClass.ts"
} |
TypeScript/tests/cases/fourslash/getImportsReexport.ts_0_277 | ///<reference path="fourslash.ts"/>
// @Filename: /first.ts
//// export function foo() {
//// return 1;
//// }
// @Filename: /index.ts
//// export { foo } from "./first";
//// function bar() {
//// return 2;
//// }
////
verify.getImports('/index.ts', ['/first.ts'])
| {
"end_byte": 277,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getImportsReexport.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.