File tree 3 files changed +16
-4
lines changed 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -2150,10 +2150,18 @@ namespace FourSlash {
2150
2150
* @param fileName Path to file where error should be retrieved from.
2151
2151
*/
2152
2152
private getCodeFixActions ( fileName : string , errorCode ?: number ) : ts . CodeAction [ ] {
2153
- const diagnostics : ts . Diagnostic [ ] = this . getDiagnostics ( fileName ) ;
2153
+ const diagnosticsForCodeFix = this . getDiagnostics ( fileName ) . map ( diagnostic => {
2154
+ return {
2155
+ start : diagnostic . start ,
2156
+ length : diagnostic . length ,
2157
+ code : diagnostic . code
2158
+ }
2159
+ } ) ;
2160
+ const dedupedDiagnositcs = ts . deduplicate ( diagnosticsForCodeFix , ts . equalOwnProperties ) ;
2154
2161
2155
2162
let actions : ts . CodeAction [ ] = undefined ;
2156
- for ( const diagnostic of diagnostics ) {
2163
+
2164
+ for ( const diagnostic of dedupedDiagnositcs ) {
2157
2165
2158
2166
if ( errorCode && errorCode !== diagnostic . code ) {
2159
2167
continue ;
Original file line number Diff line number Diff line change @@ -1688,7 +1688,7 @@ namespace ts {
1688
1688
1689
1689
let allFixes : CodeAction [ ] = [ ] ;
1690
1690
1691
- forEach ( errorCodes , error => {
1691
+ forEach ( deduplicate ( errorCodes ) , error => {
1692
1692
cancellationToken . throwIfCancellationRequested ( ) ;
1693
1693
1694
1694
const context = {
Original file line number Diff line number Diff line change 2
2
3
3
//// abstract class A {
4
4
//// abstract x: number;
5
+ //// abstract foo(): number;
5
6
//// }
6
7
////
7
8
//// class C extends A {[|
8
9
//// |] }
9
10
10
11
verify . rangeAfterCodeFix ( `
11
- x: number;
12
+ x: number;
13
+ foo(): number {
14
+ throw new Error('Method not implemented.');
15
+ }
12
16
` ) ;
You can’t perform that action at this time.
0 commit comments