Fix 'import a = A' case
This commit is contained in:
parent
1f94e14d84
commit
409787495e
3 changed files with 6 additions and 3 deletions
|
@ -91,8 +91,11 @@ namespace ts.codefix {
|
||||||
return removeSingleItem(elements, token);
|
return removeSingleItem(elements, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle case where 'import a = A;'
|
||||||
|
// remove entire line
|
||||||
case SyntaxKind.ImportEqualsDeclaration:
|
case SyntaxKind.ImportEqualsDeclaration:
|
||||||
return createCodeFix("{}", token.pos, token.end - token.pos);
|
const importDecl = token.parent;
|
||||||
|
return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
|
||||||
|
|
||||||
case SyntaxKind.EnumDeclaration:
|
case SyntaxKind.EnumDeclaration:
|
||||||
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
|
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
//// [|import a = A;|]
|
//// [|import a = A;|]
|
||||||
//// }
|
//// }
|
||||||
|
|
||||||
verify.codeFixAtPosition(" import {} = A;");
|
verify.codeFixAtPosition("");
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,4 @@
|
||||||
////
|
////
|
||||||
//// }
|
//// }
|
||||||
|
|
||||||
verify.codeFixAtPosition("import {} = require('./file1')");
|
verify.codeFixAtPosition("");
|
Loading…
Reference in a new issue