_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportPaths_withExtension.ts_0_414
/// <reference path="fourslash.ts" /> // @Filename: /src/a.ts ////[|foo|] // @Filename: /src/thisHasPathMapping.ts ////export function foo() {}; // @Filename: /tsconfig.json ////{ //// "compilerOptions": { //// "baseUrl": ".", //// "paths": { //// "foo": ["src/thisHasPathMapping.ts"] //// } //// } ////} verify.importFixAtPosition([ `import { foo } from "foo"; foo` ]);
{ "end_byte": 414, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportPaths_withExtension.ts" }
TypeScript/tests/cases/fourslash/tsxGoToDefinitionUnionElementType2.ts_3_460
/ <reference path='fourslash.ts' /> //@Filename: file.tsx // @jsx: preserve // @noLib: true //// class RC1 extends React.Component<{}, {}> { //// render() { //// return null; //// } //// } //// class RC2 extends React.Component<{}, {}> { //// render() { //// return null; //// } //// private method() { } //// } //// var /*pt1*/RCComp = RC1 || RC2; //// <[|RC/*one*/Comp|] /> verify.baselineGoToDefinition("one");
{ "end_byte": 460, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxGoToDefinitionUnionElementType2.ts" }
TypeScript/tests/cases/fourslash/codeFixChangeJSDocSyntax17.ts_0_176
/// <reference path='fourslash.ts' /> //// declare function index(ix: number): [|*|]; verify.codeFix({ description: "Change '*' to 'any'", newRangeContent: "any", });
{ "end_byte": 176, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixChangeJSDocSyntax17.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingAwait_argument.ts_0_289
/// <reference path="fourslash.ts" /> ////async function fn(a: Promise<string>, b: string) { //// fn(a, a); ////} verify.codeFix({ description: ts.Diagnostics.Add_await.message, index: 0, newFileContent: `async function fn(a: Promise<string>, b: string) { fn(a, await a); }` });
{ "end_byte": 289, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAwait_argument.ts" }
TypeScript/tests/cases/fourslash/callHierarchyClassStaticBlock.ts_0_428
/// <reference path="fourslash.ts" /> //// class C { //// static { //// function foo() { //// bar(); //// } //// //// function /**/bar() { //// baz(); //// quxx(); //// baz(); //// } //// //// foo(); //// } //// } //// //// function baz() { //// } //// //// function quxx() { //// } goTo.marker(); verify.baselineCallHierarchy();
{ "end_byte": 428, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/callHierarchyClassStaticBlock.ts" }
TypeScript/tests/cases/fourslash/refactorInferFunctionReturnType10.ts_0_401
/// <reference path='fourslash.ts' /> ////function /*a*/foo/*b*/(x: number) { //// return x ? x : x > 1; ////} goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Infer function return type", actionName: "Infer function return type", actionDescription: "Infer function return type", newContent: `function foo(x: number): number | boolean { return x ? x : x > 1; }` });
{ "end_byte": 401, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorInferFunctionReturnType10.ts" }
TypeScript/tests/cases/fourslash/smartIndentOnUnclosedFunctionDeclaration06.ts_0_266
/// <reference path='fourslash.ts' /> ////function f<A,B,C>(a: A, b:B, c, d: C): { ////{| "indent": 4 |} ////} { ////{| "indent": 4 |} test.markers().forEach(marker => { verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent); });
{ "end_byte": 266, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentOnUnclosedFunctionDeclaration06.ts" }
TypeScript/tests/cases/fourslash/completionsPropertiesPriorities.ts_0_764
/// <reference path="fourslash.ts" /> // @strict: true //// interface I { //// B?: number; //// a: number; //// c?: string; //// d: string //// } //// const foo = { //// a: 1, //// B: 2 //// } //// const i: I = { //// ...foo, //// /*a*/ //// } verify.completions( { marker: ['a'], exact: [ { name: 'd', sortText: completion.SortText.LocationPriority, kind: 'property' }, { name: 'c', kindModifiers: 'optional', sortText: completion.SortText.OptionalMember, kind: 'property' }, { name: 'a', sortText: completion.SortText.MemberDeclaredBySpreadAssignment, kind: 'property' }, { name: 'B', kindModifiers: 'optional', sortText: completion.SortText.MemberDeclaredBySpreadAssignment, kind: 'property' }, ] } );
{ "end_byte": 764, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsPropertiesPriorities.ts" }
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsClass.ts_0_158
/// <reference path='fourslash.ts'/> ////class /*1*/c { ////} ////var /*2*/cInstance = new /*3*/c(); ////var /*4*/cVal = /*5*/c; verify.baselineQuickInfo();
{ "end_byte": 158, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsClass.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionJsDocImportTag5.ts_0_307
/// <reference path='fourslash.ts'/> // @allowJS: true // @checkJs: true // @Filename: /b.ts ////export interface /*2*/A { } // @Filename: /a.js /////** //// * @import { A } from "./b"; //// */ //// /////** //// * @param { [|A/*1*/|] } a //// */ ////function f(a) {} verify.baselineGoToDefinition("1");
{ "end_byte": 307, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionJsDocImportTag5.ts" }
TypeScript/tests/cases/fourslash/autoImport_node12_node_modules1.ts_0_236
/// <reference path="fourslash.ts" /> // @module: node16 // @Filename: /node_modules/undici/index.d.ts //// export function request(): any; // @Filename: /index.mts //// request/**/ verify.importFixModuleSpecifiers("", ["undici"]);
{ "end_byte": 236, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImport_node12_node_modules1.ts" }
TypeScript/tests/cases/fourslash/extract-method32.ts_0_653
/// <reference path='fourslash.ts' /> // @Filename: /a.ts ////export interface A { //// x: number; ////} ////export const a: A = { x: 1 }; // @Filename: /b.ts ////import { a } from "./a"; //// ////function foo() { //// const arg = a; //// /*a*/console.log(arg);/*b*/ ////} goTo.file("/b.ts"); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_1", actionDescription: "Extract to function in module scope", newContent: `import { A, a } from "./a"; function foo() { const arg = a; /*RENAME*/newFunction(arg); } function newFunction(arg: A) { console.log(arg); } ` });
{ "end_byte": 653, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method32.ts" }
TypeScript/tests/cases/fourslash/findAllReferencesJsDocTypeLiteral.ts_0_505
// @allowJs: true // @checkJs: true /// <reference path='fourslash.ts' /> // @Filename: foo.js /////** //// * @param {object} o - very important! //// * @param {string} o.x - a thing, its ok //// * @param {number} o.y - another thing //// * @param {Object} o.nested - very nested //// * @param {boolean} o.nested./*1*/great - much greatness //// * @param {number} o.nested.times - twice? probably!?? //// */ //// function f(o) { return o.nested./*2*/great; } verify.baselineFindAllReferences('1', '2');
{ "end_byte": 505, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferencesJsDocTypeLiteral.ts" }
TypeScript/tests/cases/fourslash/referencesForLabel2.ts_0_231
/// <reference path='fourslash.ts'/> // References to undefined label ////var label = "label"; ////while (true) { //// if (false) break /**/label; //// if (true) continue label; ////} verify.baselineFindAllReferences("");
{ "end_byte": 231, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForLabel2.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportNodeModules1.ts_0_331
/// <reference path="fourslash.ts" /> //// [|f1/*0*/();|] // @Filename: ../package.json //// { "dependencies": { "fake-module": "latest" } } // @Filename: ../node_modules/fake-module/nested.ts //// export var v1 = 5; //// export function f1(); verify.importFixAtPosition([ `import { f1 } from "fake-module/nested"; f1();` ]);
{ "end_byte": 331, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportNodeModules1.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_require.ts_0_679
/// <reference path="fourslash.ts" /> // @allowJs: true // @checkJs: true // @Filename: foo.js ////module.exports = function foo() {} // @Filename: utils.js ////function util1() {} ////function util2() {} ////module.exports = { util1, util2 }; // @Filename: blah.js ////export default class Blah {} // @Filename: index.js ////foo(); ////util1(); ////util2(); ////new Blah; goTo.file("index.js"); verify.codeFixAll({ fixId: "fixMissingImport", fixAllDescription: "Add all missing imports", newFileContent: `const { default: Blah } = require("./blah"); const foo = require("./foo"); const { util1, util2 } = require("./utils"); foo(); util1(); util2(); new Blah;` });
{ "end_byte": 679, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_require.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFixUMDGlobal1.ts_0_457
/// <reference path="fourslash.ts" /> // @AllowSyntheticDefaultImports: false // @Module: esnext // @Filename: a/f1.ts //// [|import { bar } from "./foo"; //// //// export function test() { }; //// bar1/*0*/.bar();|] // @Filename: a/foo.d.ts //// export declare function bar(): number; //// export as namespace bar1; verify.importFixAtPosition([ `import * as bar1 from "./foo"; import { bar } from "./foo"; export function test() { }; bar1.bar();` ]);
{ "end_byte": 457, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixUMDGlobal1.ts" }
TypeScript/tests/cases/fourslash/inlineVariableParensBinExpression.ts_0_339
/// <reference path="fourslash.ts" /> ////const /*a*/x/*b*/ = 1 + 2; ////const y = x * 3; goTo.select("a", "b"); verify.refactorAvailable("Inline variable"); edit.applyRefactor({ refactorName: "Inline variable", actionName: "Inline variable", actionDescription: "Inline variable", newContent: "const y = (1 + 2) * 3;" });
{ "end_byte": 339, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableParensBinExpression.ts" }
TypeScript/tests/cases/fourslash/importStatementCompletions_js.ts_0_848
/// <reference path="fourslash.ts" /> // These options resemble the defaults for inferred projects with JS // @allowJs: true // @target: es2020 // @checkJs: true // @module: commonjs // @noEmit: true // @allowSyntheticDefaultImports: true // @Filename: /node_modules/react/index.d.ts //// declare namespace React { //// export class Component {} //// } //// export = React; // @Filename: /test.js //// [|import R/**/|] verify.completions({ marker: "", isNewIdentifierLocation: true, exact: [{ name: "React", source: "react", insertText: `import React$1 from "react";`, isSnippet: true, replacementSpan: test.ranges()[0], sourceDisplay: "react", }], preferences: { includeCompletionsForImportStatements: true, includeInsertTextCompletions: true, includeCompletionsWithSnippetText: true, } });
{ "end_byte": 848, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importStatementCompletions_js.ts" }
TypeScript/tests/cases/fourslash/completionsImport_duplicatePackages_scopedTypesAndNotTypes.ts_0_1648
/// <reference path="fourslash.ts" /> // @module: commonjs // @esModuleInterop: true // @Filename: /node_modules/@types/scope__react-dom/package.json //// { "name": "react-dom", "version": "1.0.0", "types": "./index.d.ts" } // @Filename: /node_modules/@types/scope__react-dom/index.d.ts //// import * as React from "react"; //// export function render(): void; // @Filename: /node_modules/@types/scope__react/package.json //// { "name": "react", "version": "1.0.0", "types": "./index.d.ts" } // @Filename: /node_modules/@types/scope__react/index.d.ts //// import "./other"; //// export declare function useState(): void; // @Filename: /node_modules/@types/scope__react/other.d.ts //// export declare function useRef(): void; // @Filename: /packages/a/node_modules/@scope/react/package.json //// { "name": "react", "version": "1.0.1", "types": "./index.d.ts" } // @Filename: /packages/a/node_modules/@scope/react/index.d.ts //// export declare function useState(): void; // @Filename: /packages/a/index.ts //// import "react-dom"; //// import "react"; // @Filename: /packages/a/foo.ts //// /**/ goTo.marker(""); verify.completions({ marker: "", exact: completion.globalsPlus([{ name: "render", source: "@scope/react-dom", sourceDisplay: "@scope/react-dom", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }, { name: "useState", source: "@scope/react", sourceDisplay: "@scope/react", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }]), preferences: { includeCompletionsForModuleExports: true, allowIncompleteCompletions: true, }, });
{ "end_byte": 1648, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_duplicatePackages_scopedTypesAndNotTypes.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceUndeclaredSymbol.ts_0_614
/// <reference path='fourslash.ts' /> //// interface I { //// x: T; //// } //// //// class C implements I { } // T is not a declared symbol. There are a couple fixes: // 1) Declare T. // 2) Rename T to an existing symbol. // 3) Make T a type parameter to I. // // In the latter two cases, it is premature to copy `x:T` into C. // Since we can't guess the programmer's intent here, we do nothing. // TODO: (aozgaa) Acknowledge other errors on class/implemented interface/extended abstract class. // Should be verify.codeFixAvailable([]); verify.codeFixAvailable([{ description: "Implement interface 'I'" }]);
{ "end_byte": 614, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceUndeclaredSymbol.ts" }
TypeScript/tests/cases/fourslash/refactorOverloadListToSingleSignature6.ts_0_574
/// <reference path='fourslash.ts' /> ////interface A { //// /*a*/(): void; //// (a: string): void; //// (a: number, b: number): void; //// (...rest: symbol[]): void;/*b*/ ////} goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Convert overload list to single signature", actionName: "Convert overload list to single signature", actionDescription: ts.Diagnostics.Convert_overload_list_to_single_signature.message, newContent: `interface A { (...args: [] | [a: string] | [a: number, b: number] | [...rest: symbol[]]): void; }`, });
{ "end_byte": 574, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorOverloadListToSingleSignature6.ts" }
TypeScript/tests/cases/fourslash/thisPredicateFunctionCompletions02.ts_0_980
/// <reference path="fourslash.ts" /> //// interface Sundries { //// broken: boolean; //// } //// //// interface Supplies { //// spoiled: boolean; //// } //// //// interface Crate<T> { //// contents: T; //// isSundries(): this is Crate<Sundries>; //// isSupplies(): this is Crate<Supplies>; //// isPackedTight(): this is (this & {extraContents: T}); //// } //// const crate: Crate<any>; //// if (crate.isPackedTight()) { //// crate./*1*/; //// } //// if (crate.isSundries()) { //// crate.contents./*2*/; //// if (crate.isPackedTight()) { //// crate./*3*/; //// } //// } //// if (crate.isSupplies()) { //// crate.contents./*4*/; //// if (crate.isPackedTight()) { //// crate./*5*/; //// } //// } verify.completions( { marker: ["1", "3", "5"], exact: ["contents", "extraContents", "isPackedTight", "isSundries", "isSupplies"] }, { marker: "2", exact: "broken" }, { marker: "4", exact: "spoiled" }, );
{ "end_byte": 980, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/thisPredicateFunctionCompletions02.ts" }
TypeScript/tests/cases/fourslash/memberListOnExplicitThis.ts_0_846
/// <reference path='fourslash.ts'/> ////interface Restricted { //// n: number; ////} ////class C1 implements Restricted { //// n: number; //// m: number; //// f(this: this) {this./*1*/} // test on 'this.' //// g(this: Restricted) {this./*2*/} ////} ////function f(this: void) {this./*3*/} ////function g(this: Restricted) {this./*4*/} verify.completions( { marker: "1", exact: [ { name: "f", text: "(method) C1.f(this: this): void" }, { name: "g", text: "(method) C1.g(this: Restricted): void" }, { name: "m", text: "(property) C1.m: number" }, { name: "n", text: "(property) C1.n: number" }, ], }, { marker: ["2", "4"], exact: { name: "n", text: "(property) Restricted.n: number" }, }, { marker: "3", exact: undefined }, );
{ "end_byte": 846, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListOnExplicitThis.ts" }
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_importSpecifier5.ts_0_316
/// <reference path="fourslash.ts" /> // @noUnusedLocals: true ////[|import { //// a, //// b, //// //// //// c, ////} from "fs";|] //// ////a; ////c; verify.codeFix({ index: 0, description: "Remove unused declaration for: 'b'", newRangeContent: `import { a, c, } from "fs";` });
{ "end_byte": 316, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_importSpecifier5.ts" }
TypeScript/tests/cases/fourslash/convertFunctionToEs6Class4.ts_0_360
/// <reference path='fourslash.ts' /> // @allowNonTsExtensions: true // @Filename: foo.js ////function Foo() { //// this.a = 0; ////} ////Foo.prototype["b"] = function () { ////} verify.codeFix({ description: "Convert function to an ES2015 class", newFileContent: `class Foo { constructor() { this.a = 0; } b() { } } ` });
{ "end_byte": 360, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/convertFunctionToEs6Class4.ts" }
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction28.ts_0_398
/// <reference path='fourslash.ts' /> //// const a = (a: number) /*a*/=>/*b*/ { return a; /* c */ /* d */ }; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Add or remove braces in an arrow function", actionName: "Remove braces from arrow function", actionDescription: "Remove braces from arrow function", newContent: `const a = (a: number) => a /* c */ /* d */;`, });
{ "end_byte": 398, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction28.ts" }
TypeScript/tests/cases/fourslash/inlayHintsInteractiveAnyParameter1.ts_0_286
/// <reference path="fourslash.ts" /> //// function foo (v: any) {} //// foo(1); //// foo(''); //// foo(true); //// foo(foo); //// foo((1)); //// foo(foo(1)); verify.baselineInlayHints(undefined, { includeInlayParameterNameHints: "literals", interactiveInlayHints: true });
{ "end_byte": 286, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsInteractiveAnyParameter1.ts" }
TypeScript/tests/cases/fourslash/autoImportCompletionExportListAugmentation2.ts_0_1610
/// <reference path="fourslash.ts" /> // @module: nodenext // @Filename: /node_modules/@sapphire/pieces/index.d.ts //// interface Container { //// stores: unknown; //// } //// //// declare class Piece { //// get container(): Container; //// } //// //// declare class AliasPiece extends Piece {} //// //// export { AliasPiece, type Container }; // @Filename: /node_modules/@sapphire/framework/index.d.ts //// import { AliasPiece } from "@sapphire/pieces"; //// //// declare class Command extends AliasPiece {} //// //// declare module "@sapphire/pieces" { //// interface Container { //// client: unknown; //// } //// } //// //// export { Command }; // @Filename: /index.ts //// import "@sapphire/pieces"; //// import { Command } from "@sapphire/framework"; //// class PingCommand extends Command { //// /*1*/ //// } const preferences = { includeCompletionsWithClassMemberSnippets: true, includeCompletionsWithInsertText: true, }; verify.completions({ marker: "1", includes: [ { name: "container", insertText: "get container(): Container {\n}", filterText: "container", hasAction: true, source: "ClassMemberSnippet/", }, ], preferences, isNewIdentifierLocation: true, }); verify.applyCodeActionFromCompletion("1", { name: "container", source: "ClassMemberSnippet/", description: `Includes imports of types referenced by 'container'`, newFileContent: `import "@sapphire/pieces"; import { Command } from "@sapphire/framework"; import { Container } from "@sapphire/pieces"; class PingCommand extends Command { }`, preferences, });
{ "end_byte": 1610, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportCompletionExportListAugmentation2.ts" }
TypeScript/tests/cases/fourslash/unusedImportDeclaration_withEmptyPath3.ts_0_434
/// <reference path='fourslash.ts' /> // @Filename: /a.ts ////// leading trivia ////import { b } from "./b"; ////import { c } from "./c"; ////import * as foo from ""; // @Filename: /b.ts ////export const b = null; // @Filename: /c.ts ////export const c = null; verify.codeFix({ index: 2, description: "Remove import from ''", newFileContent: `// leading trivia import { b } from "./b"; import { c } from "./c"; `, });
{ "end_byte": 434, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedImportDeclaration_withEmptyPath3.ts" }
TypeScript/tests/cases/fourslash/moveToFile_existingImports4.ts_0_621
/// <reference path='fourslash.ts' /> // @allowJs: true // @module: commonjs // @filename: /common.js ////export const x = 1; // @filename: /a.js ////const { x } = require("./common"); ////module.exports.a = x; ////[|module.exports.b = x;|] // @filename: /b.js ////const { x } = require("./common"); ////module.exports.a = x; verify.moveToFile({ newFileContents: { "/a.js": `const { x } = require("./common"); module.exports.a = x; `, "/b.js": `const { x } = require("./common"); module.exports.a = x; module.exports.b = x; `, }, interactiveRefactorArguments: { targetFile: "/b.js" }, });
{ "end_byte": 621, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_existingImports4.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceAutoImports.ts_0_907
/// <reference path='fourslash.ts' /> // @Filename: types1.ts ////type A = {}; ////export default A; // @Filename: types2.ts ////export type B = {}; ////export type C = {}; ////export type D<T> = {}; // @Filename: interface.ts ////import A from './types1'; ////import { B, C, D } from './types2'; //// ////export interface Base { //// a: Readonly<A> & { kind: "a"; }; //// b<T extends B = B>(p1: C): D<C>; ////} // @Filename: index.ts ////import { Base } from './interface'; //// ////export class C implements Base {[| |]} goTo.file('index.ts'); verify.codeFix({ description: "Implement interface 'Base'", newFileContent: `import { Base } from './interface'; import A from './types1'; import { B, C, D } from './types2'; export class C implements Base { a: Readonly<A> & { kind: 'a'; }; b<T extends B = B>(p1: C): D<C> { throw new Error('Method not implemented.'); } }`, });
{ "end_byte": 907, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceAutoImports.ts" }
TypeScript/tests/cases/fourslash/codeFixChangeJSDocSyntax23.ts_0_179
/// <reference path='fourslash.ts' /> ////class C { //// m(): [|*|] { //// } ////} verify.codeFix({ description: "Change '*' to 'any'", newRangeContent: "any", });
{ "end_byte": 179, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixChangeJSDocSyntax23.ts" }
TypeScript/tests/cases/fourslash/refactorInferFunctionReturnType24.ts_0_201
/// <reference path='fourslash.ts' /> ////let x = 10;/*a*//*b*/ //// ////function func() { //// return 10; ////} goTo.select("a", "b"); verify.not.refactorAvailable("Infer function return type");
{ "end_byte": 201, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorInferFunctionReturnType24.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionImportedNames10.ts_0_321
/// <reference path='fourslash.ts' /> // @allowjs: true // @Filename: a.js //// class /*classDefinition*/Class { //// f; //// } //// module.exports.Class = Class; // @Filename: b.js ////const { Class } = require("./a"); //// [|/*classAliasDefinition*/Class|]; verify.baselineGoToDefinition("classAliasDefinition");
{ "end_byte": 321, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionImportedNames10.ts" }
TypeScript/tests/cases/fourslash/goToTypeDefinitionModule.ts_0_275
/// <reference path='fourslash.ts' /> // @Filename: module1.ts ////module /*definition*/M { //// export var p; ////} ////var m: typeof M; // @Filename: module3.ts /////*reference1*/M; /////*reference2*/m; verify.baselineGoToType( "reference1", "reference2", );
{ "end_byte": 275, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToTypeDefinitionModule.ts" }
TypeScript/tests/cases/fourslash/completionsCommentsFunctionExpression.ts_0_1169
/// <reference path='fourslash.ts' /> // test arrow doc comments /////** lambdaFoo var comment*/ ////var lambdaFoo = /** this is lambda comment*/ (/**param a*/a: number, /**param b*/b: number) => /*2*/a + b; ////var lambddaNoVarComment = /** this is lambda multiplication*/ (/**param a*/a: number, /**param b*/b: number) => a * b; /////*4*/lambdaFoo(10, 20); // test nested arrow doc comments ////function anotherFunc(a: number) { //// /** documentation //// @param b {string} inner parameter */ //// var lambdaVar = /** inner docs */(b: string) => { //// var localVar = "Hello "; //// return localVar + b; //// } //// return lambdaVar("World") + a; ////} // test function expression doc comments /////** //// * On variable //// * @param s the first parameter! //// * @returns the parameter's length //// */ ////var assigned = /** //// * Summary on expression //// * @param s param on expression //// * @returns return on expression //// */function(/** On parameter */s: string) { //// return /*15*/s.length; ////} ////assigned/*17*/("hey"); verify.baselineCompletions()
{ "end_byte": 1169, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsCommentsFunctionExpression.ts" }
TypeScript/tests/cases/fourslash/navto_excludeLib3.ts_0_381
/// <reference path="fourslash.ts"/> // @filename: /index.ts //// [|function parseInt(s: string): number {}|] const [local] = test.ranges(); verify.navigateTo({ pattern: "parseInt", excludeLibFiles: true, expected: [ { name: "parseInt", kind: "function", range: local, matchKind: "exact", }, ], });
{ "end_byte": 381, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navto_excludeLib3.ts" }
TypeScript/tests/cases/fourslash/completionsObjectLiteralMethod3.ts_0_4553
/// <reference path="fourslash.ts" /> // @newline: LF // @strictNullChecks: true // @Filename: a.ts ////interface I1 { //// M(x: number): void; ////} ////interface I2 { //// M(x: number): void; ////} ////const u: I1 | I2 = { //// /*a*/ ////} ////const i: I1 & I2 = { //// /*b*/ ////} ////interface U1 { //// M(x: number): string; ////} ////interface U2 { //// M(x: string): number; ////} ////const o: U1 | U2 = { //// /*c*/ ////} ////interface Op { //// M?(x: number): void; //// N: ((x: string) => void) | null | undefined; //// O?: () => void; ////} ////const op: Op = { //// /*d*/ ////} verify.completions({ marker: "a", preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithObjectLiteralMethodSnippets: true, useLabelDetailsInCompletionEntries: true, }, includes: [ { name: "M", sortText: completion.SortText.ObjectLiteralProperty(completion.SortText.LocationPriority, "M"), insertText: undefined, }, { name: "M", sortText: completion.SortText.SortBelow( completion.SortText.ObjectLiteralProperty(completion.SortText.LocationPriority, "M")), source: completion.CompletionSource.ObjectLiteralMethodSnippet, insertText: "M(x) {\n},", labelDetails: { detail: "(x)", }, }, ], }); verify.completions({ marker: "b", preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithObjectLiteralMethodSnippets: true, }, includes: [ { name: "M", sortText: completion.SortText.ObjectLiteralProperty(completion.SortText.LocationPriority, "M"), insertText: undefined, }, // No signature completion because type of `M` is intersection type ], }); verify.completions({ marker: "c", preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithObjectLiteralMethodSnippets: true, }, exact: [ { name: "M", sortText: completion.SortText.ObjectLiteralProperty(completion.SortText.LocationPriority, "M"), insertText: undefined, }, // No signature completion because type of `M` is intersection type ], }); verify.completions({ marker: "d", preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithObjectLiteralMethodSnippets: true, useLabelDetailsInCompletionEntries: true, }, includes: [ { name: "M", sortText: completion.SortText.ObjectLiteralProperty(completion.SortText.OptionalMember, "M"), insertText: undefined, }, { name: "M", sortText: completion.SortText.SortBelow( completion.SortText.ObjectLiteralProperty(completion.SortText.OptionalMember, "M")), source: completion.CompletionSource.ObjectLiteralMethodSnippet, insertText: "M(x) {\n},", labelDetails: { detail: "(x)", }, }, { name: "N", sortText: completion.SortText.ObjectLiteralProperty(completion.SortText.LocationPriority, "N"), insertText: undefined, }, { name: "N", sortText: completion.SortText.SortBelow( completion.SortText.ObjectLiteralProperty(completion.SortText.LocationPriority, "N")), source: completion.CompletionSource.ObjectLiteralMethodSnippet, insertText: "N(x) {\n},", labelDetails: { detail: "(x)", }, }, { name: "O", sortText: completion.SortText.ObjectLiteralProperty(completion.SortText.OptionalMember, "O"), insertText: undefined, }, { name: "O", sortText: completion.SortText.SortBelow( completion.SortText.ObjectLiteralProperty(completion.SortText.OptionalMember, "O")), source: completion.CompletionSource.ObjectLiteralMethodSnippet, insertText: "O() {\n},", labelDetails: { detail: "()", }, }, ], });
{ "end_byte": 4553, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralMethod3.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_symlink_own_package.ts_0_437
/// <reference path="fourslash.ts" /> // @Filename: /packages/b/b0.ts // @Symlink: /node_modules/b/b0.ts ////x; // @Filename: /packages/b/b1.ts // @Symlink: /node_modules/b/b1.ts ////import { a } from "a"; ////export const x = 0; // @Filename: /packages/a/index.d.ts // @Symlink: /node_modules/a/index.d.ts ////export const a: number; goTo.file("/packages/b/b0.ts"); verify.importFixAtPosition([ `import { x } from "./b1"; x;`, ]);
{ "end_byte": 437, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_symlink_own_package.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleSignaturesRest1.ts_0_750
/// <reference path='fourslash.ts' /> ////interface I { //// method(a: number, ...b: string[]): boolean; //// method(a: string, ...b: number[]): Function; //// method(a: string): Function; ////} //// ////class C implements I {} verify.codeFix({ description: "Implement interface 'I'", newFileContent: `interface I { method(a: number, ...b: string[]): boolean; method(a: string, ...b: number[]): Function; method(a: string): Function; } class C implements I { method(a: number, ...b: string[]): boolean; method(a: string, ...b: number[]): Function; method(a: string): Function; method(a: unknown, ...b?: unknown[]): boolean | Function { throw new Error("Method not implemented."); } }`, });
{ "end_byte": 750, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleSignaturesRest1.ts" }
TypeScript/tests/cases/fourslash/jsdocTemplateTagCompletion.ts_0_209
///<reference path="fourslash.ts" /> /////** //// * @template {/**/} T //// * @typedef {Object} Foo //// * @property {T} foo //// */ verify.completions( { marker: "", exact: completion.globalTypes }, );
{ "end_byte": 209, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocTemplateTagCompletion.ts" }
TypeScript/tests/cases/fourslash/quickInfoOnPropertyAccessInWriteLocation5.ts_0_291
/// <reference path='fourslash.ts'/> // @strict: true //// interface Serializer { //// set value(v: string | number); //// get value(): string; //// } //// declare let box: Serializer; //// box.value/*1*/ += 10; verify.quickInfoAt('1', '(property) Serializer.value: string | number');
{ "end_byte": 291, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnPropertyAccessInWriteLocation5.ts" }
TypeScript/tests/cases/fourslash/codeFixReturnTypeInAsyncFunction15.ts_0_299
/// <reference path='fourslash.ts' /> // @target: es2015 ////const foo = async function (): number {} verify.codeFix({ index: 0, description: [ts.Diagnostics.Replace_0_with_Promise_1.message, "number", "number"], newFileContent: `const foo = async function (): Promise<number> {}` });
{ "end_byte": 299, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixReturnTypeInAsyncFunction15.ts" }
TypeScript/tests/cases/fourslash/completionListAfterClassExtends.ts_0_272
/// <reference path='fourslash.ts'/> ////module Bar { //// export class Bleah { //// } //// export class Foo extends /**/Bleah { //// } ////} //// ////function Blah(x: Bar.Bleah) { ////} verify.completions({ marker: "", includes: ["Bar", "Bleah", "Foo"] });
{ "end_byte": 272, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAfterClassExtends.ts" }
TypeScript/tests/cases/fourslash/fixExactOptionalUnassignableProperties17.ts_0_725
/// <reference path='fourslash.ts'/> // @strictNullChecks: true // @exactOptionalPropertyTypes: true //// interface PropertyAssignment { //// a?: number //// } //// interface J { //// a?: number | undefined //// } //// declare var j: J //// var opa/**/: { pa: PropertyAssignment } = { pa: j } verify.codeFixAvailable([ { description: ts.Diagnostics.Add_undefined_to_optional_property_type.message } ]); verify.codeFix({ description: ts.Diagnostics.Add_undefined_to_optional_property_type.message, index: 0, newFileContent: `interface PropertyAssignment { a?: number | undefined } interface J { a?: number | undefined } declare var j: J var opa: { pa: PropertyAssignment } = { pa: j }`, });
{ "end_byte": 725, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/fixExactOptionalUnassignableProperties17.ts" }
TypeScript/tests/cases/fourslash/stringPropertyNames2.ts_0_194
/// <reference path='fourslash.ts'/> ////export interface Album<T> { //// "artist": T; ////} ////var a: Album<number>; ////var /**/x = a['artist']; verify.quickInfoAt("", "var x: number");
{ "end_byte": 194, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/stringPropertyNames2.ts" }
TypeScript/tests/cases/fourslash/tsxSignatureHelp2.ts_0_1220
/// <reference path='fourslash.ts' /> //@Filename: file.tsx // @jsx: preserve // @noLib: true // @libFiles: react.d.ts,lib.d.ts //// import React = require('react'); //// export interface ClickableProps { //// children?: string; //// className?: string; //// } //// export interface ButtonProps extends ClickableProps { //// onClick(event?: React.MouseEvent<HTMLButtonElement>): void; //// } //// export interface LinkProps extends ClickableProps { //// goTo(where: "home" | "contact"): void; //// } //// function _buildMainButton({ onClick, children, className }: ButtonProps): JSX.Element { //// return(<button className={className} onClick={onClick}>{ children || 'MAIN BUTTON'}</button>); //// } //// export function MainButton(buttonProps: ButtonProps): JSX.Element; //// export function MainButton(linkProps: LinkProps): JSX.Element; //// export function MainButton(props: ButtonProps | LinkProps): JSX.Element { //// return this._buildMainButton(props); //// } //// let e1 = <MainButton/*1*/ /*2*/ verify.signatureHelp({ marker: ["1", "2"], overloadsCount: 2, text: "MainButton(buttonProps: ButtonProps): JSX.Element", parameterSpan: "buttonProps: ButtonProps", });
{ "end_byte": 1220, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxSignatureHelp2.ts" }
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports55-generator-return.ts_0_365
/// <reference path='fourslash.ts'/> // @isolatedDeclarations: true // @declaration: true // @lib: es2015 //// export function *foo() { //// yield 5; //// } verify.codeFix({ description: "Add return type 'Generator<number, void, unknown>'", index: 0, newFileContent: `export function *foo(): Generator<number, void, unknown> { yield 5; }` });
{ "end_byte": 365, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports55-generator-return.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingAsync3.ts_0_413
/// <reference path="fourslash.ts" /> ////const foo = <T>(x: T): string => { //// await new Promise(resolve => resolve(true)); //// return ""; ////} verify.codeFix({ description: ts.Diagnostics.Add_async_modifier_to_containing_function.message, index: 0, newFileContent: `const foo = async <T>(x: T): Promise<string> => { await new Promise(resolve => resolve(true)); return ""; }` });
{ "end_byte": 413, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAsync3.ts" }
TypeScript/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts_js.ts_0_345
/// <reference path="fourslash.ts" /> // @module: nodenext // @Filename: /package.json //// { //// "imports": { //// "#*.ts": "./src/*.js" //// } //// } // @Filename: /src/something.ts //// export function something(name: string): any; // @Filename: /a.ts //// something/**/ verify.importFixModuleSpecifiers("", ["#something.ts"]);
{ "end_byte": 345, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts_js.ts" }
TypeScript/tests/cases/fourslash/codeFixInferFromUsageContextualImport3.ts_0_683
/// <reference path="fourslash.ts" /> // @strict: true // @noImplicitAny: true // @noLib: true // @Filename: /a.ts ////export namespace things { //// export namespace stuff { //// export class User<T> {} //// } ////} ////export declare function getEmail<T>(thing: T, user: things.stuff.User<T>): string; // @Filename: /b.ts ////import { getEmail } from "./a"; //// ////export function f([|user|]) { //// getEmail(42, user); ////} goTo.file("/b.ts"); verify.codeFix({ description: "Infer parameter types from usage", newFileContent: `import { getEmail, things } from "./a"; export function f(user: things.stuff.User<number>) { getEmail(42, user); }` });
{ "end_byte": 683, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageContextualImport3.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess18.ts_0_540
/// <reference path='fourslash.ts' /> //// class A { //// constructor(private /*a*/a/*b*/: string) { } //// } goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Generate 'get' and 'set' accessors", actionName: "Generate 'get' and 'set' accessors", actionDescription: "Generate 'get' and 'set' accessors", newContent: `class A { public get a(): string { return this._a; } public set a(value: string) { this._a = value; } constructor(private /*RENAME*/_a: string) { } }`, });
{ "end_byte": 540, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess18.ts" }
TypeScript/tests/cases/fourslash/autoImportAllowTsExtensions3.ts_0_444
/// <reference path="fourslash.ts" /> // @moduleResolution: bundler // @allowImportingTsExtensions: true // @noEmit: true // @Filename: /local.ts //// export const fromLocal: number; // @Filename: /decl.d.ts //// export const fromDecl: number; // @Filename: /Component.tsx //// export function Component() { return null; } // @Filename: /main.ts //// import { Component } from "./Component.tsx"; //// /**/ verify.baselineAutoImports("");
{ "end_byte": 444, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportAllowTsExtensions3.ts" }
TypeScript/tests/cases/fourslash/generated/dummy.txt_0_61
This file is just here so that git will create the directory.
{ "end_byte": 61, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/generated/dummy.txt" }
TypeScript/tests/cases/fourslash/server/importNameCodeFix_externalNonRelative1.ts_0_1875
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.base.json //// { //// "compilerOptions": { //// "module": "commonjs", //// "paths": { //// "pkg-1/*": ["./packages/pkg-1/src/*"], //// "pkg-2/*": ["./packages/pkg-2/src/*"] //// } //// } //// } // @Filename: /home/src/workspaces/project/packages/pkg-1/package.json //// { "dependencies": { "pkg-2": "*" } } // @Filename: /home/src/workspaces/project/packages/pkg-1/tsconfig.json //// { //// "extends": "../../tsconfig.base.json", //// "references": [ //// { "path": "../pkg-2" } //// ] //// } // @Filename: /home/src/workspaces/project/packages/pkg-1/src/index.ts //// Pkg2/*external*/ // @Filename: /home/src/workspaces/project/packages/pkg-2/package.json //// { "types": "dist/index.d.ts" } // @Filename: /home/src/workspaces/project/packages/pkg-2/tsconfig.json //// { //// "extends": "../../tsconfig.base.json", //// "compilerOptions": { "outDir": "dist", "rootDir": "src", "composite": true } //// } // @Filename: /home/src/workspaces/project/packages/pkg-2/src/index.ts //// import "./utils"; // @Filename: /home/src/workspaces/project/packages/pkg-2/src/utils.ts //// export const Pkg2 = {}; // @Filename: /home/src/workspaces/project/packages/pkg-2/src/blah/foo/data.ts //// Pkg2/*internal*/ // @link: /home/src/workspaces/project/packages/pkg-2 -> /home/src/workspaces/project/packages/pkg-1/node_modules/pkg-2 format.setOption("newline", "\n"); goTo.marker("external"); verify.importFixAtPosition([`import { Pkg2 } from "pkg-2/utils";\n\nPkg2`], /*errorCode*/ undefined, { importModuleSpecifierPreference: "project-relative" }); goTo.marker("internal"); verify.importFixAtPosition([`import { Pkg2 } from "../../utils";\n\nPkg2`], /*errorCode*/ undefined, { importModuleSpecifierPreference: "project-relative" });
{ "end_byte": 1875, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/importNameCodeFix_externalNonRelative1.ts" }
TypeScript/tests/cases/fourslash/server/autoImportCrossProject_symlinks_stripSrc.ts_0_1333
/// <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": ".", //// "paths": { //// "dep/*": ["../dep/src/*"] //// } //// } //// "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/sub/folder";\r \r dep`]);
{ "end_byte": 1333, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportCrossProject_symlinks_stripSrc.ts" }
TypeScript/tests/cases/fourslash/server/jsdocTypedefTagRename01.ts_0_402
/// <reference path="../fourslash.ts"/> // @allowNonTsExtensions: true // @Filename: jsDocTypedef_form1.js //// //// /** @typedef {(string | number)} */ //// [|var [|{| "contextRangeIndex": 0 |}NumberLike|];|] //// //// [|NumberLike|] = 10; //// //// /** @type {[|NumberLike|]} */ //// var numberLike; const [rDef, ...ranges] = test.ranges(); verify.baselineRename(ranges, { findInComments: true });
{ "end_byte": 402, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/jsdocTypedefTagRename01.ts" }
TypeScript/tests/cases/fourslash/server/references01.ts_0_391
/// <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 ///////<reference path="referencesForGlobals_1.ts" /> ////var c = /*1*/globalClass(); verify.baselineFindAllReferences('1')
{ "end_byte": 391, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/references01.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_importsMap2.ts_0_646
/// <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": 646, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_importsMap2.ts" }
TypeScript/tests/cases/fourslash/server/signatureHelp01.ts_0_239
/// <reference path="../fourslash.ts"/> ////function foo(data: number) { ////} //// ////function bar { //// foo(/*1*/) ////} verify.signatureHelp({ marker: "1", argumentCount: 0, parameterCount: 1, docComment: "", });
{ "end_byte": 239, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/signatureHelp01.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_exportMap1.ts_0_1564
/// <reference path="../fourslash.ts"/> // @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": { //// ".": { //// "types": "./lib/index.d.ts" //// }, //// "./lol": { //// "types": "./lib/lol.d.ts" //// } //// } //// } // @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/foo.ts //// fooFrom/**/ goTo.marker(""); verify.completions({ marker: "", includes: [{ name: "fooFromIndex", source: "dependency", sourceDisplay: "dependency", sortText: completion.SortText.AutoImportSuggestions, hasAction: true, }, { name: "fooFromLol", source: "dependency/lol", sourceDisplay: "dependency/lol", sortText: completion.SortText.AutoImportSuggestions, hasAction: true, }], preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, allowIncompleteCompletions: true, }, });
{ "end_byte": 1564, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_exportMap1.ts" }
TypeScript/tests/cases/fourslash/server/renameNamespaceImport.ts_0_690
/// <reference path='../fourslash.ts' /> // @Filename: /home/src/workspaces/project/lib/tsconfig.json //// {} // @Filename: /home/src/workspaces/project/lib/index.ts //// const unrelatedLocalVariable = 123; //// export const someExportedVariable = unrelatedLocalVariable; // @Filename: /home/src/workspaces/project/src/tsconfig.json //// {} // @Filename: /home/src/workspaces/project/src/index.ts //// import * as /*i*/lib from '../lib/index'; //// lib.someExportedVariable; // @Filename: /home/src/workspaces/project/tsconfig.json //// {} goTo.file("/home/src/workspaces/project/lib/index.ts"); goTo.file("/home/src/workspaces/project/src/index.ts"); verify.baselineRename("i", {});
{ "end_byte": 690, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/renameNamespaceImport.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_multiplePastes1.ts_0_995
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/target.ts //// const a = 1; //// [||] //// const b = 2; //// const c = 3; //// [||] //// const d = 4; // @Filename: /home/src/workspaces/project/file1.ts //// export const p = 10; //// export const q = 12; // @Filename: /home/src/workspaces/project/file3.ts //// export const r = 10; //// export const s = 12; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["file1.ts", "target.ts", "file3.ts"] } const ranges = test.ranges(); verify.pasteEdits({ args: { pastedText: [ `const g = p + q; function e(); const f = r + s;`], pasteLocations: [ranges[0], ranges[1]], }, newFileContents: { "/home/src/workspaces/project/target.ts": `import { p, q } from "./file1"; import { r, s } from "./file3"; const a = 1; const g = p + q; function e(); const f = r + s; const b = 2; const c = 3; const g = p + q; function e(); const f = r + s; const d = 4;` } });
{ "end_byte": 995, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_multiplePastes1.ts" }
TypeScript/tests/cases/fourslash/server/jsdocTypedefTagNavigateTo.ts_0_1423
/// <reference path="../fourslash.ts"/> // @allowNonTsExtensions: true // @Filename: jsDocTypedef_form2.js //// //// /** @typedef {(string | number)} NumberLike */ //// /** @typedef {(string | number | string[])} */ //// var NumberLike2; //// //// /** @type {/*1*/NumberLike} */ //// var numberLike; verify.navigationTree({ "text": "<global>", "kind": "script", "childItems": [ { "text": "numberLike", "kind": "var" }, { "text": "NumberLike", "kind": "type" }, { "text": "NumberLike2", "kind": "var" }, { "text": "NumberLike2", "kind": "type" } ] }); verify.navigationBar([ { "text": "<global>", "kind": "script", "childItems": [ { "text": "numberLike", "kind": "var" }, { "text": "NumberLike", "kind": "type" }, { "text": "NumberLike2", "kind": "var" }, { "text": "NumberLike2", "kind": "type" } ] }, { "text": "NumberLike", "kind": "type", "indent": 1, }, { "text": "NumberLike2", "kind": "type", "indent": 1 } ]);
{ "end_byte": 1423, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/jsdocTypedefTagNavigateTo.ts" }
TypeScript/tests/cases/fourslash/server/projectInfo01.ts_0_1039
/// <reference path="../fourslash.ts"/> // @Filename: a.ts ////export var test = "test String" // @Filename: b.ts ////import test from "./a" // @Filename: c.ts /////// <reference path="a.ts"/> /////// <reference path="b.ts"/> // @Filename: d.ts ////console.log("nothing"); 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"]) goTo.file("b.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"]) goTo.file("c.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", "c.ts"]) goTo.file("d.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", "d.ts"])
{ "end_byte": 1039, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/projectInfo01.ts" }
TypeScript/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics02.ts_0_222
/// <reference path="../fourslash.ts" /> // @allowJs: true // @Filename: b.js ////var a = "a"; ////var b: boolean = true; ////function foo(): string { } ////var var = "c"; verify.baselineSyntacticAndSemanticDiagnostics()
{ "end_byte": 222, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics02.ts" }
TypeScript/tests/cases/fourslash/server/moveToFile_emptyTargetFile.ts_0_691
/// <reference path='../fourslash.ts' /> // @Filename: /home/src/workspaces/project/source.ts ////[|export const a = 1;|] ////const b = 2; ////console.log(a, b); // @Filename: /home/src/workspaces/project/target.ts /////** empty */ // @Filename: /home/src/workspaces/project/tsconfig.json ///// { "compilerOptions": { "newLine": "lf" } } verify.moveToFile({ newFileContents: { "/home/src/workspaces/project/source.ts": `import { a } from "./target"; const b = 2; console.log(a, b);`, "/home/src/workspaces/project/target.ts": `/** empty */ export const a = 1; `, }, interactiveRefactorArguments: { targetFile: "/home/src/workspaces/project/target.ts" }, });
{ "end_byte": 691, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/moveToFile_emptyTargetFile.ts" }
TypeScript/tests/cases/fourslash/server/formatOnEnter.ts_0_396
/// <reference path="../fourslash.ts"/> /////*3*/function listAPIFiles (path : string): string[] { //// /*1*/ //// /*2*/ ////} goTo.marker("1"); format.onType("1", "\n"); verify.currentLineContentIs(" "); goTo.marker("2"); format.onType("2", "\n"); verify.currentLineContentIs(" "); goTo.marker("3"); verify.currentLineContentIs("function listAPIFiles(path: string): string[] {");
{ "end_byte": 396, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/formatOnEnter.ts" }
TypeScript/tests/cases/fourslash/server/getFileReferences_server2.ts_1_1262
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "files": [], "references": [{ "path": "packages/server" }, { "path": "packages/client" }] } // @Filename: /home/src/workspaces/project/packages/shared/tsconfig.json //// { "compilerOptions": { "rootDir": "src", "outDir": "dist", "composite": true } } // @Filename: /home/src/workspaces/project/packages/shared/src/referenced.ts //// export {}; // @Filename: /home/src/workspaces/project/packages/server/tsconfig.json //// { "compilerOptions": { "checkJs": true }, "references": [{ "path": "../shared" }] } // @Filename: /home/src/workspaces/project/packages/server/index.js //// const mod = require("../shared/src/referenced"); // @Filename: /home/src/workspaces/project/packages/server/router.js //// const blah = require("../shared/dist/referenced"); // @Filename: /home/src/workspaces/project/packages/client/tsconfig.json //// { "compilerOptions": { "paths": { "@shared/*": ["../shared/src/*"] } }, "references": [{ "path": "../shared" }] } // @Filename: /home/src/workspaces/project/packages/client/index.ts //// import "@shared/referenced"; verify.baselineGetFileReferences("/home/src/workspaces/project/packages/shared/src/referenced.ts");
{ "end_byte": 1262, "start_byte": 1, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/getFileReferences_server2.ts" }
TypeScript/tests/cases/fourslash/server/formatonkey01.ts_0_214
/// <reference path="../fourslash.ts"/> ////switch (1) { //// case 1: //// { //// /*1*/ //// break; ////} goTo.marker("1"); edit.insert("}"); verify.currentLineContentIs(" }");
{ "end_byte": 214, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/formatonkey01.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_wildcardExports3.ts_0_1358
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/packages/ui/package.json //// { //// "name": "@repo/ui", //// "version": "1.0.0", //// "exports": { //// "./*": "./src/*.tsx" //// } //// } // @Filename: /home/src/workspaces/project/packages/ui/src/Card.tsx //// export const Card = () => null; // @Filename: /home/src/workspaces/project/apps/web/package.json //// { //// "name": "web", //// "version": "1.0.0", //// "dependencies": { //// "@repo/ui": "workspace:*" //// } //// } // @Filename: /home/src/workspaces/project/apps/web/tsconfig.json //// { //// "compilerOptions": { //// "module": "esnext", //// "moduleResolution": "bundler", //// "noEmit": true, //// "jsx": "preserve" //// }, //// "include": ["app"] //// } // @Filename: /home/src/workspaces/project/apps/web/app/index.tsx //// (<Card/**/ />); // @link: /home/src/workspaces/project/packages/ui -> /home/src/workspaces/project/apps/web/node_modules/@repo/ui goTo.marker(""); verify.completions({ includes: [ { name: "Card", source: "@repo/ui/Card", sourceDisplay: "@repo/ui/Card", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, ], preferences: { includeCompletionsForModuleExports: true, allowIncompleteCompletions: true } });
{ "end_byte": 1358, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_wildcardExports3.ts" }
TypeScript/tests/cases/fourslash/server/jsdocParamTagSpecialKeywords.ts_0_251
/// <reference path="../fourslash.ts"/> // @allowNonTsExtensions: true // @Filename: test.js //// /** //// * @param {string} type //// */ //// function test(type) { //// type./**/ //// } verify.completions({ marker: "", includes: "charAt" });
{ "end_byte": 251, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/jsdocParamTagSpecialKeywords.ts" }
TypeScript/tests/cases/fourslash/server/completions03.ts_0_346
/// <reference path="../fourslash.ts"/> // issue: https://github.com/Microsoft/TypeScript/issues/10108 //// interface Foo { //// one: any; //// two: any; //// three: any; //// } //// //// let x: Foo = { //// get one() { return "" }, //// set two(t) {}, //// /**/ //// } verify.completions({ marker: "", exact: "three" });
{ "end_byte": 346, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completions03.ts" }
TypeScript/tests/cases/fourslash/server/nodeNextPathCompletions.ts_0_1334
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/node_modules/dependency/package.json //// { //// "type": "module", //// "name": "dependency", //// "version": "1.0.0", //// "exports": { //// ".": { //// "types": "./lib/index.d.ts" //// }, //// "./lol": { //// "types": "./lib/lol.d.ts" //// }, //// "./dir/*": "./lib/*" //// } //// } // @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/package.json //// { //// "type": "module", //// "dependencies": { //// "dependency": "^1.0.0" //// } //// } // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "nodenext" }, "files": ["./src/foo.ts"] } // @Filename: /home/src/workspaces/project/src/foo.ts //// import { fooFromIndex } from "/**/"; verify.baselineCompletions(); edit.insert("dependency/"); verify.completions({ exact: ["lol", "dir"], isNewIdentifierLocation: true }); edit.insert("l"); verify.completions({ exact: ["lol"], isNewIdentifierLocation: true });
{ "end_byte": 1334, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/nodeNextPathCompletions.ts" }
TypeScript/tests/cases/fourslash/server/ngProxy4.ts_0_386
/// <reference path="../fourslash.ts"/> // @Filename: tsconfig.json //// { //// "compilerOptions": { //// "plugins": [ //// { "name": "diagnostic-adder" } //// ] //// }, //// "files": ["a.ts"] //// } // @Filename: a.ts //// let x = [1, 2]; //// x/**/ //// // Test adding an error message goTo.marker(); verify.numberOfErrorsInCurrentFile(1);
{ "end_byte": 386, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/ngProxy4.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_globalTypingsCache.ts_0_1577
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/Library/Caches/typescript/node_modules/@types/react-router-dom/package.json //// { "name": "@types/react-router-dom", "version": "16.8.4", "types": "index.d.ts" } // @Filename: /home/src/Library/Caches/typescript/node_modules/@types/react-router-dom/index.d.ts //// export class BrowserRouterFromDts {} // @Filename: /home/src/workspaces/project/package.json //// { "dependencies": { "react-router-dom": "*" } } // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "commonjs", "allowJs": true, "checkJs": true, "maxNodeModuleJsDepth": 2 }, "typeAcquisition": { "enable": true } } // @Filename: /home/src/workspaces/project/node_modules/react-router-dom/package.json //// { "name": "react-router-dom", "version": "16.8.4", "main": "index.js" } // @Filename: /home/src/workspaces/project/node_modules/react-router-dom/index.js //// import "./BrowserRouter"; //// export {}; // @Filename: /home/src/workspaces/project/node_modules/react-router-dom/BrowserRouter.js //// export const BrowserRouterFromJs = () => null; // @Filename: /home/src/workspaces/project/index.js ////BrowserRouter/**/ verify.completions({ marker: "", exact: completion.globalsInJsPlus([{ name: "BrowserRouterFromDts", source: "react-router-dom", sourceDisplay: "react-router-dom", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }]), preferences: { allowIncompleteCompletions: true, includeCompletionsForModuleExports: true, } });
{ "end_byte": 1577, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_globalTypingsCache.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_exportMap5.ts_0_2075
/// <reference path="../fourslash.ts"/> // @types package lookup // @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": { //// ".": "./lib/index.js", //// "./lol": "./lib/lol.js" //// } //// } // @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.js //// export function fooFromIndex() {} // @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.js //// export function fooFromLol() {} // @Filename: /home/src/workspaces/project/node_modules/@types/dependency/package.json //// { //// "type": "module", //// "name": "@types/dependency", //// "version": "1.0.0", //// "exports": { //// ".": "./lib/index.d.ts", //// "./lol": "./lib/lol.d.ts" //// } //// } // @Filename: /home/src/workspaces/project/node_modules/@types/dependency/lib/index.d.ts //// export declare function fooFromIndex(): void; // @Filename: /home/src/workspaces/project/node_modules/@types/dependency/lib/lol.d.ts //// export declare function fooFromLol(): void; // @Filename: /home/src/workspaces/project/src/foo.ts //// fooFrom/**/ goTo.marker(""); verify.completions({ marker: "", includes: [{ name: "fooFromIndex", source: "dependency", sourceDisplay: "dependency", sortText: completion.SortText.AutoImportSuggestions, hasAction: true, }, { name: "fooFromLol", source: "dependency/lol", sourceDisplay: "dependency/lol", sortText: completion.SortText.AutoImportSuggestions, hasAction: true, }], preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, allowIncompleteCompletions: true, }, });
{ "end_byte": 2075, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_exportMap5.ts" }
TypeScript/tests/cases/fourslash/server/importFixes_ambientCircularDefaultCrash.ts_0_443
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { //// "compilerOptions": { //// "module": "preserve" //// } //// } // @Filename: /home/src/workspaces/project/types.d.ts //// declare module "mymod" { //// import mymod from "mymod"; //// export default mymod; //// } // @Filename: /home/src/workspaces/project/index.ts //// my/**/ verify.importFixModuleSpecifiers("", []);
{ "end_byte": 443, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/importFixes_ambientCircularDefaultCrash.ts" }
TypeScript/tests/cases/fourslash/server/goToSource13_nodenext.ts_0_1041
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/node_modules/left-pad/package.json //// { //// "name": "left-pad", //// "version": "1.3.0", //// "description": "String left pad", //// "main": "index.js", //// "types": "index.d.ts" //// } // @Filename: /home/src/workspaces/project/node_modules/left-pad/index.d.ts //// declare function leftPad(str: string|number, len: number, ch?: string|number): string; //// declare namespace leftPad { } //// export = leftPad; // @Filename: /home/src/workspaces/project/node_modules/left-pad/index.js //// module.exports = leftPad; //// function /*end*/leftPad(str, len, ch) {} // @Filename: /home/src/workspaces/project/tsconfig.json //// { //// "compilerOptions": { //// "module": "node16", //// "strict": true, //// "outDir": "./out", //// //// } //// } // @Filename: /home/src/workspaces/project/index.mts //// import leftPad = require("left-pad"); //// /*start*/leftPad("", 4); verify.baselineGoToSourceDefinition("start");
{ "end_byte": 1041, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource13_nodenext.ts" }
TypeScript/tests/cases/fourslash/server/typeReferenceOnServer.ts_0_167
/// <reference path='../fourslash.ts' /> /////// <reference types="foo" /> ////var x: number; ////x./*1*/ verify.completions({ marker: "1", includes: "toFixed" });
{ "end_byte": 167, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/typeReferenceOnServer.ts" }
TypeScript/tests/cases/fourslash/server/formatSpaceBetweenFunctionAndArrayIndex.ts_0_219
/// <reference path="../fourslash.ts"/> //// ////function test() { //// return []; ////} //// ////test() [0] //// format.document(); verify.currentFileContentIs( ` function test() { return []; } test()[0] `);
{ "end_byte": 219, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/formatSpaceBetweenFunctionAndArrayIndex.ts" }
TypeScript/tests/cases/fourslash/server/referencesInEmptyFileWithMultipleProjects.ts_0_419
/// <reference path="../fourslash.ts"/> // @Filename: /home/src/workspaces/project/a/tsconfig.json ////{ "files": ["a.ts"] } // @Filename: /home/src/workspaces/project/a/a.ts /////// <reference path="../b/b.ts" /> /////*1*/; // @Filename: /home/src/workspaces/project/b/tsconfig.json ////{ "files": ["b.ts"] } // @Filename: /home/src/workspaces/project/b/b.ts /////*2*/; verify.baselineFindAllReferences('1', '2')
{ "end_byte": 419, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/referencesInEmptyFileWithMultipleProjects.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_wildcardExports2.ts_0_1184
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/node_modules/pkg/package.json //// { //// "name": "pkg", //// "version": "1.0.0", //// "exports": { //// "./core/*": { //// "types": "./lib/core/*.d.ts", //// "default": "./lib/core/*.js" //// } //// } //// } // @Filename: /home/src/workspaces/project/node_modules/pkg/lib/core/test.d.ts //// export function test(): void; // @Filename: /home/src/workspaces/project/package.json //// { //// "type": "module", //// "dependencies": { //// "pkg": "1.0.0" //// } //// } // @Filename: /home/src/workspaces/project/tsconfig.json //// { //// "compilerOptions": { //// "module": "nodenext" //// } //// } // @Filename: /home/src/workspaces/project/main.ts //// /**/ verify.completions({ marker: "", includes: [ { name: "test", source: "pkg/core/test", sourceDisplay: "pkg/core/test", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, ], preferences: { includeCompletionsForModuleExports: true, allowIncompleteCompletions: true } });
{ "end_byte": 1184, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_wildcardExports2.ts" }
TypeScript/tests/cases/fourslash/server/jsdocTypedefTag1.ts_0_375
/// <reference path="../fourslash.ts"/> // @allowNonTsExtensions: true // @Filename: jsdocCompletion_typedef.js //// /** //// * @typedef {Object} MyType //// * @property {string} yes //// */ //// function foo() { } //// /** //// * @param {MyType} my //// */ //// function a(my) { //// my.yes./*1*/ //// } verify.completions({ marker: "1", includes: "charAt" });
{ "end_byte": 375, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/jsdocTypedefTag1.ts" }
TypeScript/tests/cases/fourslash/server/getFileReferences_deduplicate.ts_0_1362
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "files": [], "references": [{ "path": "tsconfig.build.json" }, { "path": "tsconfig.test.json" }] } // @Filename: /home/src/workspaces/project/tsconfig.utils.json //// { "compilerOptions": { "rootDir": "src", "outDir": "dist/utils", "composite": true }, "files": ["util.ts"] } // @Filename: /home/src/workspaces/project/tsconfig.build.json //// { "compilerOptions": { "rootDir": "src", "outDir": "dist/build", "composite": true }, "files": ["index.ts"], "references": [{ "path": "tsconfig.utils.json" }] } // @Filename: /home/src/workspaces/project/index.ts //// export * from "./util"; // @Filename: /home/src/workspaces/project/tsconfig.test.json //// { "compilerOptions": { "rootDir": "src", "outDir": "dist/test", "composite": true }, "files": ["test.ts", "index.ts"], "references": [{ "path": "tsconfig.utils.json" }] } // @Filename: /home/src/workspaces/project/test.ts //// import "./util"; // @Filename: /home/src/workspaces/project/util.ts //// export {} // util.ts is referenced by index.ts, which is included in tsconfig.build.json and tsconfig.test.json. // That reference will be returned from both projects' language services. Test ensures it gets deduplicated. verify.baselineGetFileReferences("/home/src/workspaces/project/util.ts");
{ "end_byte": 1362, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/getFileReferences_deduplicate.ts" }
TypeScript/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInline.ts_0_3401
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json ////{ //// "compilerOptions": { //// "outDir": "./dist", //// "inlineSourceMap": 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQTtJQUFBO0lBU0EsQ0FBQztJQVBHLHdCQUFVLEdBQVYsVUFBVyxRQUFrQixJQUFjLE9BQU8sUUFBUSxDQUFDLENBQUMsQ0FBQztJQUM3RCx5QkFBVyxHQUFYO1FBQ0ksSUFBSSxJQUFJLENBQUMsTUFBTSxFQUFFLEdBQUcsR0FBRyxFQUFFLENBQUM7WUFDdEIsT0FBTyxFQUFDLENBQUMsRUFBRSxFQUFFLEVBQUMsQ0FBQztRQUNuQixDQUFDO1FBQ0QsT0FBTyxFQUFDLENBQUMsRUFBRSxLQUFLLEVBQUMsQ0FBQztJQUN0QixDQUFDO0lBQ0wsVUFBQztBQUFELENBQUMsQUFURCxJQVNDO0FBVFksa0JBQUcifQ== // @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": 3401, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInline.ts" }
TypeScript/tests/cases/fourslash/server/completions02.ts_0_788
/// <reference path="../fourslash.ts"/> ////class Foo { ////} ////module Foo { //// export var x: number; ////} ////Foo./**/ const sortedFunctionMembers = completion.functionMembersWithPrototype.slice().sort((a, b) => a.name.localeCompare(b.name)); const exact: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntry> = [ ...sortedFunctionMembers.map(e => e.name === "arguments" ? { ...e, kind: "property", kindModifiers: "declare", tags: [] } : e.name === "prototype" ? { ...e, kindModifiers: undefined } : e), { name: "x", text: "var Foo.x: number", tags: [] }, ]; verify.completions({ marker: "", exact }); // Make an edit edit.insert("a"); edit.backspace(); // Checking for completion details after edit should work too verify.completions({ exact });
{ "end_byte": 788, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completions02.ts" }
TypeScript/tests/cases/fourslash/server/jsdocTypedefTagRename04.ts_0_550
/// <reference path="../fourslash.ts"/> // @allowNonTsExtensions: true // @Filename: jsDocTypedef_form2.js //// //// function test1() { //// /** @typedef {(string | number)} NumberLike */ //// //// /** @type {/*1*/NumberLike} */ //// var numberLike; //// } //// function test2() { //// /** @typedef {(string | number)} NumberLike2 */ //// //// /** @type {NumberLike2} */ //// var n/*2*/umberLike2; //// } goTo.marker('2'); verify.quickInfoExists(); goTo.marker('1'); edit.insert('111'); goTo.marker('2'); verify.quickInfoExists();
{ "end_byte": 550, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/jsdocTypedefTagRename04.ts" }
TypeScript/tests/cases/fourslash/server/importStatementCompletions_pnpm1.ts_0_1093
/// <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 //// export declare function Component(): void; // @Filename: /home/src/workspaces/project/index.ts //// [|import Com/**/|] // @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 goTo.marker(""); verify.completions({ isNewIdentifierLocation: true, marker: "", exact: [{ name: "Component", source: "react", insertText: `import { Component$1 } from "react";`, isSnippet: true, replacementSpan: test.ranges()[0], sourceDisplay: "react", }, { name: "type", sortText: completion.SortText.GlobalsOrKeywords, }], preferences: { includeCompletionsForImportStatements: true, includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: true, } });
{ "end_byte": 1093, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/importStatementCompletions_pnpm1.ts" }
TypeScript/tests/cases/fourslash/server/goToSource2_nodeModulesWithTypes.ts_0_612
/// <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", "types": "./types/main.d.ts" } // @Filename: /home/src/workspaces/project/node_modules/foo/lib/main.js //// export const /*end*/a = "a"; // @Filename: /home/src/workspaces/project/node_modules/foo/types/main.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": 612, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/goToSource2_nodeModulesWithTypes.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_exportMap4.ts_0_1377
/// <reference path="../fourslash.ts"/> // Top-level conditions // @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": { //// "types": "./lib/index.d.ts", //// "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/foo.ts //// fooFrom/**/ goTo.marker(""); verify.completions({ marker: "", includes: [{ name: "fooFromIndex", source: "dependency", sourceDisplay: "dependency", sortText: completion.SortText.AutoImportSuggestions, hasAction: true, }], excludes: "fooFromLol", preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true, allowIncompleteCompletions: true, }, });
{ "end_byte": 1377, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_exportMap4.ts" }
TypeScript/tests/cases/fourslash/server/declarationMapGoToDefinition.ts_0_1243
/// <reference path="../fourslash.ts" /> // @Filename: index.ts ////export class Foo { //// member: string; //// /*2*/methodName(propName: SomeType): void {} //// otherMethod() { //// if (Math.random() > 0.5) { //// return {x: 42}; //// } //// return {y: "yes"}; //// } ////} //// ////export interface SomeType { //// member: number; ////} // @Filename: indexdef.d.ts.map ////{"version":3,"file":"indexdef.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;IACI,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IACpC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} // @Filename: indexdef.d.ts ////export declare class Foo { //// member: string; //// methodName(propName: SomeType): void; //// otherMethod(): { //// x: number; //// y?: undefined; //// } | { //// y: string; //// x?: undefined; //// }; ////} ////export interface SomeType { //// member: number; ////} //////# sourceMappingURL=indexdef.d.ts.map // @Filename: mymodule.ts ////import * as mod from "./indexdef"; ////const instance = new mod.Foo(); ////instance.[|/*1*/methodName|]({member: 12}); verify.baselineGoToDefinition("1");
{ "end_byte": 1243, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/declarationMapGoToDefinition.ts" }
TypeScript/tests/cases/fourslash/server/autoImportProvider_referencesCrash.ts_0_1423
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/a/package.json //// {} // @Filename: /home/src/workspaces/project/a/tsconfig.json //// {} // @Filename: /home/src/workspaces/project/a/index.ts //// class A {} // @Filename: /home/src/workspaces/project/a/index.d.ts //// declare class A { //// } //// //# sourceMappingURL=index.d.ts.map // @Filename: /home/src/workspaces/project/a/index.d.ts.map //// {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;CAAG"} // @Filename: /home/src/workspaces/project/b/tsconfig.json //// { //// "compilerOptions": { "disableSourceOfProjectReferenceRedirect": true }, //// "references": [{ "path": "../a" }] //// } // @Filename: /home/src/workspaces/project/b/b.ts //// /// <reference path="../a/index.d.ts" /> //// new A/**/(); // @Filename: /home/src/workspaces/project/c/package.json //// { "dependencies": { "a": "*" } } // @Filename: /home/src/workspaces/project/c/tsconfig.json //// { "references" [{ "path": "../a" }] } // @Filename: /home/src/workspaces/project/c/index.ts //// export {}; // @link: /home/src/workspaces/project/a -> /home/src/workspaces/project/c/node_modules/a // Test asserts lack of crash goTo.file("/home/src/workspaces/project/c/index.ts"); // Create AutoImportProviderProject that has /a/index.d.ts in it verify.baselineFindAllReferences("");
{ "end_byte": 1423, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportProvider_referencesCrash.ts" }
TypeScript/tests/cases/fourslash/server/autoImportCrossProject_paths_toDist2.ts_0_1173
/// <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, //// "paths": { //// "@common/*": ["../common/dist/src/*"] //// } //// }, //// "include": ["src"], //// "references": [{ "path": "../common" }] //// } // @Filename: /home/src/workspaces/project/web/src/MyApp.ts //// import { square } from "@common/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/MyModule"], { importModuleSpecifierPreference: "non-relative" });
{ "end_byte": 1173, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportCrossProject_paths_toDist2.ts" }
TypeScript/tests/cases/fourslash/server/referencesToStringLiteralValue.ts_0_121
/// <reference path='fourslash.ts'/> ////const s: string = "some /*1*/ string"; verify.baselineFindAllReferences('1');
{ "end_byte": 121, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/referencesToStringLiteralValue.ts" }
TypeScript/tests/cases/fourslash/server/pasteEdits_multiplePastes4.ts_0_992
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/target.ts //// const a = 1; //// [||] //// [|const b = 2;|] //// const c = 3; //// [||] //// const d = 4; // @Filename: /home/src/workspaces/project/file1.ts //// export const p = 10; //// export const q = 12; // @Filename: /home/src/workspaces/project/file3.ts //// export const r = 10; //// export const s = 12; // @Filename: /home/src/workspaces/project/tsconfig.json ////{ "files": ["file1.ts", "target.ts", "file3.ts"] } const ranges = test.ranges(); verify.pasteEdits({ args: { pastedText: [ "const g = p + q;", "const f = r + s;"], pasteLocations: [ranges[0], ranges[1], ranges[2]], }, newFileContents: { "/home/src/workspaces/project/target.ts": `import { p, q } from "./file1"; import { r, s } from "./file3"; const a = 1; const g = p + q; const f = r + s; const g = p + q; const f = r + s; const c = 3; const g = p + q; const f = r + s; const d = 4;` } });
{ "end_byte": 992, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/pasteEdits_multiplePastes4.ts" }
TypeScript/tests/cases/fourslash/server/completionsImport_computedSymbolName.ts_0_1136
/// <reference path="../fourslash.ts" /> // @Filename: /home/src/workspaces/project/tsconfig.json //// { "compilerOptions": { "module": "commonjs" } } // @Filename: /home/src/workspaces/project/node_modules/@types/ts-node/index.d.ts //// export {}; //// declare const REGISTER_INSTANCE: unique symbol; //// declare global { //// namespace NodeJS { //// interface Process { //// [REGISTER_INSTANCE]?: Service; //// } //// } //// } // @Filename: /home/src/workspaces/project/node_modules/@types/node/index.d.ts //// declare module "process" { //// global { //// var process: NodeJS.Process; //// namespace NodeJS { //// interface Process { //// argv: string[]; //// } //// } //// } //// export = process; //// } // @Filename: /home/src/workspaces/project/index.ts //// I/**/ verify.completions({ marker: "", preferences: { includeCompletionsForModuleExports: true, }, }); edit.insert("N"); // Should not crash verify.completions({ marker: "", preferences: { includeCompletionsForModuleExports: true, }, });
{ "end_byte": 1136, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/completionsImport_computedSymbolName.ts" }
TypeScript/tests/cases/fourslash/server/autoImportFileExcludePatterns_networkPaths.ts_0_1000
/// <reference path="../fourslash.ts"/> // @module: commonjs // @Filename: //tsclient/home/src/solution/project/node_modules/aws-sdk/package.json //// { "name": "aws-sdk", "version": "2.0.0", "main": "index.js" } // @Filename: //tsclient/home/src/solution/project/node_modules/aws-sdk/index.d.ts //// export * from "./clients/s3"; // @Filename: //tsclient/home/src/solution/project/node_modules/aws-sdk/clients/s3.d.ts //// export declare class S3 {} // @Filename: //tsclient/home/src/solution/project/package.json //// { "dependencies": { "aws-sdk": "*" } } // @Filename: //tsclient/home/src/solution/project/index.ts //// S3/**/ const autoImportFileExcludePatterns = ["\\\\tsclient\\home\\src\\solution\\project\\node_modules\\aws-sdk"]; verify.completions({ marker: "", excludes: "S3", preferences: { includeCompletionsForModuleExports: true, autoImportFileExcludePatterns, } }); verify.importFixAtPosition([], /*errorCode*/ undefined, { autoImportFileExcludePatterns });
{ "end_byte": 1000, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/autoImportFileExcludePatterns_networkPaths.ts" }
TypeScript/tests/cases/fourslash/server/documentHighlights02.ts_0_335
/// <reference path="../fourslash.ts"/> // @Filename: a.ts ////function [|foo|] () { //// return 1; ////} ////[|foo|](); // @Filename: b.ts /////// <reference path="a.ts"/> ////[|foo|](); // open two files goTo.file("a.ts"); goTo.file("b.ts"); verify.baselineDocumentHighlights(test.ranges(), { filesToSearch: ["a.ts", "b.ts"] });
{ "end_byte": 335, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/server/documentHighlights02.ts" }