@@ -27,7 +27,7 @@ namespace ts.codefix {
2727 fixId : undefined ,
2828 } ] ;
2929
30- if ( isValidLocationToAddComment ( sourceFile , span . start ) ) {
30+ if ( textChanges . isValidLocationToAddComment ( sourceFile , span . start ) ) {
3131 fixes . unshift ( {
3232 description : getLocaleSpecificMessage ( Diagnostics . Ignore_this_error_message ) ,
3333 changes : textChanges . ChangeTracker . with ( context , t => makeChange ( t , sourceFile , span . start ) ) ,
@@ -41,17 +41,13 @@ namespace ts.codefix {
4141 getAllCodeActions : context => {
4242 const seenLines = createMap < true > ( ) ;
4343 return codeFixAll ( context , errorCodes , ( changes , diag ) => {
44- if ( isValidLocationToAddComment ( diag . file ! , diag . start ! ) ) {
44+ if ( textChanges . isValidLocationToAddComment ( diag . file ! , diag . start ! ) ) {
4545 makeChange ( changes , diag . file ! , diag . start ! , seenLines ) ;
4646 }
4747 } ) ;
4848 } ,
4949 } ) ;
5050
51- export function isValidLocationToAddComment ( sourceFile : SourceFile , position : number ) {
52- return ! isInComment ( sourceFile , position ) && ! isInString ( sourceFile , position ) && ! isInTemplateString ( sourceFile , position ) ;
53- }
54-
5551 function makeChange ( changes : textChanges . ChangeTracker , sourceFile : SourceFile , position : number , seenLines ?: Map < true > ) {
5652 const { line : lineNumber } = getLineAndCharacterOfPosition ( sourceFile , position ) ;
5753 // Only need to add `// @ts-ignore` for a line once.
0 commit comments