_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/returnRecursiveType.ts_0_203 | /// <reference path='fourslash.ts' />
////interface MyInt {
//// (): void;
////}
////function MyFn() { return <MyInt>MyFn; }
////var My/**/Var = MyFn();
verify.quickInfoAt("", "var MyVar: MyInt");
| {
"end_byte": 203,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/returnRecursiveType.ts"
} |
TypeScript/tests/cases/fourslash/getEmitOutputDeclarationMultiFiles.ts_0_446 | /// <reference path="fourslash.ts" />
// @BaselineFile: getEmitOutputDeclarationMultiFiles.baseline
// @declaration: true
// @Filename: inputFile1.ts
// @emitThisFile: true
//// var x: number = 5;
//// class Bar {
//// x : string;
//// y : number
//// }
// @Filename: inputFile2.ts
// @emitThisFile: true
//// var x1: string = "hello world";
//// class Foo{
//// x : string;
//// y : number;
//// }
verify.baselineGetEmitOutput(); | {
"end_byte": 446,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEmitOutputDeclarationMultiFiles.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoForGenericTaggedTemplateExpression.ts_0_1127 | /// <reference path='fourslash.ts'/>
////interface T1 {}
////class T2 {}
////type T3 = "a" | "b";
////
////declare function foo<T>(strings: TemplateStringsArray, ...values: T[]): void;
////
/////*1*/foo<number>``;
/////*2*/foo<string | number>``;
/////*3*/foo<{ a: number }>``;
/////*4*/foo<T1>``;
/////*5*/foo<T2>``;
/////*6*/foo<T3>``;
/////*7*/foo``;
verify.quickInfoAt("1", "function foo<number>(strings: TemplateStringsArray, ...values: number[]): void");
verify.quickInfoAt("2", "function foo<string | number>(strings: TemplateStringsArray, ...values: (string | number)[]): void");
verify.quickInfoAt("3",
`function foo<{
a: number;
}>(strings: TemplateStringsArray, ...values: {
a: number;
}[]): void`);
verify.quickInfoAt("4", "function foo<T1>(strings: TemplateStringsArray, ...values: T1[]): void");
verify.quickInfoAt("5", "function foo<T2>(strings: TemplateStringsArray, ...values: T2[]): void");
verify.quickInfoAt("6", "function foo<T3>(strings: TemplateStringsArray, ...values: T3[]): void");
verify.quickInfoAt("7", "function foo<unknown>(strings: TemplateStringsArray, ...values: unknown[]): void");
| {
"end_byte": 1127,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForGenericTaggedTemplateExpression.ts"
} |
TypeScript/tests/cases/fourslash/identationAfterInterfaceCall.ts_0_190 | /// <reference path='fourslash.ts' />
////interface bah {
//// (y: number);
//// x: number;
//// (z: string);/**/
////}
goTo.marker();
edit.insert('\n');
verify.indentationIs(4);
| {
"end_byte": 190,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/identationAfterInterfaceCall.ts"
} |
TypeScript/tests/cases/fourslash/docCommentTemplateWithMultipleJSDoc2.ts_0_209 | /// <reference path='fourslash.ts' />
/////** @typedef {string} Id */
////
/////** /**/ */
////function foo(x, y, z) {}
verify.docCommentTemplateAt("", 7,
`/**
*
* @param x
* @param y
* @param z
*/`);
| {
"end_byte": 209,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateWithMultipleJSDoc2.ts"
} |
TypeScript/tests/cases/fourslash/extract-method_jsxSelfClosingElement3.ts_0_781 | /// <reference path='fourslash.ts' />
// @jsx: preserve
// @filename: a.tsx
////declare var React: any;
////class Foo extends React.Component<{}, {}> {
//// render() {
//// return (
//// <div>
//// /*a*/<br />/*b*/
//// </div>
//// );
//// }
////}
goTo.file("a.tsx");
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to method in class 'Foo'",
newContent:
`declare var React: any;
class Foo extends React.Component<{}, {}> {
render() {
return (
<div>
{this./*RENAME*/newMethod()}
</div>
);
}
private newMethod() {
return <br />;
}
}`
});
| {
"end_byte": 781,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method_jsxSelfClosingElement3.ts"
} |
TypeScript/tests/cases/fourslash/javaScriptModules13.ts_0_735 | ///<reference path="fourslash.ts" />
// Assignments to 'module.exports' create an external module
// @allowJs: true
// @Filename: myMod.js
//// if (true) {
//// module.exports = { a: 10 };
//// }
//// var invisible = true;
// @Filename: isGlobal.js
//// var y = 10;
// @Filename: consumer.js
//// var x = require('./myMod');
//// /**/;
goTo.file('consumer.js');
goTo.marker();
verify.completions({
marker: "",
includes: { name: "y", sortText: completion.SortText.GlobalsOrKeywords },
excludes: "invisible"
});
edit.insert('x.');
verify.completions({ includes: { name: "a", kind: "property" } });
edit.insert('a.');
verify.completions({ includes: { name: "toFixed", kind: "method", kindModifiers: "declare" } });
| {
"end_byte": 735,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/javaScriptModules13.ts"
} |
TypeScript/tests/cases/fourslash/callHierarchyFunctionAmbiguity.3.ts_0_338 | /// <reference path="fourslash.ts" />
// @filename: a.d.ts
//// declare function foo(x?: number): void;
// @filename: b.d.ts
//// declare function /**/foo(x?: string): void;
//// declare function foo(x?: boolean): void;
// @filename: main.ts
//// function bar() {
//// foo();
//// }
goTo.marker();
verify.baselineCallHierarchy();
| {
"end_byte": 338,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/callHierarchyFunctionAmbiguity.3.ts"
} |
TypeScript/tests/cases/fourslash/formattingForOfKeyword.ts_0_150 | /// <reference path='fourslash.ts' />
/////**/for ([]of[]) { }
format.document();
goTo.marker();
verify.currentLineContentIs('for ([] of []) { }'); | {
"end_byte": 150,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingForOfKeyword.ts"
} |
TypeScript/tests/cases/fourslash/codeFixForgottenThisPropertyAccessECMAPrivate.ts_0_317 | /// <reference path="fourslash.ts" />
////class K {
//// #value: number;
////
//// foo() {
//// #value/**/;
//// }
////}
verify.codeFix({
index: 0,
description: "Add 'this.' to unresolved variable",
newFileContent:
`class K {
#value: number;
foo() {
this.#value;
}
}`
});
| {
"end_byte": 317,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixForgottenThisPropertyAccessECMAPrivate.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_updateUses.ts_0_496 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////export const x = 0;
////[|export const y = 0;|]
// @Filename: /user.ts
////import { x, y } from "./a";
////import { x as x2 } from "./a";
////import {} from "./a";
verify.moveToNewFile({
newFileContents: {
"/a.ts":
`export const x = 0;
`,
"/y.ts":
`export const y = 0;
`,
"/user.ts":
`import { x } from "./a";
import { y } from "./y";
import { x as x2 } from "./a";
import {} from "./a";`,
},
});
| {
"end_byte": 496,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_updateUses.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteral2.ts_0_733 | /// <reference path='fourslash.ts'/>
////var o = {
//// foo() { },
//// bar: 0,
//// "some other name": 1
////};
////declare const p: { [s: string]: any, a: number };
////
////o["[|/*1*/bar|]"];
////o["/*2*/ ;
////p["[|/*3*/|]"];
const replacementSpan0 = test.ranges()[0]
verify.completions(
{ marker: "1", exact: [
{ name: "bar", replacementSpan: replacementSpan0 },
{ name: "foo", replacementSpan: replacementSpan0 },
{ name: "some other name", replacementSpan: replacementSpan0 }
] },
{ marker: "2", exact: [ "bar", "foo", "some other name" ] },
{ marker: "3", exact: {
name: "a",
replacementSpan: test.ranges()[1]
},
isNewIdentifierLocation: true },
);
| {
"end_byte": 733,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteral2.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertExportForTriggerReason.ts_0_308 | /// <reference path='fourslash.ts' />
////export /*a*//*b*/function f() {}
// Only offer refactor for empty span if explicity requested
goTo.select("a", "b");
verify.not.refactorAvailableForTriggerReason("implicit", "Convert export");
verify.refactorAvailableForTriggerReason("invoked", "Convert export");
| {
"end_byte": 308,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertExportForTriggerReason.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpRestArgs3.ts_0_159 | /// <reference path="fourslash.ts" />
// @target: esnext
// @lib: esnext
//// const layers = Object.assign({}, /*1*/...[]);
verify.baselineSignatureHelp();
| {
"end_byte": 159,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpRestArgs3.ts"
} |
TypeScript/tests/cases/fourslash/unusedVariableInClass1.ts_0_237 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
////class greeter {
//// [|private greeting: string;|]
////}
verify.codeFix({
description: "Remove unused declaration for: 'greeting'",
newRangeContent: "",
});
| {
"end_byte": 237,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedVariableInClass1.ts"
} |
TypeScript/tests/cases/fourslash/completionsTypeOnlyNamespace.ts_0_413 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export namespace ns {
//// export class Box<T> {}
//// export type Type = {};
//// export const Value = {};
////}
// @Filename: /b.ts
////import type { ns } from './a';
////let x: ns./**/
verify.completions({
marker: "",
exact: [{
name: "Box",
text: "class ns.Box<T>",
}, {
name: "Type",
text: "type ns.Type = {}"
}]
});
| {
"end_byte": 413,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsTypeOnlyNamespace.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingConstToArrayDestructuring3.ts_0_108 | /// <reference path='fourslash.ts' />
////let x: any;
////[x, y] = [0, 1];
verify.not.codeFixAvailable();
| {
"end_byte": 108,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingConstToArrayDestructuring3.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Arrow_this.ts_0_455 | /// <reference path='fourslash.ts' />
//// const bar = 42;
//// const foo = /*x*/(/*w*/) => this.bar;
goTo.select("x", "w");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
| {
"end_byte": 455,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Arrow_this.ts"
} |
TypeScript/tests/cases/fourslash/formattingOnChainedCallbacks.ts_3_2897 | / <reference path='fourslash.ts' />
////Promise
//// .resolve()
//// .then(() => {/*1*/""/*2*/
////}).then(() => {/*3*//*4*/
////})/*semi1*//*semi2*/
////function foo() {
//// return Promise.resolve()
//// .then(function () {
//// ""/*a*/
//// })/*b*/
////}
////Promise
//// .then(
//// /*n1*/
//// )
//// /*n2*/
//// .then();
// @Filename: listSmart.ts
////Promise
//// .resolve().then(
//// /*listSmart1*/
//// 3,
//// /*listSmart2*/
//// [
//// 3
//// /*listSmart3*/
//// ]
//// /*listSmart4*/
//// );
// @Filename: listZeroIndent.ts
////Promise.resolve([
////]).then(
//// /*listZeroIndent1*/
//// [
//// /*listZeroIndent2*/
//// 3
//// ]
//// );
// @Filename: listTypeParameter1.ts
////foo.then
//// <
//// /*listTypeParameter1*/
//// void
//// /*listTypeParameter2*/
//// >(
//// function (): void {
//// },
//// function (): void {
//// }
//// );
// @Filename: listComment.ts
////Promise
//// .then(
//// // euphonium
//// "k"
//// // oboe
//// );
goTo.marker('1');
edit.insertLine('');
goTo.marker('2');
verify.currentLineContentIs(' ""');
edit.insertLine('');
verify.indentationIs(8);
goTo.marker('4');
edit.insertLine('');
goTo.marker('3');
verify.currentLineContentIs(' }).then(() => {');
goTo.marker("semi1");
edit.insert(';');
verify.currentLineContentIs(' });');
goTo.marker("semi2");
edit.insert(';');
verify.currentLineContentIs(' });;');
goTo.marker('a');
edit.insert(';');
verify.currentLineContentIs(' "";');
goTo.marker('b');
edit.insert(';');
verify.currentLineContentIs(' });');
goTo.marker('n1');
verify.indentationIs(8);
goTo.marker('n2');
verify.indentationIs(4);
goTo.file("listSmart.ts");
format.document();
verify.currentFileContentIs(`Promise
.resolve().then(
3,
[
3
]
);`);
goTo.marker("listSmart1");
verify.indentationIs(8);
goTo.marker("listSmart2");
verify.indentationIs(8);
goTo.marker("listSmart3");
verify.indentationIs(12);
goTo.marker("listSmart4");
verify.indentationIs(8);
goTo.file("listZeroIndent.ts");
format.document();
verify.currentFileContentIs(`Promise.resolve([
]).then(
[
3
]
);`);
goTo.marker("listZeroIndent1");
verify.indentationIs(4);
goTo.marker("listZeroIndent2");
verify.indentationIs(8);
goTo.file("listTypeParameter1.ts");
format.document();
verify.currentFileContentIs(`foo.then
<
void
>(
function(): void {
},
function(): void {
}
);`);
goTo.marker("listTypeParameter1");
verify.indentationIs(8);
goTo.marker("listTypeParameter2");
verify.indentationIs(8);
goTo.file("listComment.ts");
format.document();
verify.currentFileContentIs(`Promise
.then(
// euphonium
"k"
// oboe
);`)
| {
"end_byte": 2897,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingOnChainedCallbacks.ts"
} |
TypeScript/tests/cases/fourslash/tsxCompletion14.ts_0_827 | /// <reference path='fourslash.ts' />
//@module: commonjs
//@jsx: preserve
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// }
//// interface ElementAttributesProperty { props; }
//// }
//@Filename: exporter.tsx
//// export class Thing { props: { ONE: string; TWO: number } }
//// export module M {
//// export declare function SFCComp(props: { Three: number; Four: string }): JSX.Element;
//// }
//@Filename: file.tsx
//// import * as Exp from './exporter';
//// var x1 = <Exp.Thing /*1*/ />;
//// var x2 = <Exp.M.SFCComp /*2*/ />;
//// var x3 = <Exp.Thing /*3*/ ></Exp.Thing>;
//// var x4 = <Exp.M.SFCComp /*4*/ ></Exp.M.SFCComp>;
verify.completions(
{ marker: ["1", "3"], exact: ["ONE", "TWO"] },
{ marker: ["2", "4"], exact: ["Four", "Three"] },
);
| {
"end_byte": 827,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxCompletion14.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives1.ts_0_298 | /// <reference path='fourslash.ts' />
//// function f(templateStrings, x, y, z) { return 10; }
//// function g(templateStrings, x, y, z) { return ""; }
////
//// /*1*/f/*2*/ /*3*/` qwerty ${ 123 } asdf ${ 41234 } zxcvb ${ g ` ` } `/*4*/
verify.noSignatureHelp(...test.markerNames());
| {
"end_byte": 298,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixChangeJSDocSyntax8.ts_0_296 | /// <reference path='fourslash.ts' />
//// var x: [|function(this: number, number): string|] = 12;
verify.codeFix({
description: "Change 'function(this: number, number): string' to '(this: number, arg1: number) => string'",
newRangeContent: "(this: number, arg1: number) => string",
});
| {
"end_byte": 296,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixChangeJSDocSyntax8.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportIndex.ts_0_245 | /// <reference path="fourslash.ts" />
// @Filename: /a/index.ts
////export const foo = 0;
// @Filename: /b.ts
////[|/**/foo;|]
goTo.file("/a/index.ts");
goTo.file("/b.ts");
verify.importFixAtPosition([
`import { foo } from "./a";
foo;`
]);
| {
"end_byte": 245,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportIndex.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoForContextuallyTypedArrowFunctionInSuperCall.ts_0_544 | /// <reference path='fourslash.ts'/>
////class A<T1, T2> {
//// constructor(private map: (value: T1) => T2) {
////
//// }
////}
////
////class B extends A<number, string> {
//// constructor() { super(va/*1*/lue => String(va/*2*/lue.toExpone/*3*/ntial())); }
////}
verify.quickInfos({
1: "(parameter) value: number",
2: "(parameter) value: number",
3: [
"(method) Number.toExponential(fractionDigits?: number): string",
"Returns a string containing a number represented in exponential notation."
]
});
| {
"end_byte": 544,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForContextuallyTypedArrowFunctionInSuperCall.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationInterfaceProperty_00.ts_0_503 | /// <reference path='fourslash.ts'/>
// Should handle property assignments in object literals within variable like declarations
//// interface Foo {
//// hello: number
//// }
////
//// var bar: Foo = { [|hello|]: 5 };
////
////
//// function whatever(x: Foo = { [|hello|]: 5 * 9 }) {
//// x.he/*reference*/llo
//// }
////
//// class Bar {
//// x: Foo = { [|hello|]: 6 }
////
//// constructor(public f: Foo = { [|hello|]: 7 } ) {}
//// }
verify.baselineGoToImplementation("reference"); | {
"end_byte": 503,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterfaceProperty_00.ts"
} |
TypeScript/tests/cases/fourslash/unusedMethodInClass4.ts_0_320 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
////class greeter {
//// [|public function2(){
//// }
//// private function1 = function() {
//// } |]
////}
verify.codeFix({
description: `Remove unused declaration for: 'function1'`,
newRangeContent: `public function2(){
}
`,
});
| {
"end_byte": 320,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedMethodInClass4.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_Single_Assign.ts_0_397 | /// <reference path='fourslash.ts' />
//// let bar;
//// const foo = /*x*/f/*y*/unction() {
//// bar = 42;
//// };
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to arrow function",
actionDescription: "Convert to arrow function",
newContent: `let bar;
const foo = () => {
bar = 42;
};`,
});
| {
"end_byte": 397,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_Single_Assign.ts"
} |
TypeScript/tests/cases/fourslash/completionListInTypeLiteralInTypeParameter4.ts_0_300 | /// <reference path="fourslash.ts" />
////interface Foo {
//// one: string;
//// two: number;
////}
////
////interface Bar<T extends Foo> {
//// foo: T;
////}
////
////var foobar: Bar<{ one: string } & {/**/
verify.completions({ marker: "", exact: "two", isNewIdentifierLocation: true });
| {
"end_byte": 300,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInTypeLiteralInTypeParameter4.ts"
} |
TypeScript/tests/cases/fourslash/moduleReexportedIntoGlobalQuickInfo.ts_0_434 | /// <reference path="fourslash.ts" />
// @Filename: /node_modules/@types/three/index.d.ts
////export class Vector3 {}
////export as namespace THREE;
// @Filename: /global.d.ts
////import * as _THREE from 'three';
////
////declare global {
//// const THREE: typeof _THREE;
////}
// @Filename: /index.ts
////let v = new /*1*/THREE.Vector3();
verify.quickInfoAt("1", `const THREE: typeof import("/node_modules/@types/three/index")`);
| {
"end_byte": 434,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moduleReexportedIntoGlobalQuickInfo.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsForDefaultExport04.ts_0_235 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////const /*0*/a = 0;
////export /*1*/default /*2*/a;
// @Filename: /b.ts
////import /*3*/a from "./a";
/////*4*/a;
verify.baselineFindAllReferences('0', '2', '1', '3', '4')
| {
"end_byte": 235,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForDefaultExport04.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoUniqueSymbolJsDoc.ts_0_196 | /// <reference path="fourslash.ts" />
// @checkJs: true
// @allowJs: true
// @filename: ./a.js
/////** @type {unique symbol} */
////const foo = Symbol();
////foo/**/
verify.baselineQuickInfo();
| {
"end_byte": 196,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoUniqueSymbolJsDoc.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageSetterJS.ts_0_423 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @noImplicitAny: true
// @Filename: important.js
////class C {
//// set [|x(v)|] {
//// v;
//// }
////}
////(new C).x = 1;
verify.codeFix({
description: "Infer type of \'x\' from usage",
index: 0,
newFileContent:
`class C {
/**
* @param {number} v
*/
set x(v) {
v;
}
}
(new C).x = 1;`,
});
| {
"end_byte": 423,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageSetterJS.ts"
} |
TypeScript/tests/cases/fourslash/renameDestructuringFunctionParameter.ts_0_277 | /// <reference path='fourslash.ts' />
////function f([|{[|{| "contextRangeIndex": 0 |}a|]}: {[|a|]}|]) {
//// f({[|a|]});
////}
const [r0Def, r0, r1, r2] = test.ranges();
verify.baselineRename([
// renames the local
r0, r2,
// renames the property
r1,
]);
| {
"end_byte": 277,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameDestructuringFunctionParameter.ts"
} |
TypeScript/tests/cases/fourslash/getOutliningForObjectsInArray.ts_0_1076 | /// <reference path="fourslash.ts"/>
// objects in x should generate outlining spans that do not render in VS
//// const x =[| [
//// [|{ a: 0 }|],
//// [|{ b: 1 }|],
//// [|{ c: 2 }|]
//// ]|];
////
// objects in y should generate outlining spans that render as expected
//// const y =[| [
//// [|{
//// a: 0
//// }|],
//// [|{
//// b: 1
//// }|],
//// [|{
//// c: 2
//// }|]
//// ]|];
////
// same behavior for nested arrays
//// const w =[| [
//// [|[ 0 ]|],
//// [|[ 1 ]|],
//// [|[ 2 ]|]
//// ]|];
////
//// const z =[| [
//// [|[
//// 0
//// ]|],
//// [|[
//// 1
//// ]|],
//// [|[
//// 2
//// ]|]
//// ]|];
////
// multiple levels of nesting work as expected
//// const z =[| [
//// [|[
//// [|{ hello: 0 }|]
//// ]|],
//// [|[
//// [|{ hello: 3 }|]
//// ]|],
//// [|[
//// [|{ hello: 5 }|],
//// [|{ hello: 7 }|]
//// ]|]
//// ]|];
verify.outliningSpansInCurrentFile(test.ranges(), "code"); | {
"end_byte": 1076,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOutliningForObjectsInArray.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts_0_290 | /// <reference path='fourslash.ts'/>
////class Foo {
//// public _bar;
//// public __bar;
//// /*1*/public /*2*/___bar;
//// public ____bar;
////}
////
////var x: Foo;
////x._bar;
////x.__bar;
////x./*3*/___bar;
////x.____bar;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 290,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts"
} |
TypeScript/tests/cases/fourslash/getSemanticDiagnosticForDeclaration1.ts_0_133 | /// <reference path="fourslash.ts" />
// @declaration: true
// @Filename: File.d.ts
//// declare var v: string;
verify.noErrors();
| {
"end_byte": 133,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getSemanticDiagnosticForDeclaration1.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentOnUnclosedObjectTypeLiteral01.ts_0_203 | /// <reference path='fourslash.ts' />
////var x: {
////{| "indent": 4 |}
test.markers().forEach(marker => {
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
}); | {
"end_byte": 203,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentOnUnclosedObjectTypeLiteral01.ts"
} |
TypeScript/tests/cases/fourslash/importTypeCompletions2.ts_0_444 | /// <reference path="fourslash.ts" />
// @target: esnext
// @filename: /foo.ts
////export const Foo = {};
// @filename: /bar.ts
////[|import type F/**/|]
goTo.file("/bar.ts")
verify.completions({
marker: "",
exact: [],
isNewIdentifierLocation: true,
preferences: {
includeCompletionsForModuleExports: true,
includeCompletionsForImportStatements: true,
includeCompletionsWithInsertText: true
}
});
| {
"end_byte": 444,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importTypeCompletions2.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionShorthandProperty05.ts_0_198 | /// <reference path="./fourslash.ts"/>
////interface Foo {
//// /*3*/foo(): void
////}
////const /*2*/foo = 1;
////let x: Foo = {
//// [|f/*1*/oo|]
////}
verify.baselineGoToDefinition("1");
| {
"end_byte": 198,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionShorthandProperty05.ts"
} |
TypeScript/tests/cases/fourslash/codeFixImportNonExportedMember2.ts_0_459 | /// <reference path="fourslash.ts" />
// @module: esnext
// @filename: /a.ts
////export declare function foo(): any;
////declare function bar(): any;
// @filename: /b.ts
////import { bar } from "./a";
goTo.file("/b.ts");
verify.codeFix({
description: [ts.Diagnostics.Export_0_from_module_1.message, "bar", "./a"],
index: 0,
newFileContent: {
"/a.ts":
`export declare function foo(): any;
export declare function bar(): any;`,
}
});
| {
"end_byte": 459,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixImportNonExportedMember2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixExpectedComma01.ts_0_304 | /// <reference path='fourslash.ts' />
////class C {
//// const example = [|{ a : "one"; c : "two"}|]
////}
verify.codeFixAvailable([
{ description: `Change ';' to ','` }
]);
verify.codeFix({
description: "Change ';' to ','",
index: 0,
newRangeContent: `{ a : "one", c : "two"}`,
}); | {
"end_byte": 304,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixExpectedComma01.ts"
} |
TypeScript/tests/cases/fourslash/jsdocTemplatePrototypeCompletions.ts_0_404 | /// <reference path="fourslash.ts" />
// @checkJs: true
// @filename: index.js
//// https://github.com/microsoft/TypeScript/issues/11492
//// /** @constructor */
//// function Foo() {}
//// /**
//// * @template T
//// * @param {T} bar
//// * @returns {T}
//// */
//// Foo.prototype.foo = function (bar) {};
//// new Foo().foo({ id: 1234 })./**/
verify.completions({ marker: "", exact: ["id"] });
| {
"end_byte": 404,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocTemplatePrototypeCompletions.ts"
} |
TypeScript/tests/cases/fourslash/classifyThisParameter.ts_0_306 | /// <reference path="fourslash.ts"/>
////function f(this){}
const c = classification("original");
verify.syntacticClassificationsAre(
c.keyword("function"),
c.identifier("f"),
c.punctuation("("),
c.keyword("this"),
c.punctuation(")"),
c.punctuation("{"),
c.punctuation("}"));
| {
"end_byte": 306,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/classifyThisParameter.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_newModuleNameUnique.ts_0_264 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////[|export const x = 0;|]
// @Filename: /x.ts
////
// @Filename: /x.1.ts
////
verify.moveToNewFile({
newFileContents: {
"/a.ts":
``,
"/x.2.ts":
`export const x = 0;
`,
},
});
| {
"end_byte": 264,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_newModuleNameUnique.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateBinaryExpr2.ts_0_423 | /// <reference path='fourslash.ts' />
////let b = 1;
////let a = '';
////a += /*a*/'foo' + b/*b*/;
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert to template string",
actionName: "Convert to template string",
actionDescription: ts.Diagnostics.Convert_to_template_string.message,
newContent: [
"let b = 1;",
"let a = '';",
"a += `foo${b}`;"
].join("\n")
});
| {
"end_byte": 423,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateBinaryExpr2.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteral_quotePreference1.ts_0_369 | /// <reference path='fourslash.ts'/>
////enum A {
//// A,
//// B,
//// C
////}
////interface B {
//// a: keyof typeof A;
////}
////const b: B = {
//// a: /**/
////}
verify.completions({
marker: "",
includes: [
{ name: '"A"' },
{ name: '"B"' },
{ name: '"C"' },
],
preferences: { quotePreference: "double" },
});
| {
"end_byte": 369,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteral_quotePreference1.ts"
} |
TypeScript/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts_0_872 | /// <reference path='fourslash.ts'/>
////var a = { name: 'bob', age: 18 };
////var b = { name: 'jim', age: 20 };
////var /*1*/c = [a, b];
////var a1 = { name: 'bob', age: 18 };
////var b1 = { name: 'jim', age: 20, dob: new Date() };
////var /*2*/c1 = [a1, b1];
////var a2 = { name: 'bob', age: 18, address: 'springfield' };
////var b2 = { name: 'jim', age: 20, dob: new Date() };
////var /*3*/c2 = [a2, b2];
////interface I {
//// name: string;
//// age: number;
////}
////var i: I;
////var /*4*/c3 = [i, a];
verify.quickInfos({
4: "var c3: I[]"
});
verify.quickInfos({
1: "var c: {\n name: string;\n age: number;\n}[]",
2: "var c1: {\n name: string;\n age: number;\n}[]",
3:
`var c2: ({
name: string;
age: number;
address: string;
} | {
name: string;
age: number;
dob: Date;
})[]`,
4: "var c3: I[]"
});
| {
"end_byte": 872,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts"
} |
TypeScript/tests/cases/fourslash/moduleNodeNextAutoImport2.ts_0_440 | /// <reference path="fourslash.ts" />
// @Filename: /tsconfig.json
//// { "compilerOptions": { "module": "nodenext" } }
// @Filename: /package.json
//// { "type": "module" }
// @Filename: /mobx.d.cts
//// export declare function autorun(): void;
// @Filename: /index.ts
//// autorun/**/
// @Filename: /utils.ts
//// import "./mobx.cjs";
goTo.marker("");
verify.importFixAtPosition([`import { autorun } from "./mobx.cjs";
autorun`]);
| {
"end_byte": 440,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moduleNodeNextAutoImport2.ts"
} |
TypeScript/tests/cases/fourslash/annotateWithTypeFromJSDoc10.ts_0_305 | /// <reference path='fourslash.ts' />
/////**
//// * @param {?} x
//// * @returns {number}
//// */
////var f = (x) => x
verify.codeFix({
description: "Annotate with type from JSDoc",
index: 0,
newFileContent:
`/**
* @param {?} x
* @returns {number}
*/
var f = (x: any): number => x`,
});
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/annotateWithTypeFromJSDoc10.ts"
} |
TypeScript/tests/cases/fourslash/toggleLineComment5.ts_0_343 | // Comments inside strings are still considered comments.
//// let var1 = `
//// //some stri[|ng
//// //some other|] string
//// `;
////
//// let var2 = `
//// some stri[|ng
//// some other|] string
//// `;
verify.toggleLineComment(
`let var1 = \`
some string
some other string
\`;
let var2 = \`
//some string
//some other string
\`;`); | {
"end_byte": 343,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/toggleLineComment5.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsage.ts_0_229 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
////[|var foo;|]
////function f() {
//// foo += 2;
////}
verify.rangeAfterCodeFix("var foo: number;",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0); | {
"end_byte": 229,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsage.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_keywordSelection.ts_0_346 | /// <reference path='fourslash.ts' />
//// /*x*/let/*y*/ foo = a => 1 + a;
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to named function",
actionDescription: "Convert to named function",
newContent: `function foo(a) {
return 1 + a;
}`,
});
| {
"end_byte": 346,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_keywordSelection.ts"
} |
TypeScript/tests/cases/fourslash/goToModuleAliasDefinition.ts_0_255 | /// <reference path='fourslash.ts' />
// @Filename: a.ts
////export class /*2*/Foo {}
// @Filename: b.ts
//// import /*3*/n = require('a');
//// var x = new [|/*1*/n|].Foo();
// Won't-fixed: Should go to '2' instead
verify.baselineGoToDefinition("1");
| {
"end_byte": 255,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToModuleAliasDefinition.ts"
} |
TypeScript/tests/cases/fourslash/getOutliningSpansForUnbalancedRegion.ts_0_219 | /// <reference path="fourslash.ts"/>
////// top-heavy region balance
////// #region unmatched
////
////[|// #region matched
////
////// #endregion matched|]
verify.outliningSpansInCurrentFile(test.ranges(), "region"); | {
"end_byte": 219,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOutliningSpansForUnbalancedRegion.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_00.ts_0_782 | /// <reference path='fourslash.ts'/>
// Should handle shorthand property assignments of class constructors
//// interface Foo {
//// someFunction(): void;
//// }
////
//// interface FooConstructor {
//// new (): Foo
//// }
////
//// interface Bar {
//// Foo: FooConstructor;
//// }
////
//// var x = class /*classExpression*/Foo {
//// createBarInClassExpression(): Bar {
//// return {
//// Fo/*classExpressionRef*/o
//// };
//// }
////
//// someFunction() {}
//// }
////
//// class /*declaredClass*/Foo {
////
//// }
////
//// function createBarUsingClassDeclaration(): Bar {
//// return {
//// Fo/*declaredClassRef*/o
//// };
//// }
verify.baselineGoToImplementation("classExpressionRef", "declaredClassRef"); | {
"end_byte": 782,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_00.ts"
} |
TypeScript/tests/cases/fourslash/refactorInferFunctionReturnTypePredicate1.ts_0_443 | /// <reference path='fourslash.ts' />
//// function /*a*//*b*/isString(value: unknown) {
//// return typeof value === "string";
//// }
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Infer function return type",
actionName: "Infer function return type",
actionDescription: "Infer function return type",
newContent:
`function isString(value: unknown): value is string {
return typeof value === "string";
}`
});
| {
"end_byte": 443,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorInferFunctionReturnTypePredicate1.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesAbstract02.ts_0_466 | /// <reference path='fourslash.ts' />
////// Not valid TS (abstract methods can only appear in abstract classes)
////class Animal {
//// [|abstract|] walk(): void;
//// [|abstract|] makeSound(): void;
////}
////// abstract cannot appear here, won't get highlighted
////let c = /*1*/abstract class Foo {
//// /*2*/abstract foo(): void;
//// abstract bar(): void;
////}
verify.baselineDocumentHighlights(["1", "2"]);
verify.baselineDocumentHighlights();
| {
"end_byte": 466,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesAbstract02.ts"
} |
TypeScript/tests/cases/fourslash/formattingInDestructuring3.ts_0_497 | /// <reference path='fourslash.ts'/>
/////*1*/const {
/////*2*/ a,
/////*3*/ b,
/////*4*/} = {a: 1, b: 2};
/////*5*/const {a: c} = {a: 1, b: 2};
format.document();
goTo.marker("1");
verify.currentLineContentIs("const {");
goTo.marker("2");
verify.currentLineContentIs(" a,");
goTo.marker("3");
verify.currentLineContentIs(" b,");
goTo.marker("4");
verify.currentLineContentIs("} = { a: 1, b: 2 };");
goTo.marker("5");
verify.currentLineContentIs("const { a: c } = { a: 1, b: 2 };"); | {
"end_byte": 497,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingInDestructuring3.ts"
} |
TypeScript/tests/cases/fourslash/getNameOrDottedNameSpan.ts_0_158 | /// <reference path='fourslash.ts' />
//// var x = new Date().toU/**/TCString();
goTo.marker();
verify.nameOrDottedNameSpanTextIs("new Date().toUTCString"); | {
"end_byte": 158,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getNameOrDottedNameSpan.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToEsModule_export_referenced.ts_0_501 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @target: esnext
// @Filename: /a.js
////exports.x = 0;
////exports.x;
////
////const y = 1;
////exports.y = y;
////exports.y;
////
////exports.z = 2;
////exports.f = function(z) {
//// exports.z; z;
////}
verify.codeFix({
description: "Convert to ES module",
newFileContent:
`export const x = 0;
x;
const y = 1;
const _y = y;
export { _y as y };
_y;
const _z = 2;
export { _z as z };
export function f(z) {
_z; z;
}`,
});
| {
"end_byte": 501,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToEsModule_export_referenced.ts"
} |
TypeScript/tests/cases/fourslash/memberListInFunctionCall.ts_0_230 | /// <reference path='fourslash.ts' />
////function aa(x: any) {}
////aa({
//// "1": function () {
//// var b = "";
//// b/**/;
//// }
////});
goTo.marker();
edit.insert('.');
verify.completions({ includes: "charAt" });
| {
"end_byte": 230,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListInFunctionCall.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionFunctionOverloadsInClass.ts_0_546 | /// <reference path='fourslash.ts'/>
////class clsInOverload {
//// static fnOverload();
//// static [|/*staticFunctionOverload*/fnOverload|](foo: string);
//// static /*staticFunctionOverloadDefinition*/fnOverload(foo: any) { }
//// public [|/*functionOverload*/fnOverload|](): any;
//// public fnOverload(foo: string);
//// public /*functionOverloadDefinition*/fnOverload(foo: any) { return "foo" }
////
//// constructor() { }
////}
verify.baselineGoToDefinition(
"staticFunctionOverload",
"functionOverload",
);
| {
"end_byte": 546,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionFunctionOverloadsInClass.ts"
} |
TypeScript/tests/cases/fourslash/formatTsxMultilineAttributeString.ts_0_238 | /// <reference path="fourslash.ts"/>
// @Filename: foo.tsx
////(
//// <input
//// value="x
//// x"
//// />
////);
format.document();
verify.currentFileContentIs(`(
<input
value="x
x"
/>
);`);
| {
"end_byte": 238,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatTsxMultilineAttributeString.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedFunction12.ts_3_301 | / <reference path="fourslash.ts" />
////interface MyType {
////}
////
////function foo(x: string, y: number, z: boolean) {
//// function bar(a: number, b: string = "hello", c: typeof x = "hello") {
//// var v = (p: /*1*/
////}
verify.completions({ marker: "1", includes: "MyType" });
| {
"end_byte": 301,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedFunction12.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsItems.ts_0_7224 | /// <reference path="fourslash.ts"/>
////// Interface
////interface IPoint {
//// getDist(): number;
//// new(): IPoint;
//// (): any;
//// [x:string]: number;
//// prop: string;
////}
////
/////// Module
////module Shapes {
////
//// // Class
//// export class Point implements IPoint {
//// constructor (public x: number, public y: number) { }
////
//// // Instance member
//// getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); }
////
//// // Getter
//// get value(): number { return 0; }
////
//// // Setter
//// set value(newValue: number) { return; }
////
//// // Static member
//// static origin = new Point(0, 0);
////
//// // Static method
//// private static getOrigin() { return Point.origin; }
//// }
////
//// enum Values { value1, value2, value3 }
////}
////
////// Local variables
////var p: IPoint = new Shapes.Point(3, 4);
////var dist = p.getDist();
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "dist",
"kind": "var"
},
{
"text": "IPoint",
"kind": "interface",
"childItems": [
{
"text": "()",
"kind": "call"
},
{
"text": "new()",
"kind": "construct"
},
{
"text": "[]",
"kind": "index"
},
{
"text": "getDist",
"kind": "method"
},
{
"text": "prop",
"kind": "property"
}
]
},
{
"text": "p",
"kind": "var"
},
{
"text": "Shapes",
"kind": "module",
"childItems": [
{
"text": "Point",
"kind": "class",
"kindModifiers": "export",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "getDist",
"kind": "method"
},
{
"text": "getOrigin",
"kind": "method",
"kindModifiers": "private,static"
},
{
"text": "origin",
"kind": "property",
"kindModifiers": "static"
},
{
"text": "value",
"kind": "getter"
},
{
"text": "value",
"kind": "setter"
},
{
"text": "x",
"kind": "property",
"kindModifiers": "public"
},
{
"text": "y",
"kind": "property",
"kindModifiers": "public"
}
]
},
{
"text": "Values",
"kind": "enum",
"childItems": [
{
"text": "value1",
"kind": "enum member"
},
{
"text": "value2",
"kind": "enum member"
},
{
"text": "value3",
"kind": "enum member"
}
]
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "dist",
"kind": "var"
},
{
"text": "IPoint",
"kind": "interface"
},
{
"text": "p",
"kind": "var"
},
{
"text": "Shapes",
"kind": "module"
}
]
},
{
"text": "IPoint",
"kind": "interface",
"childItems": [
{
"text": "()",
"kind": "call"
},
{
"text": "new()",
"kind": "construct"
},
{
"text": "[]",
"kind": "index"
},
{
"text": "getDist",
"kind": "method"
},
{
"text": "prop",
"kind": "property"
}
],
"indent": 1
},
{
"text": "Shapes",
"kind": "module",
"childItems": [
{
"text": "Point",
"kind": "class",
"kindModifiers": "export"
},
{
"text": "Values",
"kind": "enum"
}
],
"indent": 1
},
{
"text": "Point",
"kind": "class",
"kindModifiers": "export",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "getDist",
"kind": "method"
},
{
"text": "getOrigin",
"kind": "method",
"kindModifiers": "private,static"
},
{
"text": "origin",
"kind": "property",
"kindModifiers": "static"
},
{
"text": "value",
"kind": "getter"
},
{
"text": "value",
"kind": "setter"
},
{
"text": "x",
"kind": "property",
"kindModifiers": "public"
},
{
"text": "y",
"kind": "property",
"kindModifiers": "public"
}
],
"indent": 2
},
{
"text": "Values",
"kind": "enum",
"childItems": [
{
"text": "value1",
"kind": "enum member"
},
{
"text": "value2",
"kind": "enum member"
},
{
"text": "value3",
"kind": "enum member"
}
],
"indent": 2
}
]);
| {
"end_byte": 7224,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsItems.ts"
} |
TypeScript/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts_0_536 | /// <reference path='fourslash.ts'/>
/////*1*/new Error(`Failed to expand glob: ${projectSpec.filesGlob}
/////*2*/ at projectPath : ${projectFile}
/////*3*/ with error: ${ex.message}`)
format.document();
goTo.marker("1");
verify.currentLineContentIs("new Error(`Failed to expand glob: ${projectSpec.filesGlob}");
goTo.marker("2");
verify.currentLineContentIs(" at projectPath : ${projectFile}");
goTo.marker("3");
verify.currentLineContentIs(" with error: ${ex.message}`)"); | {
"end_byte": 536,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleImplementsIntersection1.ts_0_305 | /// <reference path='fourslash.ts' />
//// interface I1 {
//// x: number;
//// }
//// interface I2 {
//// x: string;
//// }
////
//// class C implements I1,I2 {[| |]}
verify.codeFixAvailable([
{ description: "Implement interface 'I1'" },
{ description: "Implement interface 'I2'" },
]);
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleImplementsIntersection1.ts"
} |
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction_formatBug.ts_0_512 | /// <reference path='fourslash.ts' />
// @Filename: /a.tsx
////const x = () /*a*/=>/*b*/
//// <div>:</div>
// This code with this exact indent level used to crash in `indentMultilineCommentOrJsxText`.
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Add or remove braces in an arrow function",
actionName: "Add braces to arrow function",
actionDescription: "Add braces to arrow function",
newContent:
`const x = () =>
{
return <div>:</div>;
}`,
});
| {
"end_byte": 512,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction_formatBug.ts"
} |
TypeScript/tests/cases/fourslash/completionsJsPropertyAssignment.ts_0_319 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: /a.js
/////** @type {{ p: "x" | "y" }} */
////const x = { p: "x" };
////x.p = "[|/**/|]";
verify.completions({ marker: "", exact: [
{ name: "x", replacementSpan: test.ranges()[0] },
{ name: "y", replacementSpan: test.ranges()[0] }
] });
| {
"end_byte": 319,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsJsPropertyAssignment.ts"
} |
TypeScript/tests/cases/fourslash/completionsECMAPrivateMemberTriggerCharacter.ts_0_286 | /// <reference path="fourslash.ts" />
// @target: esnext
////class K {
//// #value: number;
////
//// foo() {
//// this.#/**/
//// }
////}
verify.completions(
{ marker: "", exact: ["#value", "foo"] },
{ marker: "", exact: ["#value", "foo"], triggerCharacter: "#" },
); | {
"end_byte": 286,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsECMAPrivateMemberTriggerCharacter.ts"
} |
TypeScript/tests/cases/fourslash/syntacticClassificationsTripleSlash2.ts_0_437 | /// <reference path="fourslash.ts"/>
//// ///<reference path = "./module.ts"/>
const c = classification("original");
verify.syntacticClassificationsAre(
c.comment("///"),
c.punctuation("<"),
c.jsxSelfClosingTagName("reference"),
c.comment(" "),
c.jsxAttribute("path"),
c.comment(" "),
c.operator("="),
c.comment(" "),
c.jsxAttributeStringLiteralValue("\"./module.ts\""),
c.punctuation("/>"));
| {
"end_byte": 437,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsTripleSlash2.ts"
} |
TypeScript/tests/cases/fourslash/completionsPaths_fromTypings.ts_0_543 | /// <reference path="fourslash.ts" />
// @Filename: /node_modules/@types/foo/index.d.ts
////
// @Filename: /node_modules/@types/foo/bar.d.ts
////
// @Filename: /a.ts
////import {} from "unrelated//*0*/";
////import {} from "foo//*1*/";
/////// <reference types="foo//*2*/" />
verify.completions(
{ marker: "0", exact: [], isNewIdentifierLocation: true },
{
marker: ["1", "2"],
exact: ["bar", "index"].map(name => ({ name, kind: "script", kindModifiers: ".d.ts" })),
isNewIdentifierLocation: true,
},
);
| {
"end_byte": 543,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsPaths_fromTypings.ts"
} |
TypeScript/tests/cases/fourslash/unusedTypeParametersInClass2.ts_0_259 | /// <reference path='fourslash.ts' />
// @noUnusedParameters: true
////[|class greeter<X, Y> |] {
//// public a: X;
////}
verify.codeFix({
description: "Remove unused declaration for: 'Y'",
index: 0,
newRangeContent: "class greeter<X> ",
});
| {
"end_byte": 259,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedTypeParametersInClass2.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ComparisonOperator.ts_0_390 | /// <reference path='fourslash.ts' />
////let a = { b: { c: 0 } };
/////*a*/a && a.b && a.b.c === 1;/*b*/
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert to optional chain expression",
actionName: "Convert to optional chain expression",
actionDescription: "Convert to optional chain expression",
newContent:
`let a = { b: { c: 0 } };
a?.b?.c === 1;`
}); | {
"end_byte": 390,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ComparisonOperator.ts"
} |
TypeScript/tests/cases/fourslash/todoComments8.ts_0_106 | //// /*
//// [|HACK 1|]
//// [|TODO 2|]
//// */
verify.todoCommentsInCurrentFile(["TODO", "HACK"]); | {
"end_byte": 106,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/todoComments8.ts"
} |
TypeScript/tests/cases/fourslash/annotateWithTypeFromJSDoc1.ts_0_488 | /// <reference path='fourslash.ts' />
// @Filename: test123.ts
/////** @type {number} */
////var [|x|];
verify.getSuggestionDiagnostics([
{ message: "JSDoc types may be moved to TypeScript types.", code: 80004 },
{ message: "Variable 'x' implicitly has an 'any' type, but a better type may be inferred from usage.", code: 7043 }]);
verify.codeFix({
description: "Annotate with type from JSDoc",
index: 0,
newFileContent:
`/** @type {number} */
var x: number;`,
});
| {
"end_byte": 488,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/annotateWithTypeFromJSDoc1.ts"
} |
TypeScript/tests/cases/fourslash/codefixEnableJsxFlag_noTsconfig.ts_0_162 | /// <reference path='fourslash.ts' />
// @Filename: /dir/a.tsx
////export const Component = () => <></>
goTo.file("/dir/a.tsx");
verify.not.codeFixAvailable();
| {
"end_byte": 162,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codefixEnableJsxFlag_noTsconfig.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationClass.ts_0_1202 | /// <reference path='fourslash.ts' />
// @BaselineFile: bpSpan_class.baseline
// @Filename: bpSpan_class.ts
////class Greeter {
//// constructor(public greeting: string, ...b: string[]) {
//// }
//// greet() {
//// return "<h1>" + this.greeting + "</h1>";
//// }
//// private x: string;
//// private x1: number = 10;
//// private fn() {
//// return this.greeting;
//// }
//// get greetings() {
//// return this.greeting;
//// }
//// set greetings(greetings: string) {
//// this.greeting = greetings;
//// }
////}
////class Greeter2 {
////}
////class Greeter1
////{
//// constructor(public greeting: string, ...b: string[])
//// {
//// }
//// greet()
//// {
//// return "<h1>" + this.greeting + "</h1>";
//// }
//// private x: string;
//// private x1: number = 10;
//// private fn()
//// {
//// return this.greeting;
//// }
//// get greetings()
//// {
//// return this.greeting;
//// }
//// set greetings(greetings: string)
//// {
//// this.greeting = greetings;
//// }
////}
////class Greeter12
////{
////}
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 1202,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationClass.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_EmptySpanBinaryExpression.ts_0_588 | /// <reference path='fourslash.ts' />
////let a = { b: { c: 0 } };
////a && a.b && /*a*//*b*/a.b.c;
// verify that the refactor is offered for empty spans in expression statements.
goTo.select("a", "b");
verify.not.refactorAvailableForTriggerReason("implicit", "Convert to optional chain expression");
edit.applyRefactor({
refactorName: "Convert to optional chain expression",
actionName: "Convert to optional chain expression",
actionDescription: "Convert to optional chain expression",
newContent:
`let a = { b: { c: 0 } };
a?.b?.c;`,
triggerReason: "invoked"
}); | {
"end_byte": 588,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_EmptySpanBinaryExpression.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractTypeForTriggerReason2.ts_0_232 | /// <reference path='fourslash.ts' />
//// var x: s/*a*/tr/*b*/ing;
goTo.select("a", "b");
verify.refactorAvailableForTriggerReason("implicit", "Extract type");
verify.refactorAvailableForTriggerReason("invoked", "Extract type");
| {
"end_byte": 232,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractTypeForTriggerReason2.ts"
} |
TypeScript/tests/cases/fourslash/organizeImports11.ts_0_1104 | /// <reference path="fourslash.ts" />
// @Filename: /test.ts
////import { TypeA, TypeB, TypeC, UnreferencedType } from './my-types';
////
/////**
//// * MyClass {@link TypeA}
//// */
////export class MyClass {
////
//// /**
//// * Some Property {@link TypeB}
//// */
//// public something;
////
//// /**
//// * Some function {@link TypeC}
//// */
//// public myMethod() {
////
//// /**
//// * Some lambda function {@link TypeC}
//// */
//// const someFunction = () => {
//// return '';
//// }
//// someFunction();
//// }
////}
// @Filename: /my-types.ts
//// export type TypeA = string;
//// export class TypeB { }
//// export type TypeC = () => string;
verify.organizeImports(`import { TypeA, TypeB, TypeC } from './my-types';
/**
* MyClass {@link TypeA}
*/
export class MyClass {
/**
* Some Property {@link TypeB}
*/
public something;
/**
* Some function {@link TypeC}
*/
public myMethod() {
/**
* Some lambda function {@link TypeC}
*/
const someFunction = () => {
return '';
}
someFunction();
}
}`
); | {
"end_byte": 1104,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImports11.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesAsyncAwait3.ts_0_227 | /// <reference path='fourslash.ts' />
// Not valid TS ('await' expression is only allowed within an async function.)
////a/**/wait 100;
////async function f() {
//// await 300;
////}
verify.baselineDocumentHighlights(""); | {
"end_byte": 227,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesAsyncAwait3.ts"
} |
TypeScript/tests/cases/fourslash/completionListAtEOF1.ts_0_113 | /// <reference path="fourslash.ts"/>
//// if(0 === ''.
goTo.eof();
verify.completions({ includes: "charAt" });
| {
"end_byte": 113,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAtEOF1.ts"
} |
TypeScript/tests/cases/fourslash/completionListAfterRegularExpressionLiteral05.ts_0_236 | /// <reference path="fourslash.ts" />
////let v = 100;
////let x = /absidey/g/**/
// Should get nothing at the marker since it's
// going to be considered part of the regex flags.
verify.completions({ marker: "", exact: undefined });
| {
"end_byte": 236,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAfterRegularExpressionLiteral05.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCalledES2015Import12.ts_0_411 | /// <reference path='fourslash.ts' />
// @esModuleInterop: true
// @Filename: foo.d.ts
////declare function foo(): void;
////declare namespace foo {}
////export = foo;
// @Filename: index.ts
////import * as foo from "./foo";
////[|foo()|];
goTo.file(1);
verify.codeFix({
description: `Use synthetic 'default' member.`,
newFileContent: `import * as foo from "./foo";
foo.default();`,
index: 2,
});
| {
"end_byte": 411,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCalledES2015Import12.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Anon_unusedName.ts_0_1876 | /// <reference path='fourslash.ts' />
//// /*z*/c/*y*/onst /*x*/f/*w*/oo = /*v*/f/*u*/unction bar() /*t*/{/*s*/ /*r*/r/*q*/eturn 42;};
goTo.select("z", "y");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
goTo.select("x", "w");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
goTo.select("v", "u");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
goTo.select("t", "s");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
goTo.select("r", "q");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
| {
"end_byte": 1876,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Anon_unusedName.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionYield4.ts_0_156 | /// <reference path="fourslash.ts" />
//// function* gen() {
//// class C { [/*start*/yield 10]() {} }
//// }
verify.baselineGoToDefinition("start");
| {
"end_byte": 156,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionYield4.ts"
} |
TypeScript/tests/cases/fourslash/inlineVariableWriteReference.ts_0_161 | /// <reference path="fourslash.ts" />
////const /*a*/x/*b*/ = 0;
////const y = x++ + 1;
goTo.select("a", "b");
verify.not.refactorAvailable("Inline variable"); | {
"end_byte": 161,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableWriteReference.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCorrectReturnValue19.ts_0_602 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// }
//// interface ElementAttributesProperty { props; }
//// }
//// interface A {
//// bar: string
//// }
//// class Comp { props: { t: () => number } }
//// var x = <Comp t={() => { bar: '1' }} />;
verify.codeFixAvailable([
{ description: 'Wrap the following body with parentheses which should be an object literal' },
{ description: `Infer type of 'props' from usage` },
{ description: 'Remove unused label' },
]);
| {
"end_byte": 602,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCorrectReturnValue19.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoMeaning.ts_0_2445 | ///<reference path="fourslash.ts" />
// Testing that quickInfo gets information with a corresponding meaning: values to values, types to types.
// For quick info purposes, we don't resolve past aliases.
// However, when we have an alias for a type, the quickInfo for a value with the same should skip the alias, and vice versa.
// goToDefinition should work the same way.
// @Filename: foo.d.ts
////declare const [|/*foo_value_declaration*/foo: number|];
////[|declare module "foo_module" {
//// interface /*foo_type_declaration*/I { x: number; y: number }
//// export = I;
////}|]
// @Filename: foo_user.ts
///////<reference path="foo.d.ts" />
////[|import foo = require("foo_module");|]
////const x = foo/*foo_value*/;
////const i: foo/*foo_type*/ = { x: 1, y: 2 };
verify.noErrors();
const [r0, r1, r2] = test.ranges();
verify.navigateTo({
pattern: "foo",
expected: [
{ name: "foo", kind: "const", kindModifiers: "declare", range: r0 },
{ name: "foo", kind: "alias", range: r2 },
{ name: "foo_module", matchKind: "prefix", kind: "module", kindModifiers: "declare", range: r1 },
],
});
goTo.marker("foo_value");
verify.quickInfoIs("const foo: number");
goTo.marker("foo_type");
verify.quickInfoIs("(alias) interface foo\nimport foo = require(\"foo_module\")");
// Above tested for global const and imported interface. Now test with global interface and imported const.
// @Filename: bar.d.ts
////[|declare interface /*bar_type_declaration*/bar { x: number; y: number }|]
////[|declare module "bar_module" {
//// const /*bar_value_declaration*/x: number;
//// export = x;
////}|]
// @Filename: bar_user.ts
///////<reference path="bar.d.ts" />
////[|import bar = require("bar_module");|]
////const x = bar/*bar_value*/;
////const i: bar/*bar_type*/ = { x: 1, y: 2 };
const [ , , , r3, r4, r5] = test.ranges();
verify.navigateTo({
pattern: "bar",
expected: [
{ name: "bar", kind: "interface", kindModifiers: "declare", range: r3 },
{ name: "bar", kind: "alias", range: r5 },
{ name: "bar_module", matchKind: "prefix", kind: "module", kindModifiers: "declare", range: r4 },
],
});
goTo.marker("bar_value");
verify.quickInfoIs("(alias) const bar: number\nimport bar = require(\"bar_module\")");
goTo.marker("bar_type");
verify.quickInfoIs("interface bar");
verify.baselineGetDefinitionAtPosition("foo_value", "foo_type", "bar_value", "bar_type");
| {
"end_byte": 2445,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoMeaning.ts"
} |
TypeScript/tests/cases/fourslash/tripleSlashRefPathCompletionRelativePaths.ts_0_1620 | /// <reference path='fourslash.ts' />
// Exercises relative path completions going up and down 2 directories
// and the use of forward- and back-slashes and combinations thereof.
// @Filename: f.ts
//// /*f1*/
// @Filename: d1/g.ts
//// /*g1*/
// @Filename: d1/d2/h.ts
//// /*h1*/
// @Filename: d1/d2/d3/i.ts
//// /*i1*/
// @Filename: d1/d2/d3/d4/j.ts
//// /*j1*/
// @Filename: d1/d2/test.ts
//// /// <reference path="/*0*/
//// /// <reference path=".//*1*/
//// /// <reference path="[|./*2*/|]
//// /// <reference path="[|../*3*/|]
//// /// <reference path="d3/*4*/
//// /// <reference path="..//*5*/
//// /// <reference path="..\/*6*/
//// /// <reference path="../..//*7*/
//// /// <reference path="d3//*8*/
//// /// <reference path="./d3//*9*/
//// /// <reference path="d3/d4//*10*/
//// /// <reference path="./d3/d4//*11*/
verify.completions(
// working dir completions
{ marker: ["0", "1", "4"], exact: ["h.ts", "d3"], isNewIdentifierLocation: true },
{ marker: "2", exact: ["h.ts", "d3"].map(name => ({ name, replacementSpan: test.ranges()[0] })), isNewIdentifierLocation: true },
{ marker: "3", exact: ["h.ts", "d3"].map(name => ({ name, replacementSpan: test.ranges()[1] })), isNewIdentifierLocation: true },
// parent dir completions
{ marker: ["5", "6"], exact: ["g.ts", "d2"], isNewIdentifierLocation: true },
{ marker: "7", exact: ["f.ts", "d1"], isNewIdentifierLocation: true },
// child dir completions
{ marker: ["8", "9"], exact: ["i.ts", "d4"], isNewIdentifierLocation: true },
{ marker: ["10", "11"], exact: "j.ts", isNewIdentifierLocation: true },
);
| {
"end_byte": 1620,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tripleSlashRefPathCompletionRelativePaths.ts"
} |
TypeScript/tests/cases/fourslash/objectLiteralBindingInParameter.ts_0_492 | /// <reference path="fourslash.ts"/>
////interface I { x1: number; x2: string }
////function f(cb: (ev: I) => any) { }
////f(({/*1*/}) => 0);
////[<I>null].reduce(({/*2*/}, b) => b);
////interface Foo {
//// m(x: { x1: number, x2: number }): void;
//// prop: I;
////}
////let x: Foo = {
//// m({ /*3*/ }) {
//// },
//// get prop(): I { return undefined; },
//// set prop({ /*4*/ }) {
//// }
////};
verify.completions({ marker: test.markers(), exact: ["x1", "x2"] });
| {
"end_byte": 492,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/objectLiteralBindingInParameter.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_addImportFromTargetFile.ts_0_518 | /// <reference path='fourslash.ts' />
//@Filename: /bar.ts
////import './blah';
////
////const a = 2;
// @Filename: /a.ts
////import { b } from './other';
////
////[|const y = b + 10;|]
////y;
// @Filename: /other.ts
////export const b = 1;
verify.moveToFile({
newFileContents: {
"/a.ts":
`import { y } from './bar';
y;`,
"/bar.ts":
`import './blah';
import { b } from './other';
const a = 2;
export const y = b + 10;
`,
},
interactiveRefactorArguments: {targetFile: "/bar.ts"},
});
| {
"end_byte": 518,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_addImportFromTargetFile.ts"
} |
TypeScript/tests/cases/fourslash/renameFunctionParameter1.ts_0_224 | /// <reference path="fourslash.ts" />
////function Foo() {
//// /**
//// * @param {number} p
//// */
//// this.foo = function foo(p/**/) {
//// return p;
//// }
////}
verify.baselineRename("", {});
| {
"end_byte": 224,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameFunctionParameter1.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarInitializerSpans.ts_0_3508 | /// <reference path="fourslash.ts" />
////// get the name for the navbar from the variable name rather than the function name
////const [|[|x|] = () => { var [|a|]; }|];
////const [|[|f|] = function f() { var [|b|]; }|];
////const [|[|y|] = { [|[|z|]: function z() { var [|c|]; }|] }|];
const [
s0,
s0Name,
s0Child,
s1,
s1Name,
s1Child,
s2,
s2Name,
s2Child,
s2ChildName,
s2GrandChildName
] = test.spans();
const sGlobal = { start: 0, length: 188 };
verify.navigationTree({
text: "<global>",
kind: "script",
spans: [sGlobal],
childItems: [
{
text: "f",
kind: "const",
spans: [s1],
nameSpan: s1Name,
childItems: [
{
text: "b",
kind: "var",
spans: [s1Child],
nameSpan: s1Child,
},
],
},
{
text: "x",
kind: "const",
spans: [s0],
nameSpan: s0Name,
childItems: [
{
text: "a",
kind: "var",
spans: [s0Child],
nameSpan: s0Child,
},
],
},
{
text: "y",
kind: "const",
spans: [s2],
nameSpan: s2Name,
childItems:[
{
text: "z",
kind: "method",
spans: [s2Child],
nameSpan: s2ChildName,
childItems: [
{
text: "c",
kind: "var",
spans: [s2GrandChildName],
nameSpan: s2GrandChildName,
},
],
},
],
}
]
}, { checkSpans: true });
verify.navigationBar([
{
text: "<global>",
kind: "script",
spans: [sGlobal],
childItems: [
{
text: "f",
kind: "const",
spans: [s1],
},
{
text: "x",
kind: "const",
spans: [s0],
},
{
text: "y",
kind: "const",
spans: [s2],
}
],
},
{
text: "f",
kind: "const",
spans: [s1],
childItems: [
{
text: "b",
kind: "var",
spans: [s1Child],
},
],
indent: 1,
},
{
text: "x",
kind: "const",
spans: [s0],
childItems: [
{
text: "a",
kind: "var",
spans: [s0Child],
},
],
indent: 1,
},
{
text: "y",
kind: "const",
spans: [s2],
childItems: [
{
text: "z",
kind: "method",
spans: [s2Child],
},
],
indent: 1,
},
{
text: "z",
kind: "method",
spans: [s2Child],
childItems: [
{
text: "c",
kind: "var",
spans: [s2GrandChildName],
},
],
indent: 2,
},
], { checkSpans: true });
| {
"end_byte": 3508,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarInitializerSpans.ts"
} |
TypeScript/tests/cases/fourslash/fixNaNEquality4.ts_0_223 | /// <reference path="fourslash.ts" />
////declare const x: number;
////[|if (NaN !== x) {}|]
verify.codeFix({
index: 0,
description: "Use `!Number.isNaN(x)`.",
newRangeContent: "if (!Number.isNaN(x)) {}",
});
| {
"end_byte": 223,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/fixNaNEquality4.ts"
} |
TypeScript/tests/cases/fourslash/getOutliningSpansForTemplateLiteral.ts_0_478 | /// <reference path="fourslash.ts"/>
//// declare function tag(...args: any[]): void
//// const a = [|`signal line`|]
//// const b = [|`multi
//// line`|]
//// const c = tag[|`signal line`|]
//// const d = tag[|`multi
//// line`|]
//// const e = [|`signal ${1} line`|]
//// const f = [|`multi
//// ${1}
//// line`|]
//// const g = tag[|`signal ${1} line`|]
//// const h = tag[|`multi
//// ${1}
//// line`|]
//// const i = ``
verify.outliningSpansInCurrentFile(test.ranges());
| {
"end_byte": 478,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOutliningSpansForTemplateLiteral.ts"
} |
TypeScript/tests/cases/fourslash/completionsWithOptionalPropertiesGenericPartial.ts_0_660 | /// <reference path="fourslash.ts" />
// @strict: true
//// interface Foo {
//// a_a: boolean;
//// a_b: boolean;
//// a_c: boolean;
//// b_a: boolean;
//// }
//// function partialFoo<T extends Partial<Foo>>(t: T) {return t}
//// partialFoo({ /*1*/ });
verify.completions({
marker: '1',
includes: [
{
sortText: completion.SortText.OptionalMember,
name: 'a_a'
},
{
sortText: completion.SortText.OptionalMember,
name: 'a_b'
},
{
sortText: completion.SortText.OptionalMember,
name: 'a_c'
},
{
sortText: completion.SortText.OptionalMember,
name: 'b_a'
},
]
})
| {
"end_byte": 660,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsWithOptionalPropertiesGenericPartial.ts"
} |
TypeScript/tests/cases/fourslash/renameDefaultKeyword.ts_0_482 | /// <reference path="fourslash.ts" />
// @noLib: true
////function f(value: string, /*1*/default: string) {}
////
////const /*2*/default = 1;
////
////function /*3*/default() {}
////
////class /*4*/default {}
////
////const foo = {
//// /*5*/[|default|]: 1
////}
for (const marker of ["1", "2", "3", "4"]) {
goTo.marker(marker);
verify.renameInfoFailed(ts.Diagnostics.You_cannot_rename_this_element.message);
}
goTo.marker("5");
verify.renameInfoSucceeded("default");
| {
"end_byte": 482,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameDefaultKeyword.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_ofAlias_preferShortPath.ts_0_1144 | /// <reference path="fourslash.ts" />
// Test that the completion is for the shortest path, even if that's a re-export.
// Note that `source` in completionEntries will still be the original exporting path, but we use the re-export in completionDetails.
// @moduleResolution: node
// @module: commonJs
// @noLib: true
// @Filename: /foo/index.ts
////export { foo } from "./lib/foo";
// @Filename: /foo/lib/foo.ts
////export const foo = 0;
// @Filename: /user.ts
////fo/**/
verify.completions({
marker: "",
exact: completion.globalsPlus([
{
name: "foo",
source: "/foo/lib/foo",
sourceDisplay: "./foo",
text: "const foo: 0",
kind: "const",
kindModifiers: "export",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
], { noLib: true }),
preferences: { includeCompletionsForModuleExports: true },
});
verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/foo/lib/foo",
description: `Add import from "./foo"`,
newFileContent: `import { foo } from "./foo";
fo`,
});
| {
"end_byte": 1144,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_ofAlias_preferShortPath.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.