File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
extensions/typescript-language-features Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { TelemetryReporter } from '../utils/telemetry';
17
17
import * as typeConverters from '../utils/typeConverters' ;
18
18
import { DiagnosticsManager } from './diagnostics' ;
19
19
import FileConfigurationManager from './fileConfigurationManager' ;
20
+ import { equals } from '../utils/objects' ;
20
21
21
22
const localize = nls . loadMessageBundle ( ) ;
22
23
@@ -147,6 +148,11 @@ class CodeActionSet {
147
148
}
148
149
149
150
public addAction ( action : VsCodeCodeAction ) {
151
+ for ( const existing of this . _actions ) {
152
+ if ( action . tsAction . fixName === existing . tsAction . fixName && equals ( action . edit , existing . edit ) ) {
153
+ this . _actions . delete ( existing ) ;
154
+ }
155
+ }
150
156
this . _actions . add ( action ) ;
151
157
}
152
158
Original file line number Diff line number Diff line change @@ -87,6 +87,23 @@ suite('TypeScript Quick Fix', () => {
87
87
`foo;`
88
88
) ) ;
89
89
} ) ;
90
+
91
+ test ( 'Only a single ts-ignore should be returned if there are multiple errors on one line #98274' , async ( ) => {
92
+ const testDocumentUri = workspaceFile ( 'foojs.js' ) ;
93
+ const editor = await createTestEditor ( testDocumentUri ,
94
+ `//@ts-check` ,
95
+ `const a = require('./bla');` ) ;
96
+
97
+ await wait ( 3000 ) ;
98
+
99
+ const fixes = await vscode . commands . executeCommand < vscode . CodeAction [ ] > ( 'vscode.executeCodeActionProvider' ,
100
+ testDocumentUri ,
101
+ editor . document . lineAt ( 1 ) . range
102
+ ) ;
103
+
104
+ const ignoreFixes = fixes ?. filter ( x => x . title === 'Ignore this error message' ) ;
105
+ assert . strictEqual ( ignoreFixes ?. length , 1 ) ;
106
+ } ) ;
90
107
} ) ;
91
108
92
109
You can’t perform that action at this time.
0 commit comments