Merge pull request #21158 from amcasey/NewlineConsistency

Handle linebreaks consistently in code fixes and refactorings
This commit is contained in:
Andrew Casey
2018-01-18 16:02:27 -08:00
committed by GitHub
124 changed files with 442 additions and 524 deletions
+1 -3
View File
@@ -2568,9 +2568,7 @@ Actual: ${stringify(fullActual)}`);
const originalContent = scriptInfo.content;
for (const codeFix of codeFixes) {
this.applyEdits(codeFix.changes[0].fileName, codeFix.changes[0].textChanges, /*isFormattingEdit*/ false);
let text = this.rangeText(ranges[0]);
// TODO:GH#18445 (remove this line to see errors in many `importNameCodeFix` tests)
text = text.replace(/\r\n/g, "\n");
const text = this.rangeText(ranges[0]);
actualTextArray.push(text);
scriptInfo.updateContent(originalContent);
}
@@ -121,7 +121,6 @@ namespace ts {
const sourceFile = program.getSourceFile(path);
const context: RefactorContext = {
cancellationToken: { throwIfCancellationRequested: noop, isCancellationRequested: returnFalse },
newLineCharacter,
program,
file: sourceFile,
startPosition: selectionRange.start,
@@ -185,7 +184,6 @@ namespace ts {
const sourceFile = program.getSourceFile(f.path);
const context: RefactorContext = {
cancellationToken: { throwIfCancellationRequested: noop, isCancellationRequested: returnFalse },
newLineCharacter,
program,
file: sourceFile,
startPosition: selectionRange.start,
-1
View File
@@ -10,7 +10,6 @@ namespace ts {
export interface CodeFixContextBase extends textChanges.TextChangesContext {
sourceFile: SourceFile;
program: Program;
host: LanguageServiceHost;
cancellationToken: CancellationToken;
}
@@ -9,12 +9,14 @@ namespace ts.codefix {
registerCodeFix({
errorCodes,
getCodeActions(context) {
const { sourceFile, program, newLineCharacter, span } = context;
const { sourceFile, program, span } = context;
if (!isInJavaScriptFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
return undefined;
}
const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
return [{
description: getLocaleSpecificMessage(Diagnostics.Ignore_this_error_message),
changes: [createFileTextChanges(sourceFile.fileName, [getIgnoreCommentLocationForLocation(sourceFile, span.start, newLineCharacter)])],
@@ -36,7 +38,7 @@ namespace ts.codefix {
fixIds: [fixId], // No point applying as a group, doing it once will fix all errors
getAllCodeActions: context => codeFixAllWithTextChanges(context, errorCodes, (changes, err) => {
if (err.start !== undefined) {
changes.push(getIgnoreCommentLocationForLocation(err.file!, err.start, context.newLineCharacter));
changes.push(getIgnoreCommentLocationForLocation(err.file!, err.start, getNewLineOrDefaultFromHost(context.host, context.formatContext.options)));
}
}),
});
@@ -142,7 +142,7 @@ namespace ts.codefix {
return typeNode || createKeywordTypeNode(SyntaxKind.AnyKeyword);
}
function createAddPropertyDeclarationAction(context: textChanges.TextChangesContext, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, makeStatic: boolean, tokenName: string, typeNode: TypeNode): CodeFixAction {
function createAddPropertyDeclarationAction(context: CodeFixContext, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, makeStatic: boolean, tokenName: string, typeNode: TypeNode): CodeFixAction {
const description = formatStringFromArgs(getLocaleSpecificMessage(makeStatic ? Diagnostics.Declare_static_property_0 : Diagnostics.Declare_property_0), [tokenName]);
const changes = textChanges.ChangeTracker.with(context, t => addPropertyDeclaration(t, classDeclarationSourceFile, classDeclaration, tokenName, typeNode, makeStatic));
return { description, changes, fixId };
@@ -159,7 +159,7 @@ namespace ts.codefix {
changeTracker.insertNodeAtClassStart(classDeclarationSourceFile, classDeclaration, property);
}
function createAddIndexSignatureAction(context: textChanges.TextChangesContext, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, tokenName: string, typeNode: TypeNode): CodeFixAction {
function createAddIndexSignatureAction(context: CodeFixContext, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, tokenName: string, typeNode: TypeNode): CodeFixAction {
// Index signatures cannot have the static modifier.
const stringTypeNode = createKeywordTypeNode(SyntaxKind.StringKeyword);
const indexingParameter = createParameter(
@@ -181,7 +181,7 @@ namespace ts.codefix {
return { description: formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Add_index_signature_for_property_0), [tokenName]), changes, fixId: undefined };
}
function getActionForMethodDeclaration(context: textChanges.TextChangesContext, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, token: Identifier, callExpression: CallExpression, makeStatic: boolean, inJs: boolean): CodeFixAction | undefined {
function getActionForMethodDeclaration(context: CodeFixContext, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, token: Identifier, callExpression: CallExpression, makeStatic: boolean, inJs: boolean): CodeFixAction | undefined {
const description = formatStringFromArgs(getLocaleSpecificMessage(makeStatic ? Diagnostics.Declare_static_method_0 : Diagnostics.Declare_method_0), [token.text]);
const changes = textChanges.ChangeTracker.with(context, t => addMethodDeclaration(t, classDeclarationSourceFile, classDeclaration, token, callExpression, makeStatic, inJs));
return { description, changes, fixId };
+1 -6
View File
@@ -29,12 +29,8 @@ namespace ts.codefix {
symbolName: string;
}
interface SymbolAndTokenContext extends SymbolContext {
interface ImportCodeFixContext extends SymbolContext {
symbolToken: Identifier | undefined;
}
interface ImportCodeFixContext extends SymbolAndTokenContext {
host: LanguageServiceHost;
program: Program;
checker: TypeChecker;
compilerOptions: CompilerOptions;
@@ -173,7 +169,6 @@ namespace ts.codefix {
const symbolToken = cast(getTokenAtPosition(context.sourceFile, context.span.start, /*includeJsDocComment*/ false), isIdentifier);
return {
host: context.host,
newLineCharacter: context.newLineCharacter,
formatContext: context.formatContext,
sourceFile: context.sourceFile,
program,
-1
View File
@@ -627,7 +627,6 @@ namespace ts.Completions {
host,
program,
checker,
newLineCharacter: host.getNewLine(),
compilerOptions,
sourceFile,
formatContext,
-1
View File
@@ -19,7 +19,6 @@ namespace ts {
startPosition: number;
endPosition?: number;
program: Program;
host: LanguageServiceHost;
cancellationToken?: CancellationToken;
}
+2 -5
View File
@@ -1887,12 +1887,11 @@ namespace ts {
synchronizeHostData();
const sourceFile = getValidSourceFile(fileName);
const span = createTextSpanFromBounds(start, end);
const newLineCharacter = getNewLineOrDefaultFromHost(host);
const formatContext = formatting.getFormatContext(formatOptions);
return flatMap(deduplicate(errorCodes, equateValues, compareValues), errorCode => {
cancellationToken.throwIfCancellationRequested();
return codefix.getFixes({ errorCode, sourceFile, span, program, newLineCharacter, host, cancellationToken, formatContext });
return codefix.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext });
});
}
@@ -1900,10 +1899,9 @@ namespace ts {
synchronizeHostData();
Debug.assert(scope.type === "file");
const sourceFile = getValidSourceFile(scope.fileName);
const newLineCharacter = getNewLineOrDefaultFromHost(host);
const formatContext = formatting.getFormatContext(formatOptions);
return codefix.getAllFixes({ fixId, sourceFile, program, newLineCharacter, host, cancellationToken, formatContext });
return codefix.getAllFixes({ fixId, sourceFile, program, host, cancellationToken, formatContext });
}
function applyCodeActionCommand(action: CodeActionCommand): Promise<ApplyCodeActionCommandResult>;
@@ -2134,7 +2132,6 @@ namespace ts {
startPosition,
endPosition,
program: getProgram(),
newLineCharacter: formatOptions ? formatOptions.newLineCharacter : host.getNewLine(),
host,
formatContext: formatting.getFormatContext(formatOptions),
cancellationToken,
+2 -2
View File
@@ -187,7 +187,7 @@ namespace ts.textChanges {
}
export interface TextChangesContext {
newLineCharacter: string;
host: LanguageServiceHost;
formatContext: ts.formatting.FormatContext;
}
@@ -199,7 +199,7 @@ namespace ts.textChanges {
private readonly nodesInsertedAtClassStarts = createMap<{ sourceFile: SourceFile, cls: ClassLikeDeclaration, members: ClassElement[] }>();
public static fromContext(context: TextChangesContext): ChangeTracker {
return new ChangeTracker(context.newLineCharacter === "\n" ? NewLineKind.LineFeed : NewLineKind.CarriageReturnLineFeed, context.formatContext);
return new ChangeTracker(getNewLineOrDefaultFromHost(context.host, context.formatContext.options) === "\n" ? NewLineKind.LineFeed : NewLineKind.CarriageReturnLineFeed, context.formatContext);
}
public static with(context: TextChangesContext, cb: (tracker: ChangeTracker) => void): FileTextChanges[] {
+4 -2
View File
@@ -1259,8 +1259,10 @@ namespace ts {
/**
* The default is CRLF.
*/
export function getNewLineOrDefaultFromHost(host: LanguageServiceHost | LanguageServiceShimHost) {
return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed;
export function getNewLineOrDefaultFromHost(host: LanguageServiceHost | LanguageServiceShimHost, formatSettings?: FormatCodeSettings) {
return (formatSettings && formatSettings.newLineCharacter) ||
(host.getNewLine && host.getNewLine()) ||
carriageReturnLineFeed;
}
export function lineBreakPart() {
@@ -11,12 +11,12 @@ public testMethod( )
}`);
// We're missing scenarios of formatting option settings due to bug 693273 - [TypeScript] Need to improve fourslash support for formatting options.
// Missing scenario ** Uncheck Tools->Options->Text Editor->TypeScript->Formatting->General->Format on paste **
//verify.currentFileContentIs("module TestModule {\r\n\
// class TestClass{\r\n\
//private foo;\r\n\
//public testMethod( )\r\n\
//{}\r\n\
//}\r\n\
//verify.currentFileContentIs("module TestModule {\n\
// class TestClass{\n\
//private foo;\n\
//public testMethod( )\n\
//{}\n\
//}\n\
//}");
// Missing scenario ** Check Tools->Options->Text Editor->TypeScript->Formatting->General->Format on paste **
verify.currentFileContentIs(`module TestModule {
@@ -12,6 +12,6 @@
verify.quickInfoAt("className", "class Sphere");
goTo.marker('interfaceGoesHere');
edit.insert("\r\ninterface Surface {\r\n reflect: () => number;\r\n}\r\n");
edit.insert("\ninterface Surface {\n reflect: () => number;\n}\n");
verify.quickInfoAt("className", "class Sphere");
@@ -9,9 +9,8 @@
verify.codeFix({
description: "Declare property 'foo'",
index: 0,
// TODO: GH#18445
newFileContent: `class C {
foo: number;\r
foo: number;
method() {
this.foo = 10;
}
@@ -9,9 +9,8 @@
verify.codeFix({
description: "Add index signature for property 'foo'",
index: 1,
// TODO: GH#18445
newFileContent: `class C {
[x: string]: number;\r
[x: string]: number;
method() {
this.foo = 10;
}
@@ -9,9 +9,8 @@
verify.codeFix({
description: "Declare static property 'foo'",
index: 0,
// TODO: GH#18445
newFileContent: `class C {
static foo: number;\r
static foo: number;
static method() {
this.foo = 10;
}
@@ -15,10 +15,9 @@
verify.codeFix({
description: "Initialize property 'foo' in the constructor",
index: 0,
// TODO: GH#18445
newFileContent: `class C {
constructor() {\r
this.foo = undefined;\r
constructor() {
this.foo = undefined;
}
method() {
this.foo === 10;
@@ -13,12 +13,11 @@
verify.codeFix({
description: "Initialize static property 'foo'",
index: 0,
// TODO: GH#18445
newFileContent: `class C {
static method() {
()=>{ this.foo === 10 };
}
}\r
C.foo = undefined;\r
}
C.foo = undefined;
`
});
@@ -13,10 +13,9 @@
verify.codeFix({
description: "Initialize property 'foo' in the constructor",
index: 0,
// TODO: GH#18445
newFileContent: `class C {
constructor() {\r
this.foo = undefined;\r
constructor() {
this.foo = undefined;
}
prop = ()=>{ this.foo === 10 };
}`
@@ -11,10 +11,9 @@
verify.codeFix({
description: "Initialize static property 'foo'",
index: 2,
// TODO: GH#18445
newFileContent: `class C {
static p = ()=>{ this.foo === 10 };
}\r
C.foo = undefined;\r
}
C.foo = undefined;
`
});
@@ -11,12 +11,11 @@
verify.codeFixAll({
fixId: "addMissingMember",
newFileContent:
// TODO: GH#18445
`class C {
x: number;\r
y(): any {\r
throw new Error("Method not implemented.");\r
}\r
x: number;
y(): any {
throw new Error("Method not implemented.");
}
method() {
this.x = 0;
this.y();
@@ -16,13 +16,12 @@
verify.codeFixAll({
fixId: "addMissingMember",
newFileContent:
// TODO: GH#18445
`class C {
y() {\r
throw new Error("Method not implemented.");\r
}\r
constructor() {\r
this.x = undefined;\r
y() {
throw new Error("Method not implemented.");
}
constructor() {
this.x = undefined;
}
method() {
this.x;
@@ -12,9 +12,9 @@ verify.codeFix({
`class A {
f() {}
}
let B = class implements A {\r
f(): void {\r
throw new Error("Method not implemented.");\r
}\r
let B = class implements A {
f(): void {
throw new Error("Method not implemented.");
}
}`
});
@@ -20,7 +20,7 @@ verify.codeFix({
return C;
}
let B = class extends foo("s")<number> {\r
a: string | number;\r
let B = class extends foo("s")<number> {
a: string | number;
}`
});
@@ -20,7 +20,7 @@ verify.codeFix({
return C;
}
class B extends foo("s")<number> {\r
a: string | number;\r
class B extends foo("s")<number> {
a: string | number;
}`
});
@@ -42,13 +42,13 @@ verify.codeFix({
// Don't need to add anything in this case.
abstract class B extends A {}
class C extends A {\r
a: string | number;\r
b: this;\r
c: A;\r
d: string | number;\r
e: this;\r
f: A;\r
g: string;\r
class C extends A {
a: string | number;
b: this;
c: A;
d: string | number;
e: this;
f: A;
g: string;
}`
});
@@ -22,16 +22,16 @@ verify.codeFix({
abstract foo(): number;
}
class C extends A {\r
f(a: number, b: string): boolean;\r
f(a: number, b: string): this;\r
f(a: string, b: number): Function;\r
f(a: string): Function;\r
f(a: any, b?: any) {\r
throw new Error("Method not implemented.");\r
}\r
foo(): number {\r
throw new Error("Method not implemented.");\r
}\r
class C extends A {
f(a: number, b: string): boolean;
f(a: number, b: string): this;
f(a: string, b: number): Function;
f(a: string): Function;
f(a: any, b?: any) {
throw new Error("Method not implemented.");
}
foo(): number {
throw new Error("Method not implemented.");
}
}`
});
@@ -14,9 +14,9 @@ verify.codeFix({
abstract f(): this;
}
class C extends A {\r
f(): this {\r
throw new Error("Method not implemented.");\r
}\r
class C extends A {
f(): this {
throw new Error("Method not implemented.");
}
}`
});
@@ -14,9 +14,9 @@ verify.codeFix({
abstract f(x: T): T;
}
class C extends A<number> {\r
f(x: number): number {\r
throw new Error("Method not implemented.");\r
}\r
class C extends A<number> {
f(x: number): number {
throw new Error("Method not implemented.");
}
}`
});
@@ -14,9 +14,9 @@ verify.codeFix({
abstract f(x: T): T;
}
class C<U> extends A<U> {\r
f(x: U): U {\r
throw new Error("Method not implemented.");\r
}\r
class C<U> extends A<U> {
f(x: U): U {
throw new Error("Method not implemented.");
}
}`
});
@@ -8,19 +8,18 @@
verify.codeFixAll({
fixId: "fixClassDoesntImplementInheritedAbstractMember",
// TODO: GH#18445
newFileContent:
`abstract class A {
abstract m(): void;
}
class B extends A {\r
m(): void {\r
throw new Error("Method not implemented.");\r
}\r
class B extends A {
m(): void {
throw new Error("Method not implemented.");
}
}
class C extends A {\r
m(): void {\r
throw new Error("Method not implemented.");\r
}\r
class C extends A {
m(): void {
throw new Error("Method not implemented.");
}
}`,
});
@@ -18,9 +18,9 @@ verify.codeFix({
abstract z: A;
}
class C extends A {\r
x: number;\r
y: this;\r
z: A;\r
class C extends A {
x: number;
y: this;
z: A;
}`
});
@@ -8,13 +8,12 @@
verify.codeFix({
description: "Implement inherited abstract class",
// TODO: GH#18445
newFileContent:
`abstract class A {
abstract x: this;
}
class C extends A {\r
x: this;\r
class C extends A {
x: this;
}`,
});
@@ -8,13 +8,12 @@
verify.codeFix({
description: "Implement inherited abstract class",
// TODO: GH#18445
newFileContent:
`abstract class A {
protected abstract x: number;
}
class C extends A {\r
protected x: number;\r
class C extends A {
protected x: number;
}`,
});
@@ -8,13 +8,12 @@
verify.codeFix({
description: "Implement inherited abstract class",
// TODO: GH#18445
newFileContent:
`abstract class A {
public abstract x: number;
}
class C extends A {\r
public x: number;\r
class C extends A {
public x: number;
}`,
});
@@ -15,7 +15,6 @@
verify.codeFix({
description: "Implement interface 'A'",
// TODO: GH#18445
newFileContent:
`abstract class A {
private _a: string;
@@ -28,9 +27,9 @@ verify.codeFix({
abstract set c(arg: number | string);
}
class C implements A {\r
a: string;\r
b: number;\r
c: string | number;\r
class C implements A {
a: string;
b: number;
c: string | number;
}`,
});
@@ -8,15 +8,14 @@
verify.codeFix({
description: "Implement interface 'A'",
// TODO: GH#18445
newFileContent:
`class A {
f() {}
}
class B implements A {\r
f(): void {\r
throw new Error("Method not implemented.");\r
}\r
class B implements A {
f(): void {
throw new Error("Method not implemented.");
}
}`,
});
@@ -8,16 +8,15 @@
verify.codeFix({
description: "Implement interface 'A'",
// TODO: GH#18445
newFileContent:
`class A {
method(a: number, b: string): boolean;
method(a: string | number, b?: string | number): boolean | Function { return true; }
}
class C implements A {\r
method(a: number, b: string): boolean;\r
method(a: string | number, b?: string | number): boolean | Function {\r
throw new Error("Method not implemented.");\r
}\r
class C implements A {
method(a: number, b: string): boolean;
method(a: string | number, b?: string | number): boolean | Function {
throw new Error("Method not implemented.");
}
}`,
});
@@ -10,7 +10,6 @@
verify.codeFix({
description: "Implement interface 'A'",
// TODO: GH#18445
newFileContent:
`class A {
method(a: any, b: string): boolean;
@@ -18,12 +17,12 @@ verify.codeFix({
method(a: string): Function;
method(a: string | number, b?: string | number): boolean | Function { return true; }
}
class C implements A {\r
method(a: any, b: string): boolean;\r
method(a: string, b: number): Function;\r
method(a: string): Function;\r
method(a: string | number, b?: string | number): boolean | Function {\r
throw new Error("Method not implemented.");\r
}\r
class C implements A {
method(a: any, b: string): boolean;
method(a: string, b: number): Function;
method(a: string): Function;
method(a: string | number, b?: string | number): boolean | Function {
throw new Error("Method not implemented.");
}
}`,
});
@@ -11,7 +11,6 @@
verify.codeFix({
description: "Implement interface 'A'",
// TODO: GH#18445
newFileContent:
`abstract class A {
abstract x: number;
@@ -20,9 +19,9 @@ verify.codeFix({
public w: number;
}
class C implements A {\r
x: number;\r
protected z: number;\r
public w: number;\r
class C implements A {
x: number;
protected z: number;
public w: number;
}`,
});
@@ -7,12 +7,11 @@
verify.codeFix({
description: "Implement interface 'A'",
// TODO: GH#18445
newFileContent:
`class A {
A: typeof A;
}
class D implements A {\r
A: typeof A;\r
class D implements A {
A: typeof A;
}`,
});
@@ -50,7 +50,6 @@
verify.codeFix({
description: "Implement interface 'I6'",
// TODO: GH#18445
newFileContent:
`// Referenced throughout the inheritance chain.
interface I0 { a: number }
@@ -75,12 +74,12 @@ class C4 extends C3 implements I0, I4, I5 {
}
interface I6 extends C4 {}
class C5 implements I6 {\r
e: number;\r
f: number;\r
a: number;\r
b: number;\r
d: number;\r
c: number;\r
class C5 implements I6 {
e: number;
f: number;
a: number;
b: number;
d: number;
c: number;
}`,
});
@@ -5,10 +5,9 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I { x: number; }
export default class implements I {\r
x: number;\r
export default class implements I {
x: number;
}`,
});
@@ -10,7 +10,6 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I {
x: number[];
@@ -18,9 +17,9 @@ verify.codeFix({
z: [number, string, I];
}
class C implements I {\r
x: number[];\r
y: number[];\r
z: [number, string, I];\r
class C implements I {
x: number[];
y: number[];
z: [number, string, I];
}`,
});
@@ -6,10 +6,9 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I { x: number; }
new class implements I {\r
x: number;\r
new class implements I {
x: number;
};`,
});
@@ -20,7 +20,6 @@
verify.codeFix({
description: "Implement interface 'N.I'",
// TODO: GH#18445
newFileContent:
`namespace N {
/**enum prefix */
@@ -36,11 +35,11 @@ verify.codeFix({
/**method signature prefix */foo /**open angle prefix */< /**type parameter name prefix */ X /** closing angle prefix */> /**open paren prefix */(/** parameter prefix */ a/** colon prefix */: /** parameter type prefix */ X /** close paren prefix */) /** colon prefix */: /** return type prefix */ string /** semicolon prefix */;
/**close-brace prefix*/ }
/**close-brace prefix*/ }
class C implements N.I {\r
/** property prefix */ a /** colon prefix */: N.E.a;\r
/** property prefix */ b /** colon prefix */: N.E;\r
/**method signature prefix */ foo /**open angle prefix */<X>(a: X): string {\r
throw new Error("Method not implemented.");\r
}\r
class C implements N.I {
/** property prefix */ a /** colon prefix */: N.E.a;
/** property prefix */ b /** colon prefix */: N.E;
/**method signature prefix */ foo /**open angle prefix */<X>(a: X): string {
throw new Error("Method not implemented.");
}
}`,
});
@@ -11,7 +11,6 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I {
["foo"](o: any): boolean;
@@ -20,14 +19,14 @@ verify.codeFix({
[2]: boolean;
}
class C implements I {\r
["foo"](o: any): boolean {\r
throw new Error("Method not implemented.");\r
}\r
["x"]: boolean;\r
[1](): string {\r
throw new Error("Method not implemented.");\r
}\r
[2]: boolean;\r
class C implements I {
["foo"](o: any): boolean {
throw new Error("Method not implemented.");
}
["x"]: boolean;
[1](): string {
throw new Error("Method not implemented.");
}
[2]: boolean;
}`,
});
@@ -21,7 +21,6 @@
verify.codeFix({
description: "Implement interface 'I<number>'",
// TODO: GH#18445
newFileContent:
`interface I<Species> {
[Symbol.hasInstance](o: any): boolean;
@@ -38,34 +37,34 @@ verify.codeFix({
[Symbol.toStringTag]: string;
[Symbol.unscopables]: any;
}
class C implements I<number> {\r
[Symbol.hasInstance](o: any): boolean {\r
throw new Error("Method not implemented.");\r
}\r
[Symbol.isConcatSpreadable]: boolean;\r
[Symbol.iterator]() {\r
throw new Error("Method not implemented.");\r
}\r
[Symbol.match]: boolean;\r
[Symbol.replace](...args: {}) {\r
throw new Error("Method not implemented.");\r
}\r
[Symbol.search](str: string): number {\r
throw new Error("Method not implemented.");\r
}\r
[Symbol.species](): number {\r
throw new Error("Method not implemented.");\r
}\r
[Symbol.split](str: string, limit?: number): {} {\r
throw new Error("Method not implemented.");\r
}\r
[Symbol.toPrimitive](hint: "number"): number;\r
[Symbol.toPrimitive](hint: "default"): number;\r
[Symbol.toPrimitive](hint: "string"): string;\r
[Symbol.toPrimitive](hint: any) {\r
throw new Error("Method not implemented.");\r
}\r
[Symbol.toStringTag]: string\;\r
[Symbol.unscopables]: any;\r
class C implements I<number> {
[Symbol.hasInstance](o: any): boolean {
throw new Error("Method not implemented.");
}
[Symbol.isConcatSpreadable]: boolean;
[Symbol.iterator]() {
throw new Error("Method not implemented.");
}
[Symbol.match]: boolean;
[Symbol.replace](...args: {}) {
throw new Error("Method not implemented.");
}
[Symbol.search](str: string): number {
throw new Error("Method not implemented.");
}
[Symbol.species](): number {
throw new Error("Method not implemented.");
}
[Symbol.split](str: string, limit?: number): {} {
throw new Error("Method not implemented.");
}
[Symbol.toPrimitive](hint: "number"): number;
[Symbol.toPrimitive](hint: "default"): number;
[Symbol.toPrimitive](hint: "string"): string;
[Symbol.toPrimitive](hint: any) {
throw new Error("Method not implemented.");
}
[Symbol.toStringTag]: string\;
[Symbol.unscopables]: any;
}`,
});
@@ -13,7 +13,6 @@
verify.codeFix({
description: "Implement interface 'N1.I1'",
// TODO: GH#18445
newFileContent:
`namespace N1 {
export interface I1 {
@@ -24,9 +23,9 @@ interface I1 {
f1();
}
class C1 implements N1.I1 {\r
f1(): string {\r
throw new Error("Method not implemented.");\r
}\r
class C1 implements N1.I1 {
f1(): string {
throw new Error("Method not implemented.");
}
}`,
});
@@ -10,15 +10,14 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I {
[x: number]: I;
[y: string]: I;
}
class C implements I {\r
[x: number]: I;\r
[y: string]: I;\r
class C implements I {
[x: number]: I;
[y: string]: I;
}`,
});
@@ -7,12 +7,11 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I {
[x: number]: I;
}
class C implements I {\r
[x: number]: I;\r
class C implements I {
[x: number]: I;
}`,
});
@@ -8,13 +8,12 @@
verify.codeFix({
description: "Implement interface 'I<number>'",
// TODO: GH#18445
newFileContent:
`interface I<X> {
[Ƚ: string]: X;
}
class C implements I<number> {\r
[Ƚ: string]: number;\r
class C implements I<number> {
[Ƚ: string]: number;
}`,
});
@@ -7,12 +7,11 @@
verify.codeFix({
description: "Implement interface 'I<Y>'",
// TODO: GH#18445
newFileContent:
`interface I<X> {
x: keyof X;
}
class C<Y> implements I<Y> {\r
x: keyof Y;\r
class C<Y> implements I<Y> {
x: keyof Y;
}`,
});
@@ -9,16 +9,15 @@
verify.codeFix({
description: "Implement interface 'I1'",
// TODO: GH#18445
newFileContent:
`abstract class C1 { }
abstract class C2 {
abstract f<T extends number>();
}
interface I1 extends C1, C2 { }
class C3 implements I1 {\r
f<T extends number>() {\r
throw new Error("Method not implemented.");\r
}\r
class C3 implements I1 {
f<T extends number>() {
throw new Error("Method not implemented.");
}
}`,
});
@@ -7,12 +7,11 @@
verify.codeFix({
description: "Implement interface 'I<Y>'",
// TODO: GH#18445
newFileContent:
`interface I<X> {
x: { readonly [K in keyof X]: X[K] };
}
class C<Y> implements I<Y> {\r
x: { readonly [K in keyof Y]: Y[K]; };\r
class C<Y> implements I<Y> {
x: { readonly [K in keyof Y]: Y[K]; };
}`,
});
@@ -9,17 +9,16 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`type Either<T> = { val: T } | Error;
interface I {
x: Either<Either<string>>;
foo(x: Either<Either<string>>): void;
}
class C implements I {\r
x: Either<Either<string>>;\r
foo(x: Either<Either<string>>): void {\r
throw new Error("Method not implemented.");\r
}\r
class C implements I {
x: Either<Either<string>>;
foo(x: Either<Either<string>>): void {
throw new Error("Method not implemented.");
}
}`,
});
@@ -33,7 +33,6 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`/** asdf */
interface I {
@@ -62,30 +61,30 @@ interface I {
/** a nice safe prime */
23;
}
class C implements I {\r
1: any;\r
2: any;\r
3: any;\r
4: any;\r
5: any;\r
6: any;\r
7: any;\r
8: any;\r
9: any;\r
10: any;\r
11: any;\r
12: any;\r
13: any;\r
14: any;\r
15: any;\r
16: any;\r
17: any;\r
18: any;\r
19: any;\r
20: any;\r
21: any;\r
22: any;\r
/** a nice safe prime */\r
23: any;\r
class C implements I {
1: any;
2: any;
3: any;
4: any;
5: any;
6: any;
7: any;
8: any;
9: any;
10: any;
11: any;
12: any;
13: any;
14: any;
15: any;
16: any;
17: any;
18: any;
19: any;
20: any;
21: any;
22: any;
/** a nice safe prime */
23: any;
}`,
});
@@ -6,14 +6,13 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`type MyType = [string, number];
interface I { x: MyType; test(a: MyType): void; }
class C implements I {\r
x: [string, number];\r
test(a: [string, number]): void {\r
throw new Error("Method not implemented.");\r
}\r
class C implements I {
x: [string, number];
test(a: [string, number]): void {
throw new Error("Method not implemented.");
}
}`,
});
@@ -8,15 +8,14 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I {
f(x: number, y: this): I
}
class C implements I {\r
f(x: number, y: this): I {\r
throw new Error("Method not implemented.");\r
}\r
class C implements I {
f(x: number, y: this): I {
throw new Error("Method not implemented.");
}
}`,
});
@@ -9,18 +9,17 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I {
f(i: any): i is I;
f(): this is I;
}
class C implements I {\r
f(i: any): i is I;\r
f(): this is I;\r
f(i?: any) {\r
throw new Error("Method not implemented.");\r
}\r
class C implements I {
f(i: any): i is I;
f(): this is I;
f(i?: any) {
throw new Error("Method not implemented.");
}
}`,
});
@@ -13,7 +13,6 @@
verify.codeFix({
description: "Implement interface 'I1'",
// TODO: GH#18445
newFileContent:
`interface I1 {
x: number,
@@ -24,18 +23,18 @@ verify.codeFix({
h();
}
class C1 implements I1 {\r
x: number;\r
y: number;\r
z: number;\r
f() {\r
throw new Error("Method not implemented.");\r
}\r
g() {\r
throw new Error("Method not implemented.");\r
}\r
h() {\r
throw new Error("Method not implemented.");\r
}\r
class C1 implements I1 {
x: number;
y: number;
z: number;
f() {
throw new Error("Method not implemented.");
}
g() {
throw new Error("Method not implemented.");
}
h() {
throw new Error("Method not implemented.");
}
}`,
});
@@ -10,7 +10,6 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I {
method(a: number, b: string): boolean;
@@ -18,12 +17,12 @@ verify.codeFix({
method(a: string): Function;
}
class C implements I {\r
method(a: number, b: string): boolean;\r
method(a: string, b: number): Function;\r
method(a: string): Function;\r
method(a: any, b?: any) {\r
throw new Error("Method not implemented.");\r
}\r
class C implements I {
method(a: number, b: string): boolean;
method(a: string, b: number): Function;
method(a: string): Function;
method(a: any, b?: any) {
throw new Error("Method not implemented.");
}
}`,
});
@@ -10,7 +10,6 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I {
method(a: number, ...b: string[]): boolean;
@@ -18,12 +17,12 @@ verify.codeFix({
method(a: string): Function;
}
class C implements I {\r
method(a: number, ...b: string[]): boolean;\r
method(a: string, ...b: number[]): Function;\r
method(a: string): Function;\r
method(a: any, ...b?: any[]) {\r
throw new Error("Method not implemented.");\r
}\r
class C implements I {
method(a: number, ...b: string[]): boolean;
method(a: string, ...b: number[]): Function;
method(a: string): Function;
method(a: any, ...b?: any[]) {
throw new Error("Method not implemented.");
}
}`,
});
@@ -10,7 +10,6 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I {
method(a: number, ...b: string[]): boolean;
@@ -18,12 +17,12 @@ verify.codeFix({
method(a: string): Function;
}
class C implements I {\r
method(a: number, ...b: string[]): boolean;\r
method(a: string, b: number): Function;\r
method(a: string): Function;\r
method(a: any, b?: any, ...rest?: any[]) {\r
throw new Error("Method not implemented.");\r
}\r
class C implements I {
method(a: number, ...b: string[]): boolean;
method(a: string, b: number): Function;
method(a: string): Function;
method(a: any, b?: any, ...rest?: any[]) {
throw new Error("Method not implemented.");
}
}`,
});
@@ -10,7 +10,6 @@
verify.codeFix({
description: "Implement interface 'N1.I1'",
// TODO: GH#18445
newFileContent:
`namespace N1 {
export interface I1 { x: number; }
@@ -18,7 +17,7 @@ verify.codeFix({
interface I1 {
f1();
}
class C1 implements N1.I1 {\r
x: number;\r
class C1 implements N1.I1 {
x: number;
}`,
});
@@ -8,14 +8,13 @@
verify.codeFix({
description: "Implement interface 'IPerson'",
// TODO: GH#18445
newFileContent:
`interface IPerson {
name: string;
birthday?: string;
}
class Person implements IPerson {\r
name: string;\r
birthday?: string;\r
class Person implements IPerson {
name: string;
birthday?: string;
}`,
});
@@ -13,7 +13,6 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`enum E { a,b,c }
interface I {
@@ -22,10 +21,10 @@ interface I {
z: symbol;
w: object;
}
class C implements I {\r
x: E;\r
y: E.a;\r
z: symbol;\r
w: object;\r
class C implements I {
x: E;
y: E.a;
z: symbol;
w: object;
}`,
});
@@ -21,7 +21,6 @@
verify.codeFix({
description: "Implement interface 'I'",
// TODO: GH#18445
newFileContent:
`interface I {
a0: {};
@@ -40,17 +39,17 @@ verify.codeFix({
a9: { (b9: number, c9: string): number; [d9: number]: I };
a10: { (b10: number, c10: string): number; [d10: string]: I };
}
class C implements I {\r
a0: {};\r
a1: (b1: number, c1: string) => number;\r
a2: (b2: number, c2: string) => number;\r
a3: { (b3: number, c3: string): number; x: number; };\r
a4: new (b1: number, c1: string) => number;\r
a5: new (b2: number, c2: string) => number;\r
a6: { new(b3: number, c3: string): number; x: number; };\r
a7: { foo(b7: number, c7: string): number; };\r
a8: { (b81: number, c81: string): number; new(b82: number, c82: string): number; };\r
a9: { (b9: number, c9: string): number;[d9: number]: I; };\r
a10: { (b10: number, c10: string): number;[d10: string]: I; };\r
class C implements I {
a0: {};
a1: (b1: number, c1: string) => number;
a2: (b2: number, c2: string) => number;
a3: { (b3: number, c3: string): number; x: number; };
a4: new (b1: number, c1: string) => number;
a5: new (b2: number, c2: string) => number;
a6: { new(b3: number, c3: string): number; x: number; };
a7: { foo(b7: number, c7: string): number; };
a8: { (b81: number, c81: string): number; new(b82: number, c82: string): number; };
a9: { (b9: number, c9: string): number;[d9: number]: I; };
a10: { (b10: number, c10: string): number;[d10: string]: I; };
}`,
});
@@ -7,12 +7,11 @@
verify.codeFix({
description: "Implement interface 'N.I'",
// TODO: GH#18445
newFileContent:
`namespace N {
export interface I { y: I; }
}
class C1 implements N.I {\r
y: N.I;\r
class C1 implements N.I {
y: N.I;
}`,
});
@@ -7,12 +7,11 @@
verify.codeFix({
description: "Implement interface 'I<number>'",
// TODO: GH#18445
newFileContent:
`interface I<T> {
x: { y: T, z: T[] };
}
class C implements I<number> {\r
x: { y: number; z: number[]; };\r
class C implements I<number> {
x: { y: number; z: number[]; };
}`,
});
@@ -5,10 +5,9 @@
verify.codeFix({
description: "Implement interface 'I<number>'",
// TODO: GH#18445
newFileContent:
`interface I<T> { x: T; }
class C implements I<number> {\r
x: number;\r
class C implements I<number> {
x: number;
}`
});
@@ -5,10 +5,9 @@
verify.codeFix({
description: "Implement interface 'I<T>'",
// TODO: GH#18445
newFileContent:
`interface I<T> { x: T; }
class C<T> implements I<T> {\r
x: T;\r
class C<T> implements I<T> {
x: T;
}`
});
@@ -5,10 +5,9 @@
verify.codeFix({
description: "Implement interface 'I<U>'",
// TODO: GH#18445
newFileContent:
`interface I<T> { x: T; }
class C<U> implements I<U> {\r
x: U;\r
class C<U> implements I<U> {
x: U;
}`
});
@@ -8,13 +8,12 @@
verify.codeFix({
description: "Implement interface 'I'",
newFileContent:
// TODO: GH#18445
`interface I {
f<T extends number>(x: T);
}
class C implements I {\r
f<T extends number>(x: T) {\r
throw new Error("Method not implemented.");\r
}\r
class C implements I {
f<T extends number>(x: T) {
throw new Error("Method not implemented.");
}
}`,
});
@@ -7,21 +7,21 @@
verify.codeFixAll({
fixId: "fixClassIncorrectlyImplementsInterface",
// TODO: GH#20073 GH#18445
// TODO: GH#20073
newFileContent:
`interface I { i(): void; }
interface J { j(): void; }
class C implements I, J {\r
i(): void {\r
throw new Error("Method not implemented.");\r
}\r
j(): void {\r
throw new Error("Method not implemented.");\r
}\r
class C implements I, J {
i(): void {
throw new Error("Method not implemented.");
}
j(): void {
throw new Error("Method not implemented.");
}
}
class D implements J {\r
j(): void {\r
throw new Error("Method not implemented.");\r
}\r
class D implements J {
j(): void {
throw new Error("Method not implemented.");
}
}`,
});
@@ -9,8 +9,7 @@
//// super();
//// |]}
////}
// TODO: GH#18445
verify.rangeAfterCodeFix(`
super();\r
super();
this.a = 12;
`, /*includeWhiteSpace*/ true);
@@ -18,14 +18,14 @@ verify.codeFixAll({
fixId: "classSuperMustPrecedeThisAccess",
newFileContent: `class C extends Object {
constructor() {
super();\r
super();
this;
this;
}
}
class D extends Object {
constructor() {
super();\r
super();
this;
}
}`,
@@ -8,13 +8,12 @@
verify.codeFix({
description: "Add missing 'super()' call",
// TODO: GH#18445
newFileContent:
`class Base{
}
class C extends Base{
constructor() {\r
super();\r
constructor() {
super();
}
}`,
});
@@ -9,15 +9,14 @@
verify.codeFixAll({
fixId: "constructorForDerivedNeedSuperCall",
// TODO: GH#18445
newFileContent: `class C extends Object {
constructor() {\r
super();\r
constructor() {
super();
}
}
class D extends Object {
constructor() {\r
super();\r
constructor() {
super();
}
}`,
});
@@ -13,8 +13,8 @@ verify.codeFixAll({
fixId: "disableJsDiagnostics",
newFileContent:
`let x = "";
// @ts-ignore\r
// @ts-ignore
x = 1;
// @ts-ignore\r
// @ts-ignore
x = true;`,
});
@@ -12,11 +12,10 @@
verify.codeFix({
description: "Declare static method 'm1'",
index: 0,
// TODO: GH#18445
newRangeContent: `
static m1(arg0: any, arg1: any, arg2: any): any {\r
throw new Error("Method not implemented.");\r
}\r
static m1(arg0: any, arg1: any, arg2: any): any {
throw new Error("Method not implemented.");
}
`,
});
@@ -24,12 +23,12 @@ verify.codeFix({
description: "Declare static method 'm2'",
index: 0,
newRangeContent: `
static m2(arg0: any, arg1: any): any {\r
throw new Error("Method not implemented.");\r
}\r
static m1(arg0: any, arg1: any, arg2: any): any {\r
throw new Error("Method not implemented.");\r
}\r
static m2(arg0: any, arg1: any): any {
throw new Error("Method not implemented.");
}
static m1(arg0: any, arg1: any, arg2: any): any {
throw new Error("Method not implemented.");
}
`,
});
@@ -37,13 +36,13 @@ verify.codeFix({
description: "Declare static property 'prop1'",
index: 0,
newRangeContent: `
static prop1: number;\r
static m2(arg0: any, arg1: any): any {\r
throw new Error("Method not implemented.");\r
}\r
static m1(arg0: any, arg1: any, arg2: any): any {\r
throw new Error("Method not implemented.");\r
}\r
static prop1: number;
static m2(arg0: any, arg1: any): any {
throw new Error("Method not implemented.");
}
static m1(arg0: any, arg1: any, arg2: any): any {
throw new Error("Method not implemented.");
}
`,
});
@@ -51,13 +50,13 @@ verify.codeFix({
description: "Declare static property 'prop2'",
index: 0,
newRangeContent: `
static prop2: string;\r
static prop1: number;\r
static m2(arg0: any, arg1: any): any {\r
throw new Error("Method not implemented.");\r
}\r
static m1(arg0: any, arg1: any, arg2: any): any {\r
throw new Error("Method not implemented.");\r
}\r
static prop2: string;
static prop1: number;
static m2(arg0: any, arg1: any): any {
throw new Error("Method not implemented.");
}
static m1(arg0: any, arg1: any, arg2: any): any {
throw new Error("Method not implemented.");
}
`,
});
@@ -13,11 +13,10 @@
verify.codeFix({
description: "Declare method 'foo1'",
index: 0,
// TODO: GH#18445
newRangeContent: `
foo1(arg0: any, arg1: any, arg2: any): any {\r
throw new Error("Method not implemented.");\r
}\r
foo1(arg0: any, arg1: any, arg2: any): any {
throw new Error("Method not implemented.");
}
`,
});
@@ -25,12 +24,12 @@ verify.codeFix({
description: "Declare method 'foo2'",
index: 0,
newRangeContent: `
foo2<T, U, V, W, X, Y, Z>(): any {\r
throw new Error("Method not implemented.");\r
}\r
foo1(arg0: any, arg1: any, arg2: any): any {\r
throw new Error("Method not implemented.");\r
}\r
foo2<T, U, V, W, X, Y, Z>(): any {
throw new Error("Method not implemented.");
}
foo1(arg0: any, arg1: any, arg2: any): any {
throw new Error("Method not implemented.");
}
`
});
@@ -38,14 +37,14 @@ verify.codeFix({
description: "Declare method 'foo3'",
index: 0,
newRangeContent:`
foo3<T0, T1, T2, T3, T4, T5, T6, T7>(): any {\r
throw new Error("Method not implemented.");\r
}\r
foo2<T, U, V, W, X, Y, Z>(): any {\r
throw new Error("Method not implemented.");\r
}\r
foo1(arg0: any, arg1: any, arg2: any): any {\r
throw new Error("Method not implemented.");\r
}\r
foo3<T0, T1, T2, T3, T4, T5, T6, T7>(): any {
throw new Error("Method not implemented.");
}
foo2<T, U, V, W, X, Y, Z>(): any {
throw new Error("Method not implemented.");
}
foo1(arg0: any, arg1: any, arg2: any): any {
throw new Error("Method not implemented.");
}
`
});
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts'/>
////Harness.newLine = "\r"\n/**/
////Harness.newLine = ""\n/**/
goTo.marker();
verify.not.completionListIsEmpty();
@@ -17,8 +17,7 @@ verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/a",
description: `Import 'foo' from module "./a"`,
// TODO: GH#18445
newFileContent: `import f_o_o from "./a";
import foo from "./a";\r
import foo from "./a";
f;`,
});
@@ -22,9 +22,8 @@ verify.applyCodeActionFromCompletion("1", {
name: "fooBar",
source: "/src/foo-bar",
description: `Import 'fooBar' from module "./foo-bar"`,
// TODO: GH#18445
newFileContent: `import fooBar from "./foo-bar";\r
\r
newFileContent: `import fooBar from "./foo-bar";
def
fooB`,
});
@@ -18,8 +18,7 @@ verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/a",
description: `Import 'foo' from module "./a"`,
// TODO: GH#18445
newFileContent: `import foo from "./a";\r
\r
newFileContent: `import foo from "./a";
f;`,
});
@@ -19,8 +19,7 @@ verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/a",
description: `Import 'foo' from module "./a"`,
// TODO: GH#18445
newFileContent: `import foo from "./a";\r
\r
newFileContent: `import foo from "./a";
f;`,
});
@@ -12,8 +12,7 @@ verify.applyCodeActionFromCompletion("", {
name: "x",
source: "m",
description: `Import 'x' from module "m"`,
// TODO: GH#18445
newFileContent: `import { x } from "m";\r
\r
newFileContent: `import { x } from "m";
`,
});
@@ -23,8 +23,7 @@ verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/b",
description: `Import 'foo' from module "./b"`,
// TODO: GH#18445
newFileContent: `import { foo } from "./b";\r
\r
newFileContent: `import { foo } from "./b";
fo`,
});
@@ -19,8 +19,7 @@ verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/a",
description: `Import 'foo' from module "./a"`,
// TODO: GH#18445
newFileContent: `import { foo } from "./a";\r
\r
newFileContent: `import { foo } from "./a";
f;`,
});
@@ -17,7 +17,6 @@ verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/a",
description: `Change 'foo' to 'a.foo'`,
// TODO: GH#18445
newFileContent: `import * as a from "./a";
a.f;`,
});
@@ -29,8 +29,7 @@ verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/a",
description: `Import 'foo' from module "./a"`,
// TODO: GH#18445
newFileContent: `import { foo } from "./a";\r
\r
newFileContent: `import { foo } from "./a";
fo`,
});
@@ -24,8 +24,7 @@ verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/foo/lib/foo",
description: `Import 'foo' from module "./foo"`,
// TODO: GH#18445
newFileContent: `import { foo } from "./foo";\r
\r
newFileContent: `import { foo } from "./foo";
fo`,
});
@@ -23,9 +23,8 @@ verify.applyCodeActionFromCompletion("b", {
name: "foo",
source: "/a",
description: `Import 'foo' from module "./a"`,
// TODO: GH#18445
newFileContent: `import { foo } from "./a";\r
\r
newFileContent: `import { foo } from "./a";
const a = require("./a");
fo`,
});
@@ -40,9 +39,8 @@ verify.applyCodeActionFromCompletion("c", {
name: "foo",
source: "/a",
description: `Import 'foo' from module "./a"`,
// TODO: GH#18445
newFileContent: `import { foo } from "./a";\r
\r
newFileContent: `import { foo } from "./a";
const a = import("./a");
fo`,
});
@@ -15,7 +15,7 @@
////});
goTo.marker("1");
edit.insert("\r\n");
edit.insert("\n");
goTo.marker("0");
// Won't-fixed: Smart indent during chained function calls
verify.indentationIs(4);
@@ -5,8 +5,8 @@
//// /*1*/
//// function foo(x: number, y: string): boolean {}
const noIndentScaffolding = "/**\r\n * \r\n * @param x\r\n * @param y\r\n */";
const oneIndentScaffolding = "/**\r\n * \r\n * @param x\r\n * @param y\r\n */";
const noIndentScaffolding = "/**\n * \n * @param x\n * @param y\n */";
const oneIndentScaffolding = "/**\n * \n * @param x\n * @param y\n */";
const noIndentOffset = 8;
const oneIndentOffset = noIndentOffset + 4;
@@ -15,6 +15,6 @@
verify.singleReferenceGroup("(property) A.foo: string");
goTo.marker("");
edit.insert("\r\n");
edit.insert("\n");
verify.singleReferenceGroup("(property) A.foo: string");
+1 -1
View File
@@ -3,6 +3,6 @@
////{}
goTo.eof();
edit.insert("\r\n");
edit.insert("\n");
goTo.bof();
verify.currentLineContentIs("{ }");
@@ -15,10 +15,10 @@
goTo.marker("1");
edit.insert("\r\n"); // edit will trigger formatting - should succeeed
edit.insert("\n"); // edit will trigger formatting - should succeeed
goTo.marker("2");
edit.insert("\r\n");
edit.insert("\n");
verify.indentationIs(0);
verify.currentLineContentIs("3`;")
@@ -5,7 +5,7 @@
/////*4*/ i -= 2
/////*5*/ }/*1*/while (1 !== 1)
goTo.marker("1");
edit.insert("\r\n");
edit.insert("\n");
verify.currentLineContentIs("while (1 !== 1)");
goTo.marker("2");
verify.currentLineContentIs("do {");

Some files were not shown because too many files have changed in this diff Show More