@@ -2150,32 +2150,23 @@ namespace FourSlash {
21502150 * @param fileName Path to file where error should be retrieved from.
21512151 */
21522152 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 ) ;
21542161
21552162 let actions : ts . CodeAction [ ] = undefined ;
21562163
2157- const checkedDiagnostics = ts . createMap < boolean > ( ) ;
2158-
2159- for ( const diagnostic of diagnostics ) {
2164+ for ( const diagnostic of dedupedDiagnositcs ) {
21602165
21612166 if ( errorCode && errorCode !== diagnostic . code ) {
21622167 continue ;
21632168 }
21642169
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-
21792170 const newActions = this . languageService . getCodeFixesAtPosition ( fileName , diagnostic . start , diagnostic . length , [ diagnostic . code ] ) ;
21802171 if ( newActions && newActions . length ) {
21812172 actions = actions ? actions . concat ( newActions ) : newActions ;
0 commit comments