@@ -27,7 +27,7 @@ namespace ts.codefix {
27
27
fixId : undefined ,
28
28
} ] ;
29
29
30
- if ( isValidLocationToAddComment ( sourceFile , span . start ) ) {
30
+ if ( textChanges . isValidLocationToAddComment ( sourceFile , span . start ) ) {
31
31
fixes . unshift ( {
32
32
description : getLocaleSpecificMessage ( Diagnostics . Ignore_this_error_message ) ,
33
33
changes : textChanges . ChangeTracker . with ( context , t => makeChange ( t , sourceFile , span . start ) ) ,
@@ -41,17 +41,13 @@ namespace ts.codefix {
41
41
getAllCodeActions : context => {
42
42
const seenLines = createMap < true > ( ) ;
43
43
return codeFixAll ( context , errorCodes , ( changes , diag ) => {
44
- if ( isValidLocationToAddComment ( diag . file ! , diag . start ! ) ) {
44
+ if ( textChanges . isValidLocationToAddComment ( diag . file ! , diag . start ! ) ) {
45
45
makeChange ( changes , diag . file ! , diag . start ! , seenLines ) ;
46
46
}
47
47
} ) ;
48
48
} ,
49
49
} ) ;
50
50
51
- export function isValidLocationToAddComment ( sourceFile : SourceFile , position : number ) {
52
- return ! isInComment ( sourceFile , position ) && ! isInString ( sourceFile , position ) && ! isInTemplateString ( sourceFile , position ) ;
53
- }
54
-
55
51
function makeChange ( changes : textChanges . ChangeTracker , sourceFile : SourceFile , position : number , seenLines ?: Map < true > ) {
56
52
const { line : lineNumber } = getLineAndCharacterOfPosition ( sourceFile , position ) ;
57
53
// Only need to add `// @ts-ignore` for a line once.
0 commit comments