@@ -2150,32 +2150,23 @@ 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
2163
2157
- const checkedDiagnostics = ts . createMap < boolean > ( ) ;
2158
-
2159
- for ( const diagnostic of diagnostics ) {
2164
+ for ( const diagnostic of dedupedDiagnositcs ) {
2160
2165
2161
2166
if ( errorCode && errorCode !== diagnostic . code ) {
2162
2167
continue ;
2163
2168
}
2164
2169
2165
- const summary = JSON . stringify ( {
2166
- start : diagnostic . start ,
2167
- length : diagnostic . length ,
2168
- code : diagnostic . code
2169
- } ) ;
2170
-
2171
- if ( checkedDiagnostics . has ( summary ) ) {
2172
- // Don't want to ask for code fixes in an identical position for the same error code twice.
2173
- continue ;
2174
- }
2175
- else {
2176
- checkedDiagnostics . set ( summary , true ) ;
2177
- }
2178
-
2179
2170
const newActions = this . languageService . getCodeFixesAtPosition ( fileName , diagnostic . start , diagnostic . length , [ diagnostic . code ] ) ;
2180
2171
if ( newActions && newActions . length ) {
2181
2172
actions = actions ? actions . concat ( newActions ) : newActions ;
0 commit comments