-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(39332): handle quotes preference in interface method signatures (#…
- Loading branch information
1 parent
4533652
commit 2a92a6e
Showing
12 changed files
with
161 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
tests/cases/fourslash/codeFixClassImplementInterface1_optionQuote.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
tests/cases/fourslash/codeFixClassImplementInterface_optionQuote.ts
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
tests/cases/fourslash/codeFixClassImplementInterface_quotePreferenceAuto1.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: a.ts | ||
////export interface I { | ||
//// a(): void; | ||
//// b(x: "x", y: "a" | "b"): "b"; | ||
//// | ||
//// c: "c"; | ||
//// d: { e: "e"; }; | ||
////} | ||
// @filename: b.ts | ||
////import { I } from "./a"; | ||
////class Foo implements I {} | ||
|
||
goTo.file("b.ts") | ||
verify.codeFix({ | ||
description: [ts.Diagnostics.Implement_interface_0.message, "I"], | ||
index: 0, | ||
newFileContent: | ||
`import { I } from "./a"; | ||
class Foo implements I { | ||
a(): void { | ||
throw new Error("Method not implemented."); | ||
} | ||
b(x: "x", y: "a" | "b"): "b" { | ||
throw new Error("Method not implemented."); | ||
} | ||
c: "c"; | ||
d: { e: "e"; }; | ||
}`, | ||
preferences: { quotePreference: "auto" } | ||
}); |
32 changes: 32 additions & 0 deletions
32
tests/cases/fourslash/codeFixClassImplementInterface_quotePreferenceAuto2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: a.ts | ||
////export interface I { | ||
//// a(): void; | ||
//// b(x: 'x', y: 'a' | 'b'): 'b'; | ||
//// | ||
//// c: 'c'; | ||
//// d: { e: 'e'; }; | ||
////} | ||
// @filename: b.ts | ||
////import { I } from './a'; | ||
////class Foo implements I {} | ||
|
||
goTo.file("b.ts") | ||
verify.codeFix({ | ||
description: [ts.Diagnostics.Implement_interface_0.message, "I"], | ||
index: 0, | ||
newFileContent: | ||
`import { I } from './a'; | ||
class Foo implements I { | ||
a(): void { | ||
throw new Error('Method not implemented.'); | ||
} | ||
b(x: 'x', y: 'a' | 'b'): 'b' { | ||
throw new Error('Method not implemented.'); | ||
} | ||
c: 'c'; | ||
d: { e: 'e'; }; | ||
}`, | ||
preferences: { quotePreference: "auto" } | ||
}); |
34 changes: 34 additions & 0 deletions
34
tests/cases/fourslash/codeFixClassImplementInterface_quotePreferenceDouble.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////interface I { | ||
//// a(): void; | ||
//// b(x: "x", y: "a" | "b"): "b"; | ||
//// | ||
//// c: "c"; | ||
//// d: { e: "e"; }; | ||
////} | ||
////class Foo implements I {} | ||
|
||
verify.codeFix({ | ||
description: [ts.Diagnostics.Implement_interface_0.message, "I"], | ||
index: 0, | ||
newFileContent: | ||
`interface I { | ||
a(): void; | ||
b(x: "x", y: "a" | "b"): "b"; | ||
c: "c"; | ||
d: { e: "e"; }; | ||
} | ||
class Foo implements I { | ||
a(): void { | ||
throw new Error("Method not implemented."); | ||
} | ||
b(x: "x", y: "a" | "b"): "b" { | ||
throw new Error("Method not implemented."); | ||
} | ||
c: "c"; | ||
d: { e: "e"; }; | ||
}`, | ||
preferences: { quotePreference: "double" } | ||
}); |
34 changes: 34 additions & 0 deletions
34
tests/cases/fourslash/codeFixClassImplementInterface_quotePreferenceSingle.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////interface I { | ||
//// a(): void; | ||
//// b(x: 'x', y: 'a' | 'b'): 'b'; | ||
//// | ||
//// c: 'c'; | ||
//// d: { e: 'e'; }; | ||
////} | ||
////class Foo implements I {} | ||
|
||
verify.codeFix({ | ||
description: [ts.Diagnostics.Implement_interface_0.message, "I"], | ||
index: 0, | ||
newFileContent: | ||
`interface I { | ||
a(): void; | ||
b(x: 'x', y: 'a' | 'b'): 'b'; | ||
c: 'c'; | ||
d: { e: 'e'; }; | ||
} | ||
class Foo implements I { | ||
a(): void { | ||
throw new Error('Method not implemented.'); | ||
} | ||
b(x: 'x', y: 'a' | 'b'): 'b' { | ||
throw new Error('Method not implemented.'); | ||
} | ||
c: 'c'; | ||
d: { e: 'e'; }; | ||
}`, | ||
preferences: { quotePreference: "single" } | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters