_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/fourslash/server/autoImportCrossProject_symlinks_toSrc.ts_0_1266
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/packages/app/package.json //// { "name": "app", "dependencies": { "dep": "*" } } // @Filename: /home/src/workspaces/project/packages/app/tsconfig.json //// { //// "compilerOptions": { //// "module": "commonjs", //// "outDir": "dist", //// "rootDir": "src", //// "baseUrl": "." //// } //// "references": [{ "path": "../dep" }] //// } // @Filename: /home/src/workspaces/project/packages/app/src/index.ts //// dep/**/ // @Filename: /home/src/workspaces/project/packages/dep/package.json //// { "name": "dep", "main": "dist/index.js", "types": "dist/index.d.ts" } // @Filename: /home/src/workspaces/project/packages/dep/tsconfig.json //// { //// "compilerOptions": { "outDir": "dist", "rootDir": "src", "module": "commonjs" } //// } // @Filename: /home/src/workspaces/project/packages/dep/src/index.ts //// import "./sub/folder"; // @Filename: /home/src/workspaces/project/packages/dep/src/sub/folder/index.ts //// export const dep = 0; // @link: /home/src/workspaces/project/packages/dep -> /home/src/workspaces/project/packages/app/node_modules/dep goTo.marker(""); verify.importFixAtPosition([`import { dep } from "dep/src/sub/folder";\r \r dep`]);
{ "end_byte": 1266, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportCrossProject_symlinks_toSrc.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_importsMap3.ts_0_644
/// <reference path="../fourslash.ts"/> // @Filename: /home/src/workspaces/project/tsconfig.json //// { //// "compilerOptions": { //// "module": "nodenext", //// "rootDir": "src", //// "outDir": "dist" //// } //// } // @Filename: /home/src/workspaces/project/package.json //// { //// "type": "module", //// "imports": { //// "#internal/": "./dist/internal/" //// } //// } // @Filename: /home/src/workspaces/project/src/internal/foo.ts //// export function something(name: string) {} // @Filename: /home/src/workspaces/project/src/a.ts //// something/**/ verify.importFixModuleSpecifiers("", ["#internal/foo.js"]);
{ "end_byte": 644, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_importsMap3.ts" }
TypeScript/tests/cases/fourslash/server/importSuggestionsCache_invalidPackageJson.ts_0_862
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/jsconfig.json ////{ //// "compilerOptions": { //// "module": "commonjs", //// }, ////} // @Filename: /home/src/workspaces/project/node_modules/@types/node/index.d.ts ////declare module 'fs' { //// export function readFile(): void; ////} ////declare module 'util' { //// export function promisify(): void; ////} // @Filename: /home/src/workspaces/project/package.json ////{ "mod" } // @Filename: /home/src/workspaces/project/a.js //// ////readF/**/ goTo.marker(""); verify.completions({ includes: { name: "readFile", source: "fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }, preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, }, });
{ "end_byte": 862, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/importSuggestionsCache_invalidPackageJson.ts" }
TypeScript/tests/cases/fourslash/server/referencesInConfiguredProject.ts_0_471
/// <reference path="../fourslash.ts"/> // Global class reference. // @Filename: /home/src/workspaces/project/referencesForGlobals_1.ts ////class /*0*/globalClass { //// public f() { } ////} // @Filename: /home/src/workspaces/project/referencesForGlobals_2.ts ////var c = /*1*/globalClass(); // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["referencesForGlobals_1.ts", "referencesForGlobals_2.ts"] } verify.baselineFindAllReferences('1')
{ "end_byte": 471, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/referencesInConfiguredProject.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_multiplePastesShrinkingInSize.ts_0_1723
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/a.ts //// function foo() { //// [|console.log("Good day");|] //// } //// function too() { //// function k(t: string) { //// [|console.log("Happy Holidays");|] //// } //// } //// class bar { //// constructor() { //// function a() { //// [| console.log("hello");|] //// } //// a(); //// } //// c() { //// console.log("hello again"); //// function k[|() { //// const happy = banana + avocados; //// }|] //// } //// } // @Filename: /home/src/workspaces/project/b.ts //// export const juices = 1; //// export const sauce = 2; // @Filename: /home/src/workspaces/project/c.ts //// export const figs = 3; //// export const tomato = 4; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["a.ts", "b.ts", "c.ts"] } verify.pasteEdits({ args: { pastedText: [ `console.log("Good ");`,`const k = figs + juices;`, ` console.log(tomato);`, `(kiwi: string) { const cherry=tomato; }` ], pasteLocations: test.ranges(), }, newFileContents: { "/home/src/workspaces/project/a.ts": `import { juices } from "./b"; import { figs, tomato } from "./c"; function foo() { console.log("Good "); } function too() { function k(t: string) { const k = figs + juices; } } class bar { constructor() { function a() { console.log(tomato); } a(); } c() { console.log("hello again"); function k(kiwi: string) { const cherry=tomato; } } }` } });
{ "end_byte": 1723, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_multiplePastesShrinkingInSize.ts" }
TypeScript/tests/cases/fourslash/server/ngProxy1.ts_0_399
/// <reference path="../fourslash.ts"/> // @Filename: tsconfig.json //// { //// "compilerOptions": { //// "plugins": [ //// { "name": "quickinfo-augmeneter", "message": "hello world" } //// ] //// }, //// "files": ["a.ts"] //// } // @Filename: a.ts //// let x = [1, 2]; //// x/**/ //// goTo.marker(); verify.quickInfoIs('Proxied x: number[]hello world');
{ "end_byte": 399, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/ngProxy1.ts" }
TypeScript/tests/cases/fourslash/server/semanticClassificationJs1.ts_0_282
/// <reference path="../fourslash.ts"/> //// @Filename: index.js //// //// var Thing = 0; //// Thing.toExponential(); // This test validates that an arbitrary JS file gets // encoded semantic classifications when requested verify.encodedSemanticClassificationsLength("2020", 9)
{ "end_byte": 282, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/semanticClassificationJs1.ts" }
TypeScript/tests/cases/fourslash/server/importStatementCompletions_pnpmTransitive.ts_0_1247
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "commonjs" } } // @Filename: /home/src/workspaces/project/node_modules/.pnpm/@types+react@17.0.7/node_modules/@types/react/index.d.ts //// import "csstype"; //// export declare function Component(): void; // @Filename: /home/src/workspaces/project/node_modules/.pnpm/csstype@3.0.8/node_modules/csstype/index.d.ts //// export interface SvgProperties {} // @Filename: /home/src/workspaces/project/index.ts //// [|import SvgProp/**/|] // @link: /home/src/workspaces/project/node_modules/.pnpm/@types+react@17.0.7/node_modules/@types/react -> /home/src/workspaces/project/node_modules/@types/react // @link: /home/src/workspaces/project/node_modules/.pnpm/csstype@3.0.8/node_modules/csstype -> /home/src/workspaces/project/node_modules/.pnpm/@types+react@17.0.7/node_modules/csstype goTo.marker(""); verify.completions({ isNewIdentifierLocation: true, marker: "", exact: [{ name: "type", sortText: completion.SortText.GlobalsOrKeywords }], preferences: { includeCompletionsForImportStatements: true, includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: true, } });
{ "end_byte": 1247, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/importStatementCompletions_pnpmTransitive.ts" }
TypeScript/tests/cases/fourslash/server/openFileWithSyntaxKind.ts_0_467
/// <reference path="../fourslash.ts"/> // Because the fourslash runner automatically opens the first file with the default setting, // to test the openFile function, the targeted file cannot be the first one. // @Filename: dumbFile.ts //// var x; // @allowJs: true // @Filename: test.ts //// /** //// * @type {number} //// */ //// var t; //// t. goTo.file("test.ts", /*content*/ undefined, "JS"); goTo.eof(); verify.completions({ includes: "toExponential" });
{ "end_byte": 467, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/openFileWithSyntaxKind.ts" }
TypeScript/tests/cases/fourslash/server/occurrences02.ts_0_145
/// <reference path="../fourslash.ts"/> ////function [|f|](x: typeof [|f|]) { //// [|f|]([|f|]); ////} verify.baselineDocumentHighlights();
{ "end_byte": 145, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/occurrences02.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_pasteIntoSameFile.ts_0_537
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/target.ts //// const k = 1; //// [|console.log(k);|] //// //// [||] //// console.log("test"); // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["target.ts"] } const ranges = test.ranges(); verify.pasteEdits({ args: { pastedText: [ `console.log(k);`], pasteLocations: [ranges[1]], copiedFrom: { file: "/home/src/workspaces/project/target.ts", range: [ranges[0]] }, }, newFileContents: {} });
{ "end_byte": 537, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_pasteIntoSameFile.ts" }
TypeScript/tests/cases/fourslash/server/quickinfoWrongComment.ts_0_470
/// <reference path="../fourslash.ts"/> //// interface I { //// /** The colour */ //// readonly colour: string //// } //// interface A extends I { //// readonly colour: "red" | "green"; //// } //// interface B extends I { //// readonly colour: "yellow" | "green"; //// } //// type F = A | B //// const f: F = { colour: "green" } //// f.colour/*1*/ goTo.marker("1") verify.quickInfoIs("(property) colour: \"red\" | \"green\" | \"yellow\"", "The colour")
{ "end_byte": 470, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/quickinfoWrongComment.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_multiplePastesGrowingAndShrinkingInSize.ts_0_1633
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/a.ts //// function foo() { //// console.[|log("Hello");|] //// } //// class bar { //// [|constru|]ctor() { //// function a() { //// console.log("hii"); //// } //// a(); //// function b() { //// function c() { //// [|console.log("hola");|] //// } //// } //// b(); //// } //// c() { //// console.log("hello again"); //// [||] //// } //// } // @Filename: /home/src/workspaces/project/b.ts //// export const juice = 1; //// export const sauce = 2; //// export const tomato = 3; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["a.ts", "b.ts"] } verify.pasteEdits({ args: { pastedText: [ `log(sauce);`,`const apple = 1 + juice`, `const kiwi = 1;`, `function k() { const cherry = 3 + tomato + cucumber; }` ], pasteLocations: test.ranges(), }, newFileContents: { "/home/src/workspaces/project/a.ts": `import { sauce, tomato } from "./b"; function foo() { console.log(sauce); } class bar { const apple = 1 + juicector() { function a() { console.log("hii"); } a(); function b() { function c() { const kiwi = 1; } } b(); } c() { console.log("hello again"); function k() { const cherry = 3 + tomato + cucumber; } } }` } });
{ "end_byte": 1633, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_multiplePastesGrowingAndShrinkingInSize.ts" }
TypeScript/tests/cases/fourslash/server/typedefinition01.ts_0_201
/// <reference path="../fourslash.ts"/> // @Filename: b.ts ////import n = require('./a'); ////var x/*1*/ = new n.Foo(); // @Filename: a.ts ////export class /*2*/Foo {} verify.baselineGoToType("1");
{ "end_byte": 201, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/typedefinition01.ts" }
TypeScript/tests/cases/fourslash/server/importNameCodeFix_externalNonRelateive2.ts_0_1421
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/apps/app1/tsconfig.json //// { //// "compilerOptions": { //// "module": "commonjs", //// "paths": { //// "shared/*": ["../../shared/*"] //// } //// }, //// "include": ["src", "../../shared"] //// } // @Filename: /home/src/workspaces/project/apps/app1/src/index.ts //// shared/*internal2external*/ // @Filename: /home/src/workspaces/project/apps/app1/src/app.ts //// utils/*internal2internal*/ // @Filename: /home/src/workspaces/project/apps/app1/src/utils.ts //// export const utils = 0; // @Filename: /home/src/workspaces/project/shared/constants.ts //// export const shared = 0; // @Filename: /home/src/workspaces/project/shared/data.ts //// shared/*external2external*/ format.setOption("newline", "\n"); goTo.marker("internal2external"); verify.importFixAtPosition([`import { shared } from "shared/constants";\n\nshared`], /*errorCode*/ undefined, { importModuleSpecifierPreference: "project-relative" }); goTo.marker("internal2internal"); verify.importFixAtPosition([`import { utils } from "./utils";\n\nutils`], /*errorCode*/ undefined, { importModuleSpecifierPreference: "project-relative" }); goTo.marker("external2external"); verify.importFixAtPosition([`import { shared } from "./constants";\n\nshared`], /*errorCode*/ undefined, { importModuleSpecifierPreference: "project-relative" });
{ "end_byte": 1421, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/importNameCodeFix_externalNonRelateive2.ts" }
TypeScript/tests/cases/fourslash/server/completionsServerCommitCharacters.ts_0_164
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/src/index.ts //// const a: "aa" | "bb" = "/**/"; verify.baselineCompletions();
{ "end_byte": 164, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completionsServerCommitCharacters.ts" }
TypeScript/tests/cases/fourslash/server/autoImportCrossPackage_pathsAndSymlink.ts_0_1098
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/packages/common/package.json //// { //// "name": "@company/common", //// "version": "1.0.0", //// "main": "./lib/index.tsx" //// } // @Filename: /home/src/workspaces/project/packages/common/lib/index.tsx //// export function Tooltip {}; // @Filename: /home/src/workspaces/project/packages/app/package.json //// { //// "name": "@company/app", //// "version": "1.0.0", //// "dependencies": { //// "@company/common": "1.0.0" //// } //// } // @Filename: /home/src/workspaces/project/packages/app/tsconfig.json //// { //// "compilerOptions": { //// "composite": true, //// "module": "esnext", //// "moduleResolution": "bundler", //// "paths": { //// "@/*": ["./*"] //// } //// } //// } // @Filename: /home/src/workspaces/project/packages/app/lib/index.ts //// Tooltip/**/ // @link: /home/src/workspaces/project/packages/common -> /home/src/workspaces/project/node_modules/@company/common goTo.marker(""); verify.importFixModuleSpecifiers("", ["@company/common"]);
{ "end_byte": 1098, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportCrossPackage_pathsAndSymlink.ts" }
TypeScript/tests/cases/fourslash/server/autoImportReExportFromAmbientModule.ts_0_1373
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { //// "compilerOptions": { //// "module": "commonjs" //// } //// } // @Filename: /home/src/workspaces/project/node_modules/@types/node/index.d.ts //// declare module "fs" { //// export function accessSync(path: string): void; //// } // @Filename: /home/src/workspaces/project/node_modules/@types/fs-extra/index.d.ts //// export * from "fs"; // @Filename: /home/src/workspaces/project/index.ts //// access/**/ verify.completions({ marker: "", includes: [{ name: "accessSync", source: "fs", sourceDisplay: "fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, { name: "accessSync", source: "fs-extra", sourceDisplay: "fs-extra", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }], preferences: { includeCompletionsForModuleExports: true, allowIncompleteCompletions: true } }); verify.applyCodeActionFromCompletion("", { name: "accessSync", source: "fs-extra", description: `Add import from "fs-extra"`, newFileContent: `import { accessSync } from "fs-extra";\r\n\r\naccess`, data: { exportName: "accessSync", fileName: "/home/src/workspaces/project/node_modules/@types/fs-extra/index.d.ts", moduleSpecifier: "fs-extra", } });
{ "end_byte": 1373, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportReExportFromAmbientModule.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_multiplePastesEqualInSize.ts_0_1750
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/a.ts //// function foo() { //// [|console.log("yes");|] //// } //// class bar { //// constructor() { //// function a() { //// [|console.log("have a good day");|] //// } //// a(); //// function b() { //// function c() { //// const test = [|1 + 2|] + 3; //// } //// } //// b(); //// } //// c() { //// console.log("hello again"); //// [|function k() { //// const happy = 1 + banana + avocados; //// }|] //// } //// } // @Filename: /home/src/workspaces/project/b.ts //// export const juice = 1; //// export const sauce = 2; //// export const apple = 3; //// export const tomato = 4; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["a.ts", "b.ts"] } verify.pasteEdits({ args: { pastedText: [ `console.log(juice);`,`function kl() { return sauce; }`, `apple`, `function k() { const cherry = 3 + tomato + cucumber; }` ], pasteLocations: test.ranges(), }, newFileContents: { "/home/src/workspaces/project/a.ts": `import { juice, sauce, tomato } from "./b"; function foo() { console.log(juice); } class bar { constructor() { function a() { function kl() { return sauce; } } a(); function b() { function c() { const test = apple + 3; } } b(); } c() { console.log("hello again"); function k() { const cherry = 3 + tomato + cucumber; } } }` } });
{ "end_byte": 1750, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_multiplePastesEqualInSize.ts" }
TypeScript/tests/cases/fourslash/server/goToSource3_nodeModulesAtTypes.ts_0_740
/// <reference path="../fourslash.ts" /> // @moduleResolution: node // @Filename: /home/src/workspaces/project/node_modules/foo/package.json //// { "name": "foo", "version": "1.0.0", "main": "./lib/main.js" } // @Filename: /home/src/workspaces/project/node_modules/foo/lib/main.js //// export const /*end*/a = "a"; // @Filename: /home/src/workspaces/project/node_modules/@types/foo/package.json //// { "name": "@types/foo", "version": "1.0.0", "types": "./index.d.ts" } // @Filename: /home/src/workspaces/project/node_modules/@types/foo/index.d.ts //// export declare const a: string; // @Filename: /home/src/workspaces/project/index.ts //// import { a } from "foo"; //// [|a/*start*/|] verify.baselineGoToSourceDefinition("start");
{ "end_byte": 740, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource3_nodeModulesAtTypes.ts" }
TypeScript/tests/cases/fourslash/server/nonJsDeclarationFilePathCompletions.ts_0_499
/// <reference path="../fourslash.ts" /> // @allowArbitraryExtensions: true // @Filename: /home/src/workspaces/project/mod.d.html.ts ////export declare class HtmlModuleThing {} // @Filename: /home/src/workspaces/project/node_modules/package/mod.d.html.ts ////export declare class PackageHtmlModuleThing {} // @Filename: /home/src/workspaces/project/usage.ts ////import { HtmlModuleThing } from ".//*1*/"; ////import { PackageHtmlModuleThing } from "package//*2*/"; verify.baselineCompletions();
{ "end_byte": 499, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/nonJsDeclarationFilePathCompletions.ts" }
TypeScript/tests/cases/fourslash/server/autoImportCrossProject_paths_sharedOutDir.ts_0_1202
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.base.json //// { //// "compilerOptions": { //// "module": "commonjs", //// "baseUrl": ".", //// "paths": { //// "packages/*": ["./packages/*"] //// } //// } //// } // @Filename: /home/src/workspaces/project/packages/app/tsconfig.json //// { //// "extends": "../../tsconfig.base.json", //// "compilerOptions": { "outDir": "../../dist/packages/app" }, //// "references": [{ "path": "../dep" }] //// } // @Filename: /home/src/workspaces/project/packages/app/index.ts //// dep/**/ // @Filename: /home/src/workspaces/project/packages/app/utils.ts //// import "packages/dep"; // @Filename: /home/src/workspaces/project/packages/dep/tsconfig.json //// { //// "extends": "../../tsconfig.base.json", //// "compilerOptions": { "outDir": "../../dist/packages/dep" } //// } // @Filename: /home/src/workspaces/project/packages/dep/index.ts //// import "./sub/folder"; // @Filename: /home/src/workspaces/project/packages/dep/sub/folder/index.ts //// export const dep = 0; goTo.marker(""); verify.importFixAtPosition([`import { dep } from "packages/dep/sub/folder";\r \r dep`]);
{ "end_byte": 1202, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportCrossProject_paths_sharedOutDir.ts" }
TypeScript/tests/cases/fourslash/server/navto01.ts_0_1044
/// <reference path="../fourslash.ts"/> /////// Module ////[|{| "name": "MyShapes", "kind": "module" |}module MyShapes { //// //// // Class //// [|{| "name": "MyPoint", "kind": "class", "kindModifiers": "export", "containerName": "MyShapes", "containerKind": "module" |}export class MyPoint { //// // Instance member //// [|{| "name": "MyoriginAttheHorizon", "kind": "property", "kindModifiers": "private", "containerName": "MyPoint", "containerKind": "class" |}private MyoriginAttheHorizon = 0.0;|] //// //// // Getter //// [|{| "name": "MydistanceFromOrigin", "kind": "getter", "containerName": "MyPoint", "containerKind": "class" |}get MydistanceFromOrigin(): number { return 0; }|] //// }|] ////}|] //// ////// Local variables ////var [|{| "name": "myXyz", "kind": "var" |}myXyz = new Shapes.Point()|]; for (const range of test.ranges()) { verify.navigateTo({ pattern: range.marker.data.name.slice(2), expected: [{ ...range.marker.data, range, matchKind: "substring" }], }); }
{ "end_byte": 1044, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/navto01.ts" }
TypeScript/tests/cases/fourslash/server/rewriteRelativeImportExtensionsProjectReferences2.ts_0_917
/// <reference path="../fourslash.ts" /> // @Filename: src/tsconfig-base.json //// { //// "compilerOptions": { //// "module": "nodenext", //// "composite": true, //// "rootDir": ".", //// "outDir": "../dist", //// "rewriteRelativeImportExtensions": true, //// } //// } // @Filename: src/compiler/tsconfig.json //// { //// "extends": "../tsconfig-base.json", //// "compilerOptions": {} //// } // @Filename: src/compiler/parser.ts //// export {}; // @Filename: src/services/tsconfig.json //// { //// "extends": "../tsconfig-base.json", //// "compilerOptions": {}, //// "references": [ //// { "path": "../compiler" } //// ] //// } // @Filename: src/services/services.ts //// import {} from "../compiler/parser.ts"; goTo.file("/tests/cases/fourslash/server/src/services/services.ts"); verify.baselineSyntacticAndSemanticDiagnostics();
{ "end_byte": 917, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/rewriteRelativeImportExtensionsProjectReferences2.ts" }
TypeScript/tests/cases/fourslash/server/completionsImport_jsModuleExportsAssignment.ts_0_1637
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "commonjs", "allowJs": true } } // @Filename: /home/src/workspaces/project/third_party/marked/src/defaults.js //// function getDefaults() { //// return { //// baseUrl: null, //// }; //// } //// //// function changeDefaults(newDefaults) { //// module.exports.defaults = newDefaults; //// } //// //// module.exports = { //// defaults: getDefaults(), //// getDefaults, //// changeDefaults //// }; // @Filename: /home/src/workspaces/project/index.ts //// /**/ format.setOption("newLineCharacter", "\n") goTo.marker(""); // Create the exportInfoMap verify.completions({ marker: "", preferences: { includeCompletionsForModuleExports: true } }); // Create a new program and reuse the exportInfoMap from the last request edit.insert("d"); verify.completions({ marker: "", excludes: ["newDefaults"], includes: [{ name: "defaults", source: "/home/src/workspaces/project/third_party/marked/src/defaults", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }], preferences: { includeCompletionsForModuleExports: true } }); verify.applyCodeActionFromCompletion("", { name: "defaults", source: "/home/src/workspaces/project/third_party/marked/src/defaults", description: `Add import from "./third_party/marked/src/defaults"`, data: { exportName: "defaults", fileName: "/home/src/workspaces/project/third_party/marked/src/defaults.js", }, newFileContent: `import { defaults } from "./third_party/marked/src/defaults"; d` });
{ "end_byte": 1637, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completionsImport_jsModuleExportsAssignment.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider4.ts_0_868
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/a/package.json //// { "dependencies": { "b": "*" } } // @Filename: /home/src/workspaces/project/a/tsconfig.json //// { "compilerOptions": { "module": "commonjs", "target": "esnext" }, "references": [{ "path": "../b" }] } // @Filename: /home/src/workspaces/project/a/index.ts //// new Shape/**/ // @Filename: /home/src/workspaces/project/b/package.json //// { "types": "out/index.d.ts" } // @Filename: /home/src/workspaces/project/b/tsconfig.json //// { "compilerOptions": { "outDir": "out", "composite": true } } // @Filename: /home/src/workspaces/project/b/index.ts //// export class Shape {} // @link: /home/src/workspaces/project/b -> /home/src/workspaces/project/a/node_modules/b goTo.marker(); verify.importFixAtPosition([`import { Shape } from "b";\r\n\r\nnew Shape`]);
{ "end_byte": 868, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider4.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_pnpm.ts_0_849
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "commonjs" } } // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "mobx": "*" } } // @Filename: /home/src/workspaces/project/node_modules/.pnpm/mobx@6.0.4/node_modules/mobx/package.json //// { "types": "dist/mobx.d.ts" } // @Filename: /home/src/workspaces/project/node_modules/.pnpm/mobx@6.0.4/node_modules/mobx/dist/mobx.d.ts //// export declare function autorun(): void; // @Filename: /home/src/workspaces/project/index.ts //// autorun/**/ // @link: /home/src/workspaces/project/node_modules/.pnpm/mobx@6.0.4/node_modules/mobx -> /home/src/workspaces/project/node_modules/mobx goTo.marker(""); verify.importFixAtPosition([`import { autorun } from "mobx";\r\n\r\nautorun`]);
{ "end_byte": 849, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_pnpm.ts" }
TypeScript/tests/cases/fourslash/server/documentHighlightsTypeParameterInHeritageClause01.ts_0_134
/// <reference path="../fourslash.ts" /> ////interface I<[|T|]> extends I<[|T|]>, [|T|] { ////} verify.baselineDocumentHighlights();
{ "end_byte": 134, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/documentHighlightsTypeParameterInHeritageClause01.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_revertUpdatedFile.ts_0_894
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/target.ts //// import { t } from "./other"; //// const a = t + 1; //// [|const b = 10;|] //// type T = number; //// var x; //// var y = x as /*1*/ // @Filename: /home/src/workspaces/project/other.ts //// export const t = 1; // @Filename: /home/src/workspaces/project/other2.ts //// export const t2 = 1; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["target.ts", "other.ts", "other2.ts"] } verify.pasteEdits({ args: { pastedText: [ `const m = t2 + 1;`], pasteLocations: test.ranges(), }, newFileContents: { "/home/src/workspaces/project/target.ts": `import { t } from "./other"; import { t2 } from "./other2"; const a = t + 1; const m = t2 + 1; type T = number; var x; var y = x as ` } }); verify.completions({ marker: "1", includes: "T" });
{ "end_byte": 894, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_revertUpdatedFile.ts" }
TypeScript/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts_0_754
/// <reference path="../fourslash.ts"/> // @allowNonTsExtensions: true // @Filename: a.js //// /** //// * Modify the parameter //// * @param {string} p1 //// */ //// var foo = function (p1) { } //// module.exports.foo = foo; //// fo/*1*/ // @Filename: b.ts //// import a = require("./a"); //// a.fo/*2*/ verify.completions( { marker: "1", includes: { name: "foo", text: "var foo: (p1: string) => void", documentation: "Modify the parameter", tags: [{ name: "param", text: "p1" }] } }, { marker: "2", exact: { name: "foo", text: "(alias) var foo: (p1: string) => void\nimport a.foo", documentation: "Modify the parameter", tags: [{ name: "param", text: "p1" }] } }, );
{ "end_byte": 754, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts" }
TypeScript/tests/cases/fourslash/server/goToSource17_AddsFileToProject.ts_0_1635
/// <reference path="../fourslash.ts" /> // @moduleResolution: node // This is just made up repro where the js file will be added to auxillary project because its not already part of the project // Where in js file doesnt already have import to the corresponding js file hence will be added to project at later on stage // @Filename: /home/src/workspaces/project/node_modules/@types/yargs/package.json //// { //// "name": "@types/yargs", //// "version": "1.0.0", //// "types": "./index.d.ts" //// } // @Filename: /home/src/workspaces/project/node_modules/@types/yargs/callback.d.ts //// export declare class Yargs { positional(): Yargs; } // @Filename: /home/src/workspaces/project/node_modules/@types/yargs/index.d.ts //// import { Yargs } from "./callback"; //// export declare function command(command: string, cb: (yargs: Yargs) => void): void; // @Filename: /home/src/workspaces/project/node_modules/yargs/package.json //// { //// "name": "yargs", //// "version": "1.0.0", //// "main": "index.js" //// } // @Filename: /home/src/workspaces/project/node_modules/yargs/callback.js //// export class Yargs { positional() { } } // @Filename: /home/src/workspaces/project/node_modules/yargs/index.js //// // Specifically didnt have ./callback import to ensure that resolving module sepcifier adds the file to project at later stage //// export function command(cmd, cb) { cb(Yargs) } // @Filename: /home/src/workspaces/project/index.ts //// import { command } from "yargs"; //// command("foo", yargs => { //// yargs.[|/*start*/positional|](); //// }); verify.baselineGoToSourceDefinition("start");
{ "end_byte": 1635, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource17_AddsFileToProject.ts" }
TypeScript/tests/cases/fourslash/server/completionsImport_mergedReExport.ts_0_1636
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "commonjs" } } // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "@jest/types": "*", "ts-jest": "*" } } // @Filename: /home/src/workspaces/project/node_modules/@jest/types/package.json //// { "name": "@jest/types" } // @Filename: /home/src/workspaces/project/node_modules/@jest/types/index.d.ts //// import type * as Config from "./Config"; //// export type { Config }; // @Filename: /home/src/workspaces/project/node_modules/@jest/types/Config.d.ts //// export interface ConfigGlobals { //// [K: string]: unknown; //// } // @Filename: /home/src/workspaces/project/node_modules/ts-jest/index.d.ts //// export {}; //// declare module "@jest/types" { //// namespace Config { //// interface ConfigGlobals { //// 'ts-jest': any; //// } //// } //// } // @Filename: /home/src/workspaces/project/index.ts //// C/**/ verify.completions({ marker: "", includes: [{ name: "Config", source: "/home/src/workspaces/project/node_modules/@jest/types/index", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }], preferences: { includeCompletionsForModuleExports: true, }, }); edit.insert("o"); verify.completions({ marker: "", includes: [{ name: "Config", source: "@jest/types", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }], preferences: { includeCompletionsForModuleExports: true, allowIncompleteCompletions: true, }, });
{ "end_byte": 1636, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completionsImport_mergedReExport.ts" }
TypeScript/tests/cases/fourslash/server/implementation01.ts_0_145
/// <reference path="../fourslash.ts"/> ////interface Fo/*1*/o {} ////class /*2*/Bar implements Foo {} verify.baselineGoToImplementation('1');
{ "end_byte": 145, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/implementation01.ts" }
TypeScript/tests/cases/fourslash/server/renameInConfiguredProject.ts_0_435
/// <reference path="../fourslash.ts"/> // @Filename: referencesForGlobals_1.ts ////[|var [|{| "contextRangeIndex": 0 |}globalName|] = 0;|] // @Filename: referencesForGlobals_2.ts ////var y = [|globalName|]; // @Filename: tsconfig.json ////{ "files": ["referencesForGlobals_1.ts", "referencesForGlobals_2.ts"] } const [rDef, ...ranges] = test.ranges(); verify.baselineRename(ranges, { findInStrings: true, findInComments: true });
{ "end_byte": 435, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/renameInConfiguredProject.ts" }
TypeScript/tests/cases/fourslash/server/autoImportFileExcludePatterns1.ts_0_919
/// <reference path="../fourslash.ts"/> // @module: commonjs // @Filename: /home/src/workspaces/project/node_modules/aws-sdk/package.json //// { "name": "aws-sdk", "version": "2.0.0", "main": "index.js" } // @Filename: /home/src/workspaces/project/node_modules/aws-sdk/index.d.ts //// export * from "./clients/s3"; // @Filename: /home/src/workspaces/project/node_modules/aws-sdk/clients/s3.d.ts //// export declare class S3 {} // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "aws-sdk": "*" } } // @Filename: /home/src/workspaces/project/index.ts //// S3/**/ const autoImportFileExcludePatterns = ["/**/node_modules/aws-sdk"]; verify.completions({ marker: "", excludes: "S3", preferences: { includeCompletionsForModuleExports: true, autoImportFileExcludePatterns, } }); verify.importFixAtPosition([], /*errorCode*/ undefined, { autoImportFileExcludePatterns });
{ "end_byte": 919, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportFileExcludePatterns1.ts" }
TypeScript/tests/cases/fourslash/server/rewriteRelativeImportExtensionsProjectReferences3.ts_0_1013
/// <reference path="../fourslash.ts" /> // @Filename: src/tsconfig-base.json //// { //// "compilerOptions": { //// "module": "nodenext", //// "composite": true, //// "rewriteRelativeImportExtensions": true, //// } //// } // @Filename: src/compiler/tsconfig.json //// { //// "extends": "../tsconfig-base.json", //// "compilerOptions": { //// "rootDir": ".", //// "outDir": "../../dist/compiler", //// } // @Filename: src/compiler/parser.ts //// export {}; // @Filename: src/services/tsconfig.json //// { //// "extends": "../tsconfig-base.json", //// "compilerOptions": { //// "rootDir": ".", //// "outDir": "../../dist/services", //// }, //// "references": [ //// { "path": "../compiler" } //// ] //// } // @Filename: src/services/services.ts //// import {} from "../compiler/parser.ts"; goTo.file("/tests/cases/fourslash/server/src/services/services.ts"); verify.baselineSyntacticAndSemanticDiagnostics();
{ "end_byte": 1013, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/rewriteRelativeImportExtensionsProjectReferences3.ts" }
TypeScript/tests/cases/fourslash/server/isDefinitionAcrossGlobalProjects.ts_0_1952
/// <reference path="../fourslash.ts"/> // @Filename: /home/src/workspaces/project/a/index.ts ////namespace NS { //// export function /*1*/FA() { //// FB(); //// } ////} //// ////interface /*2*/I { //// /*3*/FA(); ////} //// ////const ia: I = { //// FA() { }, //// FB() { }, //// FC() { }, //// }; // @Filename: /home/src/workspaces/project/a/tsconfig.json ////{ //// "extends": "../tsconfig.settings.json", //// "references": [ //// { "path": "../b" }, //// { "path": "../c" }, //// ], //// "files": [ //// "index.ts", //// ], ////} // @Filename: /home/src/workspaces/project/b/index.ts ////namespace NS { //// export function /*4*/FB() {} ////} //// ////interface /*5*/I { //// /*6*/FB(); ////} //// ////const ib: I = { FB() {} }; // @Filename: /home/src/workspaces/project/b/tsconfig.json ////{ //// "extends": "../tsconfig.settings.json", //// "files": [ //// "index.ts", //// ], ////} // @Filename: /home/src/workspaces/project/c/index.ts ////namespace NS { //// export function /*7*/FC() {} ////} //// ////interface /*8*/I { //// /*9*/FC(); ////} //// ////const ic: I = { FC() {} }; // @Filename: /home/src/workspaces/project/c/tsconfig.json ////{ //// "extends": "../tsconfig.settings.json", //// "files": [ //// "index.ts", //// ], ////} // @Filename: /home/src/workspaces/project/tsconfig.json ////{ //// "compilerOptions": { //// "composite": true, //// }, //// "references": [ //// { "path": "a" }, //// ], //// "files": [] ////} // @Filename: /home/src/workspaces/project/tsconfig.settings.json ////{ //// "compilerOptions": { //// "composite": true, //// "skipLibCheck": true, //// "declarationMap": true, //// "module": "none", //// "emitDeclarationOnly": true, //// } ////} verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9');
{ "end_byte": 1952, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/isDefinitionAcrossGlobalProjects.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider5.ts_0_789
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "react-hook-form": "*" } } // @Filename: /home/src/workspaces/project/node_modules/react-hook-form/package.json //// { "types": "dist/index.d.ts" } // @Filename: /home/src/workspaces/project/node_modules/react-hook-form/dist/index.d.ts //// export * from "./useForm"; // @Filename: /home/src/workspaces/project/node_modules/react-hook-form/dist/useForm.d.ts //// export declare function useForm(): void; // @Filename: /home/src/workspaces/project/index.ts //// useForm/**/ goTo.marker(""); verify.importFixAtPosition([ `import { useForm } from "react-hook-form";\r\n\r\nuseForm`, `import { useForm } from "react-hook-form/dist/useForm";\r\n\r\nuseForm` ]);
{ "end_byte": 789, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider5.ts" }
TypeScript/tests/cases/fourslash/server/completionsImport_addToNamedWithDifferentCacheValue.ts_0_2585
/// <reference path="../fourslash.ts" /> // Notable lack of package.json referencing `mylib` as dependency here. // This is not accurate to the original repro, but I think that's a separate // bug, which, if fixed, would prevent the later crash. // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "commonjs" } } // @Filename: /home/src/workspaces/project/packages/mylib/package.json //// { "name": "mylib", "version": "1.0.0", "main": "index.js" } // @Filename: /home/src/workspaces/project/packages/mylib/index.ts //// export * from "./mySubDir"; // @Filename: /home/src/workspaces/project/packages/mylib/mySubDir/index.ts //// export * from "./myClass"; //// export * from "./myClass2"; // @Filename: /home/src/workspaces/project/packages/mylib/mySubDir/myClass.ts //// export class MyClass {} // @Filename: /home/src/workspaces/project/packages/mylib/mySubDir/myClass2.ts //// export class MyClass2 {} // @link: /home/src/workspaces/project/packages/mylib -> /home/src/workspaces/project/node_modules/mylib // @Filename: /home/src/workspaces/project/src/index.ts //// //// const a = new MyClass/*1*/(); //// const b = new MyClass2/*2*/(); goTo.marker("1"); format.setOption("newLineCharacter", "\n"); verify.completions({ marker: "1", includes: [{ name: "MyClass", source: "../packages/mylib", sourceDisplay: "../packages/mylib", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }], preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, allowIncompleteCompletions: true, } }); verify.applyCodeActionFromCompletion("1", { name: "MyClass", source: "../packages/mylib", description: `Add import from "../packages/mylib"`, data: { exportName: "MyClass", fileName: "/home/src/workspaces/project/packages/mylib/index.ts", }, preferences: { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true, allowIncompleteCompletions: true, }, newFileContent: `import { MyClass } from "../packages/mylib"; const a = new MyClass(); const b = new MyClass2();`, }); edit.replaceLine(0, `import { MyClass } from "mylib";`); verify.completions({ marker: "2", includes: [{ name: "MyClass2", source: "mylib", sourceDisplay: "mylib", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }], preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, allowIncompleteCompletions: true, } });
{ "end_byte": 2585, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completionsImport_addToNamedWithDifferentCacheValue.ts" }
TypeScript/tests/cases/fourslash/server/jsdocTypedefTag.ts_0_2099
/// <reference path="../fourslash.ts"/> // @allowNonTsExtensions: true // @Filename: jsdocCompletion_typedef.js //// /** @typedef {(string | number)} NumberLike */ //// //// /** //// * @typedef Animal - think Giraffes //// * @type {Object} //// * @property {string} animalName //// * @property {number} animalAge //// */ //// //// /** //// * @typedef {Object} Person //// * @property {string} personName //// * @property {number} personAge //// */ //// //// /** //// * @typedef {Object} //// * @property {string} catName //// * @property {number} catAge //// */ //// var Cat; //// //// /** @typedef {{ dogName: string, dogAge: number }} */ //// var Dog; //// //// /** @type {NumberLike} */ //// var numberLike; numberLike./*numberLike*/ //// //// /** @type {Person} */ //// var p;p./*person*/; //// p.personName./*personName*/; //// p.personAge./*personAge*/; //// //// /** @type {/*AnimalType*/Animal} */ //// var a;a./*animal*/; //// a.animalName./*animalName*/; //// a.animalAge./*animalAge*/; //// //// /** @type {Cat} */ //// var c;c./*cat*/; //// c.catName./*catName*/; //// c.catAge./*catAge*/; //// //// /** @type {Dog} */ //// var d;d./*dog*/; //// d.dogName./*dogName*/; //// d.dogAge./*dogAge*/; verify.completions( { marker: "numberLike", includes: ["charAt", "toExponential"] }, { marker: "person", includes: ["personName", "personAge"] }, { marker: "personName", includes: "charAt" }, { marker: "personAge", includes: "toExponential" }, { marker: "animal", includes: ["animalName", "animalAge"] }, { marker: "animalName", includes: "charAt" }, { marker: "animalAge", includes: "toExponential" }, { marker: "dog", includes: ["dogName", "dogAge"] }, { marker: "dogName", includes: "charAt" }, { marker: "dogAge", includes: "toExponential" }, { marker: "cat", includes: ["catName", "catAge"] }, { marker: "catName", includes: "charAt" }, { marker: "catAge", includes: "toExponential" }, ); verify.quickInfoAt("AnimalType", "type Animal = {\n animalName: string;\n animalAge: number;\n}", "- think Giraffes");
{ "end_byte": 2099, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/jsdocTypedefTag.ts" }
TypeScript/tests/cases/fourslash/server/tsxIncrementalServer.ts_0_221
/// <reference path='../fourslash.ts' /> //// /**/ goTo.marker(); edit.insert("<"); edit.insert("div"); edit.insert(" "); edit.insert(" id"); edit.insert("="); edit.insert("\"foo"); edit.insert("\""); edit.insert(">");
{ "end_byte": 221, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/tsxIncrementalServer.ts" }
TypeScript/tests/cases/fourslash/server/impliedNodeFormat.ts_0_563
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "nodenext" } } // @Filename: /home/src/workspaces/project/package.json //// { "name": "foo", "type": "module", "exports": { ".": "./main.js" } } // @Filename: /home/src/workspaces/project/main.ts //// export {}; // @Filename: /home/src/workspaces/project/index.ts //// import {} from "foo"; goTo.file("/home/src/workspaces/project/index.ts"); verify.noErrors(); edit.paste(`\n"${"a".repeat(256)}";`); verify.noErrors();
{ "end_byte": 563, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/impliedNodeFormat.ts" }
TypeScript/tests/cases/fourslash/server/goToSource11_propertyOfAlias.ts_0_402
/// <reference path="../fourslash.ts" /> // @moduleResolution: node // @Filename: /home/src/workspaces/project/a.js //// export const a = { /*end*/a: 'a' }; // @Filename: /home/src/workspaces/project/a.d.ts //// export declare const a: { a: string }; // @Filename: /home/src/workspaces/project/b.ts //// import { a } from './a'; //// a.[|a/*start*/|] verify.baselineGoToSourceDefinition("start");
{ "end_byte": 402, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource11_propertyOfAlias.ts" }
TypeScript/tests/cases/fourslash/server/goToSource16_callbackParamDifferentFile.ts_0_1405
/// <reference path="../fourslash.ts" /> // @moduleResolution: node // This is just modified repro to ensure we are resolving module specifier thats not already present in the file // @Filename: /home/src/workspaces/project/node_modules/@types/yargs/package.json //// { //// "name": "@types/yargs", //// "version": "1.0.0", //// "types": "./index.d.ts" //// } // @Filename: /home/src/workspaces/project/node_modules/@types/yargs/callback.d.ts //// export declare class Yargs { positional(): Yargs; } // @Filename: /home/src/workspaces/project/node_modules/@types/yargs/index.d.ts //// import { Yargs } from "./callback"; //// export declare function command(command: string, cb: (yargs: Yargs) => void): void; // @Filename: /home/src/workspaces/project/node_modules/yargs/package.json //// { //// "name": "yargs", //// "version": "1.0.0", //// "main": "index.js" //// } // @Filename: /home/src/workspaces/project/node_modules/yargs/callback.js //// export class Yargs { positional() { } } // @Filename: /home/src/workspaces/project/node_modules/yargs/index.js //// import { Yargs } from "./callback"; //// export function command(cmd, cb) { cb(Yargs) } // @Filename: /home/src/workspaces/project/index.ts //// import { command } from "yargs"; //// command("foo", yargs => { //// yargs.[|/*start*/positional|](); //// }); verify.baselineGoToSourceDefinition("start");
{ "end_byte": 1405, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource16_callbackParamDifferentFile.ts" }
TypeScript/tests/cases/fourslash/server/convertFunctionToEs6Class-server1.ts_0_497
// @allowNonTsExtensions: true // @Filename: test123.js /// <reference path="../fourslash.ts" /> //// // Comment //// function fn() { //// this.baz = 10; //// } //// /*1*/fn.prototype.bar = function () { //// console.log('hello world'); //// } verify.codeFix({ description: "Convert function to an ES2015 class", newFileContent: `// Comment class fn {\r constructor() {\r this.baz = 10;\r }\r bar() {\r console.log('hello world');\r }\r } `, });
{ "end_byte": 497, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/convertFunctionToEs6Class-server1.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_multiplePastesGrowingInSize.ts_0_1749
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/a.ts //// function foo() { //// [|const p = 1;|] //// } //// function too() { //// function k([|t: string|]) { //// console.log(t); //// } //// } //// class bar { //// constructor() { //// function a() { //// [| console.log("hello");|] //// } //// a(); //// } //// c() { //// console.log("hello again"); //// [|function k() { //// const happy = banana + avocados; //// }|] //// } //// } // @Filename: /home/src/workspaces/project/b.ts //// export const juices = 1; //// export const sauce = 2; // @Filename: /home/src/workspaces/project/c.ts //// export const figs = 3; //// export const tomato = 4; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["a.ts", "b.ts", "c.ts"] } verify.pasteEdits({ args: { pastedText: [ `const t = figs;`,`apples : number`, ` console.log(sauce + tomato); `, `//function k(i:string) { const cherry = 3 + juices + cucumber; // }` ], pasteLocations: test.ranges(), }, newFileContents: { "/home/src/workspaces/project/a.ts": `import { sauce, juices } from "./b"; import { figs, tomato } from "./c"; function foo() { const t = figs; } function too() { function k(apples : number) { console.log(t); } } class bar { constructor() { function a() { console.log(sauce + tomato); } a(); } c() { console.log("hello again"); //function k(i:string) { const cherry = 3 + juices + cucumber; // } } }` } });
{ "end_byte": 1749, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_multiplePastesGrowingInSize.ts" }
TypeScript/tests/cases/fourslash/server/openFile.ts_0_352
/// <reference path="../fourslash.ts"/> // @Filename: test1.ts ////t. // @Filename: test.ts ////var t = '10'; // @Filename: tsconfig.json ////{ "files": ["test.ts", "test1.ts"] } var overridingContent = "var t = 10; t."; goTo.file("test.ts", overridingContent); goTo.file("test1.ts"); goTo.eof(); verify.completions({ includes: "toExponential" });
{ "end_byte": 352, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/openFile.ts" }
TypeScript/tests/cases/fourslash/server/formatBracketInSwitchCase.ts_0_161
/// <reference path="../fourslash.ts"/> ////switch (x) { //// case[]: ////} format.document(); verify.currentFileContentIs( `switch (x) { case []: }`);
{ "end_byte": 161, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/formatBracketInSwitchCase.ts" }
TypeScript/tests/cases/fourslash/server/completionsImport_defaultAndNamedConflict_server.ts_0_1429
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "noLib": true } } // @Filename: /home/src/workspaces/project/someModule.ts //// export const someModule = 0; //// export default 1; // @Filename: /home/src/workspaces/project/index.ts //// someMo/**/ verify.completions({ marker: "", includes: [ { name: "someModule", source: "/home/src/workspaces/project/someModule", sourceDisplay: "./someModule", text: "(property) default: 1", kind: "property", kindModifiers: "export", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, tags: [] }, { name: "someModule", source: "/home/src/workspaces/project/someModule", sourceDisplay: "./someModule", text: "const someModule: 0", kind: "const", kindModifiers: "export", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, tags: [] }, ], preferences: { includeCompletionsForModuleExports: true } }); verify.applyCodeActionFromCompletion("", { name: "someModule", source: "/home/src/workspaces/project/someModule", data: { exportName: "default", fileName: "/home/src/workspaces/project/someModule.ts" }, description: `Add import from "./someModule"`, newFileContent: `import someModule from "./someModule";\r\n\r\nsomeMo` });
{ "end_byte": 1429, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completionsImport_defaultAndNamedConflict_server.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider1.ts_0_727
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/node_modules/@angular/forms/package.json //// { "name": "@angular/forms", "typings": "./forms.d.ts" } // @Filename: /home/src/workspaces/project/node_modules/@angular/forms/forms.d.ts //// export class PatternValidator {} // @Filename: /home/src/workspaces/project/tsconfig.json //// {} // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "@angular/forms": "*" } } // @Filename: /home/src/workspaces/project/index.ts //// PatternValidator/**/ goTo.marker(""); format.setOption("newLineCharacter", "\n"); verify.importFixAtPosition([ `import { PatternValidator } from "@angular/forms"; PatternValidator` ]);
{ "end_byte": 727, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider1.ts" }
TypeScript/tests/cases/fourslash/server/goToSource7_conditionallyMinified.ts_0_1172
/// <reference path="../fourslash.ts" /> // @moduleResolution: node // @Filename: /home/src/workspaces/project/node_modules/react/package.json //// { "name": "react", "version": "16.8.6", "main": "index.js" } // @Filename: /home/src/workspaces/project/node_modules/react/index.js //// 'use strict'; //// //// if (process.env.NODE_ENV === 'production') { //// module.exports = require('./cjs/react.production.min.js'); //// } else { //// module.exports = require('./cjs/react.development.js'); //// } // @Filename: /home/src/workspaces/project/node_modules/react/cjs/react.production.min.js //// 'use strict';exports./*production*/useState=function(a){};exports.version='16.8.6'; // @Filename: /home/src/workspaces/project/node_modules/react/cjs/react.development.js //// 'use strict'; //// if (process.env.NODE_ENV !== 'production') { //// (function() { //// function useState(initialState) {} //// exports./*development*/useState = useState; //// exports.version = '16.8.6'; //// }()); //// } // @Filename: /home/src/workspaces/project/index.ts //// import { [|/*start*/useState|] } from 'react'; verify.baselineGoToSourceDefinition("start");
{ "end_byte": 1172, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource7_conditionallyMinified.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_multiplePastesConsistentlyLargerInSize.ts_0_1826
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/a.ts //// function foo() { //// const p = 1; //// [|console.log("yes");|] //// } //// class bar { //// constructor() { //// function a() { //// [|console.log("have a good day");|] //// } //// a(); //// function b() { //// function c() { //// const test = [|1 + 2|] + 3; //// } //// } //// b(); //// } //// c() { //// console.log("hello again"); //// [|function k() { //// const happy = banana + avocados; //// }|] //// } //// } // @Filename: /home/src/workspaces/project/b.ts //// export const juice = 1; //// export const sauce = 2; //// export const fig = 3; //// export const tomato = 4; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["a.ts", "b.ts"] } verify.pasteEdits({ args: { pastedText: [ `const t = 1 + juice + p;`,`function avacado() { return sauce; }`, `fig + kiwi`, `function k() { const cherry = 3 + tomato + cucumber; }` ], pasteLocations: test.ranges(), }, newFileContents: { "/home/src/workspaces/project/a.ts": `import { juice, sauce, fig, tomato } from "./b"; function foo() { const p = 1; const t = 1 + juice + p; } class bar { constructor() { function a() { function avacado() { return sauce; } } a(); function b() { function c() { const test = fig + kiwi + 3; } } b(); } c() { console.log("hello again"); function k() { const cherry = 3 + tomato + cucumber; } } }` } });
{ "end_byte": 1826, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_multiplePastesConsistentlyLargerInSize.ts" }
TypeScript/tests/cases/fourslash/server/tsconfigComputedPropertyError.ts_0_242
/// <reference path="../fourslash.ts"/> // @filename: tsconfig.json ////{ //// ["oops!" + 42]: "true", //// "files": [ //// "nonexistentfile.ts" //// ], //// "compileOnSave": true ////} verify.getSemanticDiagnostics([]);
{ "end_byte": 242, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/tsconfigComputedPropertyError.ts" }
TypeScript/tests/cases/fourslash/server/autoImportPackageJsonFilterExistingImport1.ts_0_585
/// <reference path="../fourslash.ts" /> // @module: preserve // @Filename: /home/src/workspaces/project/node_modules/@types/react/index.d.ts //// export declare function useMemo(): void; //// export declare function useState(): void; // @Filename: /home/src/workspaces/project/package.json //// {} // @Filename: /home/src/workspaces/project/index.ts //// import { useState } from "react"; //// useMemo/**/ goTo.marker(""); verify.importFixAtPosition([ `import { useMemo, useState } from "react"; useMemo` ]); edit.deleteLine(0); goTo.marker(""); verify.importFixAtPosition([]);
{ "end_byte": 585, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportPackageJsonFilterExistingImport1.ts" }
TypeScript/tests/cases/fourslash/server/goToDefinitionScriptImportServer.ts_0_668
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/scriptThing.ts //// /*1d*/console.log("woooo side effects") // @Filename: /home/src/workspaces/project/stylez.css //// /*2d*/div { //// color: magenta; //// } // @Filename: /home/src/workspaces/project/moduleThing.ts // not a module, but we should let you jump to it. //// import [|/*1*/"./scriptThing"|]; // not JS/TS, but if we can, you should be able to jump to it. //// import [|/*2*/"./stylez.css"|]; // does not exist, but should return a response to it anyway so an editor can create it. //// import [|/*3*/"./foo.txt"|]; verify.baselineGoToDefinition("1", "2", "3");
{ "end_byte": 668, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToDefinitionScriptImportServer.ts" }
TypeScript/tests/cases/fourslash/server/autoImportCrossProject_baseUrl_toDist.ts_0_1140
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/common/tsconfig.json //// { //// "compilerOptions": { //// "module": "commonjs", //// "outDir": "dist", //// "composite": true //// }, //// "include": ["src"] //// } // @Filename: /home/src/workspaces/project/common/src/MyModule.ts //// export function square(n: number) { //// return n * 2; //// } // @Filename: /home/src/workspaces/project/web/tsconfig.json //// { //// "compilerOptions": { //// "module": "esnext", //// "moduleResolution": "node", //// "noEmit": true, //// "baseUrl": "." //// }, //// "include": ["src"], //// "references": [{ "path": "../common" }] //// } // @Filename: /home/src/workspaces/project/web/src/MyApp.ts //// import { square } from "../../common/dist/src/MyModule"; // @Filename: /home/src/workspaces/project/web/src/Helper.ts //// export function saveMe() { //// square/**/(2); //// } goTo.file("/home/src/workspaces/project/web/src/Helper.ts"); verify.importFixModuleSpecifiers("", ["../../common/src/MyModule"], { importModuleSpecifierPreference: "non-relative" });
{ "end_byte": 1140, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportCrossProject_baseUrl_toDist.ts" }
TypeScript/tests/cases/fourslash/server/goToSource5_sameAsGoToDef1.ts_0_474
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/a.ts //// export const /*end*/a = 'a'; // @Filename: /home/src/workspaces/project/a.d.ts //// export declare const a: string; // @Filename: /home/src/workspaces/project/a.js //// export const a = 'a'; // @Filename: /home/src/workspaces/project/b.ts //// import { a } from './a'; //// [|a/*start*/|] verify.baselineGoToSourceDefinition("start"); verify.baselineGoToDefinition("start");
{ "end_byte": 474, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource5_sameAsGoToDef1.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_existingImports2.ts_0_1332
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/target.ts //// import { t } from "./other"; //// import { t3 } from "./other3"; //// const a = t + 1; //// [|const b = 10;|] //// const c = 10; // @Filename: /home/src/workspaces/project/other.ts //// export const t = 1; // @Filename: /home/src/workspaces/project/other2.ts //// export const t2 = 1; // @Filename: /home/src/workspaces/project/other3.ts //// export const t3 = 1; // @Filename: /home/src/workspaces/project/originalFile.ts //// import { t2 } from "./other2"; //// import { t3 } from "./other3"; //// export const n = 10; //// [|export const m = t3 + t2 + n;|] // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["target.ts", "originalFile.ts", "other.ts", "other2.ts", "other3.ts"] } const ranges = test.ranges(); verify.pasteEdits({ args: { pastedText: [ `const m = t3 + t2 + n;` ], pasteLocations: [ranges[0]], copiedFrom: { file: "/home/src/workspaces/project/originalFile.ts", range: [ranges[1]] }, }, newFileContents: { "/home/src/workspaces/project/target.ts": `import { n } from "./originalFile"; import { t } from "./other"; import { t2 } from "./other2"; import { t3 } from "./other3"; const a = t + 1; const m = t3 + t2 + n; const c = 10;` } });
{ "end_byte": 1332, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_existingImports2.ts" }
TypeScript/tests/cases/fourslash/server/autoImportSymlinkedJsPackages.ts_0_1084
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/packages/a/package.json //// { //// "name": "package-a", //// "dependencies": { //// "package-b": "*" //// } //// } // @Filename: /home/src/workspaces/project/packages/a/index.js //// packageB/**/ // @Filename: /home/src/workspaces/project/packages/b/package.json //// { "name": "package-b", "main": "index.js" } // @Filename: /home/src/workspaces/project/packages/b/index.js //// export const packageB = "package-b"; // @link: /home/src/workspaces/project/packages/b -> /home/src/workspaces/project/packages/a/node_modules/package-b config.setCompilerOptionsForInferredProjects({ module: "commonjs", allowJs: true, maxNodeModulesJsDepth: 2 }); goTo.marker(""); verify.completions({ marker: "", includes: [{ name: "packageB", source: "package-b", sourceDisplay: "package-b", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }], preferences: { includeCompletionsForModuleExports: true, allowIncompleteCompletions: true, } });
{ "end_byte": 1084, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportSymlinkedJsPackages.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_namespaceSameNameAsIntrinsic.ts_0_1175
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/node_modules/fp-ts/package.json //// { "name": "fp-ts", "version": "0.10.4" } // @Filename: /home/src/workspaces/project/node_modules/fp-ts/index.d.ts //// export * as string from "./lib/string"; // @Filename: /home/src/workspaces/project/node_modules/fp-ts/lib/string.d.ts //// export declare const fromString: (s: string) => string; //// export type SafeString = string; // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "fp-ts": "^0.10.4" } } // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "commonjs" } } // @Filename: /home/src/workspaces/project/index.ts //// type A = { name: string/**/ } goTo.marker(""); verify.completions({ marker: "", includes: [{ name: "string", sortText: completion.SortText.GlobalsOrKeywords, }, { name: "string", sortText: completion.SortText.AutoImportSuggestions, source: "fp-ts", sourceDisplay: "fp-ts", hasAction: true, }], preferences: { includeCompletionsForModuleExports: true, allowIncompleteCompletions: true, }, });
{ "end_byte": 1175, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_namespaceSameNameAsIntrinsic.ts" }
TypeScript/tests/cases/fourslash/server/declarationMapsGoToDefinitionSameNameDifferentDirectory.ts_0_1698
/// <reference path="../fourslash.ts" /> // @Filename: BaseClass/Source.d.ts ////declare class Control { //// constructor(); //// /** this is a super var */ //// myVar: boolean | 'yeah'; ////} //////# sourceMappingURL=Source.d.ts.map // @Filename: BaseClass/Source.d.ts.map ////{"version":3,"file":"Source.d.ts","sourceRoot":"","sources":["Source.ts"],"names":[],"mappings":"AAAA,cAAM,OAAO;;IAIT,0BAA0B;IACnB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAQ;CACzC"} // @Filename: BaseClass/Source.ts ////class /*2*/Control{ //// constructor(){ //// return; //// } //// /** this is a super var */ //// public /*4*/myVar: boolean | 'yeah' = true; ////} // @Filename: tsbase.json ////{ //// "$schema": "http://json.schemastore.org/tsconfig", //// "compileOnSave": true, //// "compilerOptions": { //// "sourceMap": true, //// "declaration": true, //// "declarationMap": true //// } //// } // @Filename: buttonClass/tsconfig.json ////{ //// "extends": "../tsbase.json", //// "compilerOptions": { //// "outFile": "Source.js" //// }, //// "files": [ //// "Source.ts" //// ], //// "include": [ //// "../BaseClass/Source.d.ts" //// ] //// } // @Filename: buttonClass/Source.ts ////// I cannot F12 navigate to Control ////// vvvvvvv ////class Button extends [|/*1*/Control|] { //// public myFunction() { //// // I cannot F12 navigate to myVar //// // vvvvv //// if (typeof this.[|/*3*/myVar|] === 'boolean') { //// this.myVar; //// } else { //// this.myVar.toLocaleUpperCase(); //// } //// } ////} verify.baselineGoToDefinition("1", "3");
{ "end_byte": 1698, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/declarationMapsGoToDefinitionSameNameDifferentDirectory.ts" }
TypeScript/tests/cases/fourslash/server/autoImportFileExcludePatterns2.ts_0_918
/// <reference path="../fourslash.ts"/> // @module: commonjs // @Filename: /home/src/workspaces/project/node_modules/aws-sdk/package.json //// { "name": "aws-sdk", "version": "2.0.0", "main": "index.js" } // @Filename: /home/src/workspaces/project/node_modules/aws-sdk/index.d.ts //// export * from "./clients/s3"; // @Filename: /home/src/workspaces/project/node_modules/aws-sdk/clients/s3.d.ts //// export declare class S3 {} // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "aws-sdk": "*" } } // @Filename: /home/src/workspaces/project/index.ts //// S3/**/ const autoImportFileExcludePatterns = ["**/node_modules/aws-sdk"]; verify.completions({ marker: "", excludes: "S3", preferences: { includeCompletionsForModuleExports: true, autoImportFileExcludePatterns, } }); verify.importFixAtPosition([], /*errorCode*/ undefined, { autoImportFileExcludePatterns });
{ "end_byte": 918, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportFileExcludePatterns2.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider6.ts_0_1289
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "commonjs", "lib": ["es2019"] } } // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "antd": "*", "react": "*" } } // @Filename: /home/src/workspaces/project/node_modules/@types/react/index.d.ts //// export declare function Component(): void; // @Filename: /home/src/workspaces/project/node_modules/antd/index.d.ts //// import "react"; // @Filename: /home/src/workspaces/project/index.ts //// Component/**/ // react/index.d.ts will be in both the auto import provider program // and the main program, and will result in duplicate completions // unless the two programs successfully share the same source file. // This tests the configuration of the AutoImportProviderProject. // See also the 'Can use the same document registry bucket key as main program' // unit test in autoImportProvider.ts. goTo.marker(""); verify.completions({ marker: "", includes: [{ name: "Component", hasAction: true, source: "/home/src/workspaces/project/node_modules/@types/react/index", sortText: completion.SortText.AutoImportSuggestions, }], preferences: { includeCompletionsForModuleExports: true, }, });
{ "end_byte": 1289, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider6.ts" }
TypeScript/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts_0_628
/// <reference path="../fourslash.ts"/> // @allowNonTsExtensions: true // @Filename: jsdocCompletion_typedef.js //// /** //// * @typedef {string | number} T.NumberLike //// * @typedef {{age: number}} T.People //// * @typedef {string | number} T.O.Q.NumberLike //// * @type {T.NumberLike} //// */ //// var x; x./*1*/; //// /** @type {T.O.Q.NumberLike} */ //// var x1; x1./*2*/; //// /** @type {T.People} */ //// var x1; x1./*3*/; verify.completions( { marker: ["1", "3"], includes: ["charAt", "toExponential"] }, { marker: "2", includes: { name: "age", sortText: completion.SortText.JavascriptIdentifiers } }, );
{ "end_byte": 628, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts" }
TypeScript/tests/cases/fourslash/server/tripleSlashReferenceResolutionMode.ts_0_1202
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "nodenext", "declaration": true, "strict": true, "outDir": "out" }, "files": ["./index.ts"] } // @Filename: /home/src/workspaces/project/package.json //// { "private": true, "type": "commonjs" } // @Filename: /home/src/workspaces/project/node_modules/pkg/package.json ////{ "name": "pkg", "version": "0.0.1", "exports": { "require": "./require.cjs", "default": "./import.js" }, "type": "module" } // @Filename: /home/src/workspaces/project/node_modules/pkg/require.d.cts ////export {}; ////export interface PkgRequireInterface { member: any; } ////declare global { const pkgRequireGlobal: PkgRequireInterface; } // @Filename: /home/src/workspaces/project/node_modules/pkg/import.d.ts ////export {}; ////export interface PkgImportInterface { field: any; } ////declare global { const pkgImportGlobal: PkgImportInterface; } // @Filename: /home/src/workspaces/project/index.ts /////// <reference types="pkg" resolution-mode="import" /> ////pkgImportGlobal; ////export {}; goTo.file("/home/src/workspaces/project/index.ts"); verify.numberOfErrorsInCurrentFile(0);
{ "end_byte": 1202, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/tripleSlashReferenceResolutionMode.ts" }
TypeScript/tests/cases/fourslash/server/convertFunctionToEs6Class-server2.ts_0_535
// @allowNonTsExtensions: true // @Filename: test123.js /// <reference path="../fourslash.ts" /> //// /** //// * JSDoc Comment //// */ //// function fn() { //// this.baz = 10; //// } //// /*1*/fn.prototype.bar = function () { //// console.log('hello world'); //// } verify.codeFix({ description: "Convert function to an ES2015 class", newFileContent: `/** * JSDoc Comment */ class fn {\r constructor() {\r this.baz = 10;\r }\r bar() {\r console.log('hello world');\r }\r } `, });
{ "end_byte": 535, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/convertFunctionToEs6Class-server2.ts" }
TypeScript/tests/cases/fourslash/server/referencesToNonPropertyNameStringLiteral.ts_0_118
/// <reference path="../fourslash.ts"/> ////const str: string = "hello/*1*/"; verify.baselineFindAllReferences('1')
{ "end_byte": 118, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/referencesToNonPropertyNameStringLiteral.ts" }
TypeScript/tests/cases/fourslash/server/callHierarchyContainerNameServer.ts_0_616
/// <reference path="../fourslash.ts" /> ////function /**/f() {} //// ////class A { //// static sameName() { //// f(); //// } ////} //// ////class B { //// sameName() { //// A.sameName(); //// } ////} //// ////const Obj = { //// get sameName() { //// return new B().sameName; //// } ////}; //// ////namespace Foo { //// function sameName() { //// return Obj.sameName; //// } //// //// export class C { //// constructor() { //// sameName(); //// } //// } ////} //// ////module Foo.Bar { //// const sameName = () => new Foo.C(); ////} goTo.marker(); verify.baselineCallHierarchy();
{ "end_byte": 616, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/callHierarchyContainerNameServer.ts" }
TypeScript/tests/cases/fourslash/server/declarationMapsOutOfDateMapping.ts_0_965
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/node_modules/a/dist/index.d.ts ////export declare class Foo { //// bar: any; ////} //////# sourceMappingURL=index.d.ts.map // @Filename: /home/src/workspaces/project/node_modules/a/dist/index.d.ts.map ////{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,GAAG,MAAC;CACP"} // @Filename: /home/src/workspaces/project/node_modules/a/src/index.ts ////export class /*2*/Foo { ////} //// // @Filename: /home/src/workspaces/project/node_modules/a/package.json ////{ //// "name": "a", //// "version": "0.0.0", //// "private": true, //// "main": "dist", //// "types": "dist" ////} // @Filename: /home/src/workspaces/project/index.ts ////import { Foo/*1*/ } from "a"; goTo.file("/home/src/workspaces/project/index.ts"); verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAndBoundSpan
{ "end_byte": 965, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/declarationMapsOutOfDateMapping.ts" }
TypeScript/tests/cases/fourslash/server/completionsOverridingMethodCrash2.ts_0_1879
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { //// "compilerOptions": { //// "module": "nodenext" //// } //// } // @Filename: /home/src/workspaces/project/utils.ts //// export class Element { //// // ... //// } //// //// export abstract class Component { //// abstract render(): Element; //// } // @Filename: /home/src/workspaces/project/classes.ts //// import { Component } from "./utils.js"; //// //// export class MyComponent extends Component { //// render/**/ //// } goTo.marker(""); verify.completions({ marker: "", isNewIdentifierLocation: true, preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: true, includeCompletionsWithClassMemberSnippets: true, }, includes: [ { name: "render", sortText: completion.SortText.LocationPriority, filterText: "render", isSnippet: true, insertText: "render(): Element {\r\n $0\r\n}", hasAction: true, source: completion.CompletionSource.ClassMemberSnippet, } ] }); goTo.file("/home/src/workspaces/project/utils.ts"); goTo.marker(""); edit.backspace(); verify.completions({ marker: "", isNewIdentifierLocation: true, preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: true, includeCompletionsWithClassMemberSnippets: true, }, includes: [ { name: "render", sortText: completion.SortText.LocationPriority, filterText: "render", isSnippet: true, insertText: "render(): Element {\r\n $0\r\n}", hasAction: true, source: completion.CompletionSource.ClassMemberSnippet, } ] });
{ "end_byte": 1879, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completionsOverridingMethodCrash2.ts" }
TypeScript/tests/cases/fourslash/server/formatTrimRemainingRangets_0_148
/// <reference path="../fourslash.ts"/> //// ; //// /* //// //// */ format.document(); verify.currentFileContentIs( `; /* */`);
{ "end_byte": 148, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/formatTrimRemainingRangets" }
TypeScript/tests/cases/fourslash/server/projectWithNonExistentFiles.ts_0_435
/// <reference path="../fourslash.ts"/> // @Filename: a.ts ////export var test = "test String" // @Filename: b.ts ////export var test2 = "test String" // @Filename: tsconfig.json ////{ "files": ["a.ts", "c.ts", "b.ts"] } goTo.file("a.ts"); verify.ProjectInfo(["/home/src/tslibs/TS/Lib/lib.d.ts", "/home/src/tslibs/TS/Lib/lib.decorators.d.ts", "/home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts", "a.ts", "b.ts", "tsconfig.json"])
{ "end_byte": 435, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/projectWithNonExistentFiles.ts" }
TypeScript/tests/cases/fourslash/server/completionsImport_sortingModuleSpecifiers.ts_0_1242
/// <reference path="../fourslash.ts" /> // @Filename: tsconfig.json //// { "compilerOptions": { "module": "commonjs" } } // @Filename: path.d.ts //// declare module "path/posix" { //// export function normalize(p: string): string; //// } //// declare module "path/win32" { //// export function normalize(p: string): string; //// } //// declare module "path" { //// export function normalize(p: string): string; //// } // @Filename: main.ts //// normalize/**/ verify.completions({ marker: "", exact: completion.globalsPlus([ { name: "normalize", source: "path", sourceDisplay: "path", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }, { name: "normalize", source: "path/posix", sourceDisplay: "path/posix", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }, { name: "normalize", source: "path/win32", sourceDisplay: "path/win32", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }, ]), preferences: { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true, allowIncompleteCompletions: true, }, });
{ "end_byte": 1242, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completionsImport_sortingModuleSpecifiers.ts" }
TypeScript/tests/cases/fourslash/server/brace01.ts_0_939
/// <reference path="../fourslash.ts"/> //////curly braces ////module Foo [|{ //// class Bar [|{ //// private f() [|{ //// }|] //// //// private f2() [|{ //// if (true) [|{ }|] [|{ }|]; //// }|] //// }|] ////}|] //// //////parenthesis ////class FooBar { //// private f[|()|] { //// return [|([|(1 + 1)|])|]; //// } //// //// private f2[|()|] { //// if [|(true)|] { } //// } ////} //// //////square brackets ////class Baz { //// private f() { //// var a: any[|[]|] = [|[[|[1, 2]|], [|[3, 4]|], 5]|]; //// } ////} //// ////// angular brackets ////class TemplateTest [|<T1, T2 extends Array>|] { //// public foo(a, b) { //// return [|<any>|] a; //// } ////} for (const range of test.ranges()) { verify.matchingBracePositionInCurrentFile(range.pos, range.end - 1); verify.matchingBracePositionInCurrentFile(range.end - 1, range.pos); }
{ "end_byte": 939, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/brace01.ts" }
TypeScript/tests/cases/fourslash/server/autoImportPackageJsonFilterExistingImport2.ts_0_593
/// <reference path="../fourslash.ts" /> // @module: preserve // @Filename: /home/src/workspaces/project/node_modules/@types/react/index.d.ts //// export declare function useMemo(): void; //// export declare function useState(): void; // @Filename: /home/src/workspaces/project/package.json //// {} // @Filename: /home/src/workspaces/project/index.ts //// useMemo/**/ goTo.marker(""); verify.importFixAtPosition([]); goTo.bof(); edit.insertLine(`import { useState } from "react";`); goTo.marker(""); verify.importFixAtPosition([ `import { useMemo, useState } from "react"; useMemo` ]);
{ "end_byte": 593, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportPackageJsonFilterExistingImport2.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_knownSourceFile.ts_0_1086
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/target.ts //// export const tt = 2; //// [|function f();|] //// const p = 1; // @Filename: /home/src/workspaces/project/file1.ts ////export const b = 2; // @Filename: /home/src/workspaces/project/file2.ts ////import { b } from './file1'; ////const a = 1; ////[|const c = a + b; ////const t = 9;|] // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["file1.ts", "file2.ts", "target.ts"] } const ranges = test.ranges(); verify.pasteEdits({ args: { pastedText: [ `const c = a + b; const t = 9;`], pasteLocations: [ranges[0]], copiedFrom: { file: "/home/src/workspaces/project/file2.ts", range: [ranges[1]] }, }, newFileContents: { "/home/src/workspaces/project/file2.ts": `import { b } from './file1'; export const a = 1; const c = a + b; const t = 9;`, "/home/src/workspaces/project/target.ts": `import { b } from './file1'; import { a } from './file2'; export const tt = 2; const c = a + b; const t = 9; const p = 1;`, } });
{ "end_byte": 1086, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_knownSourceFile.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_pasteComments.ts_0_432
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/target.ts //// const a = 10; //// const b = 10;[||] //// const c = 10; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["target.ts"] } verify.pasteEdits({ args: { pastedText: [ `/** * Testing comment line 1 * line 2 * line 3 * line 4 */`], pasteLocations: test.ranges(), }, newFileContents: {} });
{ "end_byte": 432, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_pasteComments.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider2.ts_0_1156
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/node_modules/direct-dependency/package.json //// { "name": "direct-dependency", "dependencies": { "indirect-dependency": "*" } } // @Filename: /home/src/workspaces/project/node_modules/direct-dependency/index.d.ts //// import "indirect-dependency"; //// export declare class DirectDependency {} // @Filename: /home/src/workspaces/project/node_modules/indirect-dependency/package.json //// { "name": "indirect-dependency" } // @Filename: /home/src/workspaces/project/node_modules/indirect-dependency/index.d.ts //// export declare class IndirectDependency // @Filename: /home/src/workspaces/project/tsconfig.json //// {} // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "direct-dependency": "*" } } // @Filename: /home/src/workspaces/project/index.ts //// IndirectDependency/**/ // `IndirectDependency` is in the autoImportProvider program, but // filtered out of the suggestions because it is not a direct // dependency of the project. goTo.marker(""); format.setOption("newLineCharacter", "\n"); verify.importFixAtPosition([]);
{ "end_byte": 1156, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider2.ts" }
TypeScript/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping2.ts_0_3478
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json ////{ //// "compilerOptions": { //// "outDir": "./dist", //// "sourceMap": true, //// "sourceRoot": "/home/src/workspaces/project/", //// "declaration": true, //// "declarationMap": true, //// "newLine": "lf", //// }, //// "files": ["/home/src/workspaces/project/index.ts"], ////} // @Filename: /home/src/workspaces/project/index.ts // @emitThisFile: true ////export class Foo { //// member: string; //// /*2*/methodName(propName: SomeType): SomeType { return propName; } //// otherMethod() { //// if (Math.random() > 0.5) { //// return {x: 42}; //// } //// return {y: "yes"}; //// } ////} //// ////export interface /*SomeType*/SomeType { //// member: number; ////} // @Filename: /home/src/workspaces/project/mymodule.ts ////import * as mod from "/home/src/workspaces/project/dist/index"; ////const instance = new mod.Foo(); ////instance.[|/*1*/methodName|]({member: 12}); // @Filename: /home/src/workspaces/project/dist/index.js.map ////{"version":3,"file":"index.js","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":";;;AAAA;IAAA;IASA,CAAC;IAPG,wBAAU,GAAV,UAAW,QAAkB,IAAc,OAAO,QAAQ,CAAC,CAAC,CAAC;IAC7D,yBAAW,GAAX;QACI,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE,CAAC;YACtB,OAAO,EAAC,CAAC,EAAE,EAAE,EAAC,CAAC;QACnB,CAAC;QACD,OAAO,EAAC,CAAC,EAAE,KAAK,EAAC,CAAC;IACtB,CAAC;IACL,UAAC;AAAD,CAAC,AATD,IASC;AATY,kBAAG"} // @Filename: /home/src/workspaces/project/dist/index.js ////"use strict"; ////Object.defineProperty(exports, "__esModule", { value: true }); ////exports.Foo = void 0; ////var Foo = /** @class */ (function () { //// function Foo() { //// } //// Foo.prototype.methodName = function (propName) { return propName; }; //// Foo.prototype.otherMethod = function () { //// if (Math.random() > 0.5) { //// return { x: 42 }; //// } //// return { y: "yes" }; //// }; //// return Foo; ////}()); ////exports.Foo = Foo; //////# sourceMappingURL=index.js.map // @Filename: /home/src/workspaces/project/dist/index.d.ts.map ////{"version":3,"file":"index.d.ts","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} // @Filename: /home/src/workspaces/project/dist/index.d.ts ////export declare class Foo { //// member: string; //// methodName(propName: SomeType): SomeType; //// otherMethod(): { //// x: number; //// y?: undefined; //// } | { //// y: string; //// x?: undefined; //// }; ////} ////export interface SomeType { //// member: number; ////} //////# sourceMappingURL=index.d.ts.map goTo.file("/home/src/workspaces/project/index.ts"); verify.getEmitOutput([ "/home/src/workspaces/project/dist/index.js.map", "/home/src/workspaces/project/dist/index.js", "/home/src/workspaces/project/dist/index.d.ts.map", "/home/src/workspaces/project/dist/index.d.ts" ]); verify.baselineGoToImplementation("1");// getImplementationAtPosition verify.baselineGoToType("1");// getTypeDefinitionAtPosition verify.baselineGoToDefinition("1");// getDefinitionAndBoundSpan verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition
{ "end_byte": 3478, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping2.ts" }
TypeScript/tests/cases/fourslash/server/goToSource14_unresolvedRequireDestructuring.ts_0_204
/// <reference path="../fourslash.ts" /> // @allowJs: true // @Filename: /home/src/workspaces/project/index.js //// const { blah/**/ } = require("unresolved"); verify.baselineGoToSourceDefinition("");
{ "end_byte": 204, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource14_unresolvedRequireDestructuring.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_exportMap9.ts_0_1501
/// <reference path="../fourslash.ts"/> // Only the first resolution in an array should be used // @Filename: /home/src/workspaces/project/tsconfig.json //// { //// "compilerOptions": { //// "module": "nodenext" //// } //// } // @Filename: /home/src/workspaces/project/package.json //// { //// "type": "module", //// "dependencies": { //// "dependency": "^1.0.0" //// } //// } // @Filename: /home/src/workspaces/project/node_modules/dependency/package.json //// { //// "type": "module", //// "name": "dependency", //// "version": "1.0.0", //// "exports": { //// "./lol": ["./lib/index.js", "./lib/lol.js"] //// } //// } // @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.d.ts //// export function fooFromIndex(): void; // @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.d.ts //// export function fooFromLol(): void; // @Filename: /home/src/workspaces/project/src/bar.ts //// import { fooFromIndex } from "dependency"; // @Filename: /home/src/workspaces/project/src/foo.ts //// fooFrom/**/ goTo.marker(""); verify.completions({ marker: "", includes: [{ name: "fooFromIndex", source: "dependency/lol", sourceDisplay: "dependency/lol", sortText: completion.SortText.AutoImportSuggestions, hasAction: true, }], excludes: "fooFromLol", preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, allowIncompleteCompletions: true, }, });
{ "end_byte": 1501, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_exportMap9.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_existingImports1.ts_0_952
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/target.ts //// import { t } from "./other"; //// import { t3 } from "./other3"; //// const a = t + 1; //// [|const b = 10;|] //// const c = 10; // @Filename: /home/src/workspaces/project/other.ts //// export const t = 1; // @Filename: /home/src/workspaces/project/other2.ts //// export const t2 = 1; // @Filename: /home/src/workspaces/project/other3.ts //// export const t3 = 1; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["target.ts", "other.ts", "other2.ts", "other3.ts"] } verify.pasteEdits({ args: { pastedText: [ `const m = t3 + t2 + 1;`], pasteLocations: test.ranges(), }, newFileContents: { "/home/src/workspaces/project/target.ts": `import { t } from "./other"; import { t2 } from "./other2"; import { t3 } from "./other3"; const a = t + 1; const m = t3 + t2 + 1; const c = 10;` } });
{ "end_byte": 952, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_existingImports1.ts" }
TypeScript/tests/cases/fourslash/server/navto_serverExcludeLib.ts_0_1025
/// <reference path="../fourslash.ts"/> // @Filename: /home/src/workspaces/project/index.ts //// import { weirdName as otherName } from "bar"; //// const [|weirdName: number = 1|]; // @Filename: /home/src/workspaces/project/tsconfig.json //// {} // @Filename: /home/src/workspaces/project/node_modules/bar/index.d.ts //// export const [|weirdName: number|]; // @Filename: /home/src/workspaces/project/node_modules/bar/package.json //// {} const [weird, otherWeird] = test.ranges(); verify.navigateTo({ pattern: "weirdName", expected: [{ name: "weirdName", kind: "const", kindModifiers: "export,declare", range: otherWeird, matchKind: "exact", }, { name: "weirdName", kind: "const", range: weird, matchKind: "exact", }], }); verify.navigateTo({ pattern: "weirdName", excludeLibFiles: true, expected: [{ name: "weirdName", kind: "const", range: weird, matchKind: "exact", }], });
{ "end_byte": 1025, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/navto_serverExcludeLib.ts" }
TypeScript/tests/cases/fourslash/server/fixExtractToInnerFunctionDuplicaton.ts_0_770
/// <reference path="../fourslash.ts" /> //// function foo(): void { /*x*/console.log('a');/*y*/ } goTo.select("x","y"); verify.refactorAvailable("Extract Symbol", 'function_scope_0', "Extract to inner function in function 'foo'"); verify.refactorAvailable("Extract Symbol", 'function_scope_1', "Extract to function in global scope"); verify.not.refactorAvailable("Extract Symbol", 'constant_scope_0', "Extract to inner function in function 'foo'"); verify.refactorAvailable("Extract Symbol", 'constant_scope_0', "Extract to constant in enclosing scope"); verify.refactorAvailable("Extract Symbol", 'constant_scope_1', "Extract to constant in global scope"); verify.not.refactorAvailable("Extract Symbol", 'constant_scope_0', "Extract to constant in global scope");
{ "end_byte": 770, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/fixExtractToInnerFunctionDuplicaton.ts" }
TypeScript/tests/cases/fourslash/server/autoImportFileExcludePatterns_symlinks2.ts_0_1390
/// <reference path="../fourslash.ts"/> // @module: commonjs // @Filename: c:/workspaces/project/node_modules/.store/aws-sdk-virtual-adfe098/package/package.json //// { "name": "aws-sdk", "version": "2.0.0", "main": "index.js" } // @Filename: c:/workspaces/project/node_modules/.store/aws-sdk-virtual-adfe098/package/index.d.ts //// export {}; // @Filename: c:/workspaces/project/node_modules/@remix-run/server-runtime/package.json //// { //// "name": "@remix-run/server-runtime", //// "version": "0.0.0", //// "main": "index.js" //// } // @Filename: c:/workspaces/project/node_modules/@remix-run/server-runtime/index.d.ts //// export declare function ServerRuntimeMetaFunction(): void; // @Filename: c:/workspaces/project/package.json //// { "dependencies": { "aws-sdk": "*", "@remix-run/server-runtime": "*" } } // @link: c:/workspaces/project/node_modules/.store/aws-sdk-virtual-adfe098/package -> c:/workspaces/project/node_modules/aws-sdk // @Filename: c:/workspaces/project/index.ts //// ServerRuntimeMetaFunction/**/ const autoImportFileExcludePatterns = ["c:/**/@remix-run/server-runtime"]; verify.completions({ marker: "", excludes: "ServerRuntimeMetaFunction", preferences: { includeCompletionsForModuleExports: true, autoImportFileExcludePatterns, } }); verify.importFixAtPosition([], /*errorCode*/ undefined, { autoImportFileExcludePatterns });
{ "end_byte": 1390, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportFileExcludePatterns_symlinks2.ts" }
TypeScript/tests/cases/fourslash/server/importSuggestionsCache_moduleAugmentation.ts_0_1275
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "compilerOptions": { "module": "esnext" } } // @Filename: /home/src/workspaces/project/node_modules/@types/react/index.d.ts ////export function useState(): void; // @Filename: /home/src/workspaces/project/a.ts ////import 'react'; ////declare module 'react' { //// export function useBlah(): void; ////} ////0; ////use/**/ verifyIncludes("useState"); verifyIncludes("useBlah"); edit.replaceLine(2, " export function useYes(): true"); verifyExcludes("useBlah"); verifyIncludes("useYes"); function verifyIncludes(name: string) { goTo.marker(""); verify.completions({ includes: { name, source: "/home/src/workspaces/project/node_modules/@types/react/index", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }, preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, }, }); } function verifyExcludes(name: string) { goTo.marker(""); verify.completions({ excludes: name, preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, }, }); }
{ "end_byte": 1275, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/importSuggestionsCache_moduleAugmentation.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_addInNextLine.ts_0_803
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/a.ts //// //// //// //// [||] //// // @Filename: /home/src/workspaces/project/b.ts //// export interface Foo { } //// export const a = 1; //// export const t = 1; //// //// [|export const foo: Foo = { };|] //// [|export const k = a+ t;|] // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["a.ts", "b.ts"] } const ranges = test.ranges(); verify.pasteEdits({ args: { pastedText: [`export const foo: Foo = {};`], pasteLocations: [ranges[0]], copiedFrom: { file: "/home/src/workspaces/project/b.ts", range: [ranges[1]] }, }, newFileContents: { "/home/src/workspaces/project/a.ts": `import { Foo } from "./b"; export const foo: Foo = {}; ` } });
{ "end_byte": 803, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_addInNextLine.ts" }
TypeScript/tests/cases/fourslash/server/referencesInEmptyFile.ts_0_88
/// <reference path='fourslash.ts'/> /////*1*/ verify.baselineFindAllReferences('1');
{ "end_byte": 88, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/referencesInEmptyFile.ts" }
TypeScript/tests/cases/fourslash/server/autoImportFileExcludePatterns_symlinks.ts_0_1230
/// <reference path="../fourslash.ts"/> // @module: commonjs // @Filename: /home/src/workspaces/project/node_modules/.store/@remix-run-server-runtime-virtual-c72daf0d/package/package.json //// { //// "name": "@remix-run/server-runtime", //// "version": "0.0.0", //// "main": "index.js" //// } // @Filename: /home/src/workspaces/project/node_modules/.store/@remix-run-server-runtime-virtual-c72daf0d/package/index.d.ts //// export declare function ServerRuntimeMetaFunction(): void; // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "@remix-run/server-runtime": "*" } } // @link: /home/src/workspaces/project/node_modules/.store/@remix-run-server-runtime-virtual-c72daf0d/package -> /home/src/workspaces/project/node_modules/@remix-run/server-runtime // @Filename: /home/src/workspaces/project/index.ts //// ServerRuntimeMetaFunction/**/ const autoImportFileExcludePatterns = ["/**/@remix-run/server-runtime"]; verify.completions({ marker: "", excludes: "ServerRuntimeMetaFunction", preferences: { includeCompletionsForModuleExports: true, autoImportFileExcludePatterns, } }); verify.importFixAtPosition([], /*errorCode*/ undefined, { autoImportFileExcludePatterns });
{ "end_byte": 1230, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportFileExcludePatterns_symlinks.ts" }
TypeScript/tests/cases/fourslash/server/goToSource10_mapFromAtTypes3.ts_0_2544
/// <reference path="../fourslash.ts" /> // @moduleResolution: node // @Filename: /home/src/workspaces/project/node_modules/lodash/package.json //// { "name": "lodash", "version": "4.17.15", "main": "./lodash.js" } // @Filename: /home/src/workspaces/project/node_modules/lodash/lodash.js //// ;(function() { //// /** //// * Adds two numbers. //// * //// * @static //// * @memberOf _ //// * @since 3.4.0 //// * @category Math //// * @param {number} augend The first number in an addition. //// * @param {number} addend The second number in an addition. //// * @returns {number} Returns the total. //// * @example //// * //// * _.add(6, 4); //// * // => 10 //// */ //// var [|/*variable*/add|] = createMathOperation(function(augend, addend) { //// return augend + addend; //// }, 0); //// //// function lodash(value) {} //// lodash.[|/*property*/add|] = add; //// //// /** Detect free variable `global` from Node.js. */ //// var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; //// /** Detect free variable `self`. */ //// var freeSelf = typeof self == 'object' && self && self.Object === Object && self; //// /** Used as a reference to the global object. */ //// var root = freeGlobal || freeSelf || Function('return this')(); //// /** Detect free variable `exports`. */ //// var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;//// //// /** Detect free variable `module`. */ //// var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; //// if (freeModule) { //// // Export for Node.js. //// (freeModule.exports = _)._ = _; //// // Export for CommonJS support. //// freeExports._ = _; //// } //// else { //// // Export to the global object. //// root._ = _; //// } //// }.call(this)); // @Filename: /home/src/workspaces/project/node_modules/@types/lodash/package.json //// { "name": "@types/lodash", "version": "4.14.97", "types": "index.d.ts" } // @Filename: /home/src/workspaces/project/node_modules/@types/lodash/index.d.ts //// export = _; //// export as namespace _; //// declare const _: _.LoDashStatic; //// declare namespace _ { //// interface LoDashStatic {} //// } // @Filename: /home/src/workspaces/project/index.ts //// import { [|/*start*/add|] } from 'lodash'; verify.baselineGoToSourceDefinition("start");
{ "end_byte": 2544, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource10_mapFromAtTypes3.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_noImportNeededInUpdatedProgram.ts_0_441
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/a.ts //// [||] // @Filename: /home/src/workspaces/project/b.ts //// export const b = 10; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["a.ts", "b.ts"] } verify.pasteEdits({ args: { pastedText: [ `const b = 1; console.log(b);`], pasteLocations: test.ranges(), }, newFileContents: {} });
{ "end_byte": 441, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_noImportNeededInUpdatedProgram.ts" }
TypeScript/tests/cases/fourslash/server/autoImportPackageJsonFilterExistingImport3.ts_0_633
/// <reference path="../fourslash.ts" /> // @module: preserve // @Filename: /home/src/workspaces/project/node_modules/@types/node/index.d.ts //// declare module "node:fs" { //// export function readFile(): void; //// export function writeFile(): void; //// } // @Filename: /home/src/workspaces/project/package.json //// {} // @Filename: /home/src/workspaces/project/index.ts //// readFile/**/ goTo.marker(""); verify.importFixAtPosition([]); goTo.bof(); edit.insertLine(`import { writeFile } from "node:fs";`); goTo.marker(""); verify.importFixAtPosition([ `import { readFile, writeFile } from "node:fs"; readFile` ]);
{ "end_byte": 633, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportPackageJsonFilterExistingImport3.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider3.ts_0_1722
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/node_modules/common-dependency/package.json //// { "name": "common-dependency" } // @Filename: /home/src/workspaces/project/node_modules/common-dependency/index.d.ts //// export declare class CommonDependency {} // @Filename: /home/src/workspaces/project/node_modules/package-dependency/package.json //// { "name": "package-dependency" } // @Filename: /home/src/workspaces/project/node_modules/package-dependency/index.d.ts //// export declare class PackageDependency // @Filename: /home/src/workspaces/project/package.json //// { "private": true, "dependencies": { "common-dependency": "*" } } // @Filename: /home/src/workspaces/project/tsconfig.json //// { "files": [], "references": [{ "path": "packages/a" }] } // @Filename: /home/src/workspaces/project/packages/a/tsconfig.json //// { "compilerOptions": { "target": "esnext", "composite": true } } // @Filename: /home/src/workspaces/project/packages/a/package.json //// { "peerDependencies": { "package-dependency": "*" } } // @Filename: /home/src/workspaces/project/packages/a/index.ts //// /**/ goTo.marker(""); verify.completions({ includes: [{ name: "PackageDependency", hasAction: true, source: "/home/src/workspaces/project/node_modules/package-dependency/index", sortText: completion.SortText.AutoImportSuggestions, isPackageJsonImport: true }, { name: "CommonDependency", hasAction: true, source: "/home/src/workspaces/project/node_modules/common-dependency/index", sortText: completion.SortText.AutoImportSuggestions, isPackageJsonImport: true }], preferences: { includeCompletionsForModuleExports: true } });
{ "end_byte": 1722, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider3.ts" }
TypeScript/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping3.ts_0_2878
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json ////{ //// "compilerOptions": { //// "outDir": "./dist", //// "sourceRoot": "/home/src/workspaces/project/", //// "declaration": true, //// "declarationMap": true, //// "newLine": "lf", //// }, //// "files": ["/home/src/workspaces/project/index.ts"], ////} // @Filename: /home/src/workspaces/project/index.ts // @emitThisFile: true ////export class Foo { //// member: string; //// /*2*/methodName(propName: SomeType): SomeType { return propName; } //// otherMethod() { //// if (Math.random() > 0.5) { //// return {x: 42}; //// } //// return {y: "yes"}; //// } ////} //// ////export interface /*SomeType*/SomeType { //// member: number; ////} // @Filename: /home/src/workspaces/project/mymodule.ts ////import * as mod from "/home/src/workspaces/project/dist/index"; ////const instance = new mod.Foo(); ////instance.[|/*1*/methodName|]({member: 12}); // @Filename: /home/src/workspaces/project/dist/index.js ////"use strict"; ////Object.defineProperty(exports, "__esModule", { value: true }); ////exports.Foo = void 0; ////var Foo = /** @class */ (function () { //// function Foo() { //// } //// Foo.prototype.methodName = function (propName) { return propName; }; //// Foo.prototype.otherMethod = function () { //// if (Math.random() > 0.5) { //// return { x: 42 }; //// } //// return { y: "yes" }; //// }; //// return Foo; ////}()); ////exports.Foo = Foo; //// // @Filename: /home/src/workspaces/project/dist/index.d.ts.map ////{"version":3,"file":"index.d.ts","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} // @Filename: /home/src/workspaces/project/dist/index.d.ts ////export declare class Foo { //// member: string; //// methodName(propName: SomeType): SomeType; //// otherMethod(): { //// x: number; //// y?: undefined; //// } | { //// y: string; //// x?: undefined; //// }; ////} ////export interface SomeType { //// member: number; ////} //////# sourceMappingURL=index.d.ts.map goTo.file("/home/src/workspaces/project/index.ts"); verify.getEmitOutput([ "/home/src/workspaces/project/dist/index.js", "/home/src/workspaces/project/dist/index.d.ts.map", "/home/src/workspaces/project/dist/index.d.ts" ]); verify.baselineGoToImplementation("1");// getImplementationAtPosition verify.baselineGoToType("1");// getTypeDefinitionAtPosition verify.baselineGoToDefinition("1");// getDefinitionAndBoundSpan verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition
{ "end_byte": 2878, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping3.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_exportMap8.ts_0_2062
/// <reference path="../fourslash.ts"/> // Both 'import' and 'require' should be pulled in // @Filename: /home/src/workspaces/project/tsconfig.json //// { //// "compilerOptions": { //// "module": "nodenext" //// } //// } // @Filename: /home/src/workspaces/project/package.json //// { //// "type": "module", //// "dependencies": { //// "dependency": "^1.0.0" //// } //// } // @Filename: /home/src/workspaces/project/node_modules/dependency/package.json //// { //// "type": "module", //// "name": "dependency", //// "version": "1.0.0", //// "exports": { //// "./lol": { //// "import": "./lib/index.js", //// "require": "./lib/lol.js" //// } //// } //// } // @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.d.ts //// export function fooFromIndex(): void; // @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.d.ts //// export function fooFromLol(): void; // @Filename: /home/src/workspaces/project/src/bar.ts //// import { fooFromIndex } from "dependency"; // @Filename: /home/src/workspaces/project/src/foo.cts //// fooFrom/*cts*/ // @Filename: /home/src/workspaces/project/src/foo.mts //// fooFrom/*mts*/ goTo.marker("cts"); verify.completions({ marker: "cts", includes: [{ name: "fooFromLol", source: "dependency/lol", sourceDisplay: "dependency/lol", sortText: completion.SortText.AutoImportSuggestions, hasAction: true, }], excludes: "fooFromIndex", preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, allowIncompleteCompletions: true, }, }); goTo.marker("mts"); verify.completions({ marker: "mts", includes: [{ name: "fooFromIndex", source: "dependency/lol", sourceDisplay: "dependency/lol", sortText: completion.SortText.AutoImportSuggestions, hasAction: true, }], excludes: "fooFromLol", preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, allowIncompleteCompletions: true, }, });
{ "end_byte": 2062, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_exportMap8.ts" }
TypeScript/tests/cases/fourslash/server/autoImportNodeModuleSymlinkRenamed.ts_0_1930
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/solution/package.json //// { //// "name": "monorepo", //// "workspaces": ["packages/*"] //// } // @Filename: /home/src/workspaces/solution/packages/utils/package.json //// { //// "name": "utils", //// "version": "1.0.0", //// "exports": "./dist/index.js" //// } // @Filename: /home/src/workspaces/solution/packages/utils/tsconfig.json //// { //// "compilerOptions": { //// "composite": true, //// "module": "nodenext", //// "rootDir": "src", //// "outDir": "dist" //// }, //// "include": ["src"] //// } // @Filename: /home/src/workspaces/solution/packages/utils/src/index.ts //// export function gainUtility() { return 0; } // @Filename: /home/src/workspaces/solution/packages/web/package.json //// { //// "name": "web", //// "version": "1.0.0", //// "dependencies": { //// "@monorepo/utils": "file:../utils" //// } //// } // @Filename: /home/src/workspaces/solution/packages/web/tsconfig.json //// { //// "compilerOptions": { //// "composite": true, //// "module": "esnext", //// "moduleResolution": "bundler", //// "rootDir": "src", //// "outDir": "dist", //// "emitDeclarationOnly": true //// }, //// "include": ["src"], //// "references": [ //// { "path": "../utils" } //// ] //// } // @Filename: /home/src/workspaces/solution/packages/web/src/index.ts //// gainUtility/**/ // @link: /home/src/workspaces/solution/packages/utils -> /home/src/workspaces/solution/node_modules/utils // @link: /home/src/workspaces/solution/packages/utils -> /home/src/workspaces/solution/node_modules/@monorepo/utils // @link: /home/src/workspaces/solution/packages/web -> /home/src/workspaces/solution/node_modules/web goTo.marker(""); verify.importFixModuleSpecifiers("", ["@monorepo/utils"]);
{ "end_byte": 1930, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportNodeModuleSymlinkRenamed.ts" }
TypeScript/tests/cases/fourslash/server/importSuggestionsCache_coreNodeModules.ts_0_1515
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json ////{ //// "compilerOptions": { //// "module": "esnext", //// "allowJs": true, //// "checkJs": true, //// "typeRoots": [ //// "node_modules/@types" //// ] //// }, //// "include": ["**/*"], //// "typeAcquisition": { //// "enable": true //// } ////} // @Filename: /home/src/workspaces/project/node_modules/@types/node/index.d.ts ////declare module 'fs' { //// export function readFile(): void; ////} ////declare module 'util' { //// export function promisify(): void; ////} // @Filename: /home/src/workspaces/project/package.json ////{} // @Filename: /home/src/workspaces/project/a.js //// ////readF/**/ verifyExcludes("readFile"); edit.replaceLine(0, "import { promisify } from 'util';"); verifyIncludes("readFile"); edit.deleteLine(0); verifyExcludes("readFile"); function verifyIncludes(name: string) { goTo.marker(""); verify.completions({ includes: { name, source: "fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }, preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, }, }); } function verifyExcludes(name: string) { goTo.marker(""); verify.completions({ excludes: name, preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, }, }); }
{ "end_byte": 1515, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/importSuggestionsCache_coreNodeModules.ts" }
TypeScript/tests/cases/fourslash/server/goToSource8_mapFromAtTypes.ts_0_2860
/// <reference path="../fourslash.ts" /> // @moduleResolution: node // @Filename: /home/src/workspaces/project/node_modules/lodash/package.json //// { "name": "lodash", "version": "4.17.15", "main": "./lodash.js" } // @Filename: /home/src/workspaces/project/node_modules/lodash/lodash.js //// ;(function() { //// /** //// * Adds two numbers. //// * //// * @static //// * @memberOf _ //// * @since 3.4.0 //// * @category Math //// * @param {number} augend The first number in an addition. //// * @param {number} addend The second number in an addition. //// * @returns {number} Returns the total. //// * @example //// * //// * _.add(6, 4); //// * // => 10 //// */ //// var [|/*variable*/add|] = createMathOperation(function(augend, addend) { //// return augend + addend; //// }, 0); //// //// function lodash(value) {} //// lodash.[|/*property*/add|] = add; //// //// /** Detect free variable `global` from Node.js. */ //// var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; //// /** Detect free variable `self`. */ //// var freeSelf = typeof self == 'object' && self && self.Object === Object && self; //// /** Used as a reference to the global object. */ //// var root = freeGlobal || freeSelf || Function('return this')(); //// /** Detect free variable `exports`. */ //// var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;//// //// /** Detect free variable `module`. */ //// var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; //// if (freeModule) { //// // Export for Node.js. //// (freeModule.exports = _)._ = _; //// // Export for CommonJS support. //// freeExports._ = _; //// } //// else { //// // Export to the global object. //// root._ = _; //// } //// }.call(this)); // @Filename: /home/src/workspaces/project/node_modules/@types/lodash/package.json //// { "name": "@types/lodash", "version": "4.14.97", "types": "index.d.ts" } // @Filename: /home/src/workspaces/project/node_modules/@types/lodash/index.d.ts //// /// <reference path="./common/math.d.ts" /> //// export = _; //// export as namespace _; //// declare const _: _.LoDashStatic; //// declare namespace _ { //// interface LoDashStatic {} //// } // @Filename: /home/src/workspaces/project/node_modules/@types/lodash/common/math.d.ts //// import _ = require("../index"); //// declare module "../index" { //// interface LoDashStatic { //// add(augend: number, addend: number): number; //// } //// } // @Filename: /home/src/workspaces/project/index.ts //// import { [|/*start*/add|] } from 'lodash'; verify.baselineGoToSourceDefinition("start");
{ "end_byte": 2860, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource8_mapFromAtTypes.ts" }
TypeScript/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInlineSources.ts_0_3860
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json ////{ //// "compilerOptions": { //// "outDir": "./dist", //// "inlineSourceMap": true, //// "inlineSources": true, //// "declaration": true, //// "declarationMap": true, //// "newLine": "lf", //// }, //// "files": ["/home/src/workspaces/project/index.ts"], ////} // @Filename: /home/src/workspaces/project/index.ts // @emitThisFile: true ////export class Foo { //// member: string; //// /*2*/methodName(propName: SomeType): SomeType { return propName; } //// otherMethod() { //// if (Math.random() > 0.5) { //// return {x: 42}; //// } //// return {y: "yes"}; //// } ////} //// ////export interface /*SomeType*/SomeType { //// member: number; ////} // @Filename: /home/src/workspaces/project/mymodule.ts ////import * as mod from "/home/src/workspaces/project/dist/index"; ////const instance = new mod.Foo(); ////instance.[|/*1*/methodName|]({member: 12}); // @Filename: /home/src/workspaces/project/dist/index.js ////"use strict"; ////Object.defineProperty(exports, "__esModule", { value: true }); ////exports.Foo = void 0; ////var Foo = /** @class */ (function () { //// function Foo() { //// } //// Foo.prototype.methodName = function (propName) { return propName; }; //// Foo.prototype.otherMethod = function () { //// if (Math.random() > 0.5) { //// return { x: 42 }; //// } //// return { y: "yes" }; //// }; //// return Foo; ////}()); ////exports.Foo = Foo; //////# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQTtJQUFBO0lBU0EsQ0FBQztJQVBHLHdCQUFVLEdBQVYsVUFBVyxRQUFrQixJQUFjLE9BQU8sUUFBUSxDQUFDLENBQUMsQ0FBQztJQUM3RCx5QkFBVyxHQUFYO1FBQ0ksSUFBSSxJQUFJLENBQUMsTUFBTSxFQUFFLEdBQUcsR0FBRyxFQUFFLENBQUM7WUFDdEIsT0FBTyxFQUFDLENBQUMsRUFBRSxFQUFFLEVBQUMsQ0FBQztRQUNuQixDQUFDO1FBQ0QsT0FBTyxFQUFDLENBQUMsRUFBRSxLQUFLLEVBQUMsQ0FBQztJQUN0QixDQUFDO0lBQ0wsVUFBQztBQUFELENBQUMsQUFURCxJQVNDO0FBVFksa0JBQUciLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY2xhc3MgRm9vIHtcbiAgICBtZW1iZXI6IHN0cmluZztcbiAgICBtZXRob2ROYW1lKHByb3BOYW1lOiBTb21lVHlwZSk6IFNvbWVUeXBlIHsgcmV0dXJuIHByb3BOYW1lOyB9XG4gICAgb3RoZXJNZXRob2QoKSB7XG4gICAgICAgIGlmIChNYXRoLnJhbmRvbSgpID4gMC41KSB7XG4gICAgICAgICAgICByZXR1cm4ge3g6IDQyfTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4ge3k6IFwieWVzXCJ9O1xuICAgIH1cbn1cblxuZXhwb3J0IGludGVyZmFjZSBTb21lVHlwZSB7XG4gICAgbWVtYmVyOiBudW1iZXI7XG59Il19 // @Filename: /home/src/workspaces/project/dist/index.d.ts.map ////{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} // @Filename: /home/src/workspaces/project/dist/index.d.ts ////export declare class Foo { //// member: string; //// methodName(propName: SomeType): SomeType; //// otherMethod(): { //// x: number; //// y?: undefined; //// } | { //// y: string; //// x?: undefined; //// }; ////} ////export interface SomeType { //// member: number; ////} //////# sourceMappingURL=index.d.ts.map goTo.file("/home/src/workspaces/project/index.ts"); verify.getEmitOutput([ "/home/src/workspaces/project/dist/index.js", "/home/src/workspaces/project/dist/index.d.ts.map", "/home/src/workspaces/project/dist/index.d.ts"] ); verify.baselineGoToImplementation("1");// getImplementationAtPosition verify.baselineGoToType("1");// getTypeDefinitionAtPosition verify.baselineGoToDefinition("1");// getDefinitionAndBoundSpan verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition
{ "end_byte": 3860, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInlineSources.ts" }
TypeScript/tests/cases/fourslash/server/rewriteRelativeImportExtensionsProjectReferences1.ts_0_1234
/// <reference path="../fourslash.ts" /> // @Filename: packages/common/tsconfig.json //// { //// "compilerOptions": { //// "composite": true, //// "rootDir": "src", //// "outDir": "dist", //// "module": "nodenext", //// } //// } // @Filename: packages/common/package.json //// { //// "name": "common", //// "version": "1.0.0", //// "type": "module", //// "exports": { //// ".": { //// "source": "./src/index.ts", //// "default": "./dist/index.js" //// } //// } //// } // @Filename: packages/common/src/index.ts //// export {}; // @Filename: packages/main/tsconfig.json //// { //// "compilerOptions": { //// "module": "nodenext", //// "rewriteRelativeImportExtensions": true, //// "rootDir": "src", //// "outDir": "dist", //// }, //// "references": [ //// { "path": "../common" } //// ] //// } // @Filename: packages/main/package.json //// { "type": "module" } // @Filename: packages/main/src/index.ts //// import {} from "../../common/src/index.ts"; goTo.file("/tests/cases/fourslash/server/packages/main/src/index.ts"); verify.baselineSyntacticAndSemanticDiagnostics();
{ "end_byte": 1234, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/rewriteRelativeImportExtensionsProjectReferences1.ts" }