@@ -131,7 +131,6 @@ namespace ts.codefix {
131
131
// this is a module id -> module import declaration map
132
132
const cachedImportDeclarations : ( ImportDeclaration | ImportEqualsDeclaration ) [ ] [ ] = [ ] ;
133
133
let lastImportDeclaration : Node ;
134
- //let cachedNewImportInsertPosition: number;
135
134
136
135
const currentTokenMeaning = getMeaningFromLocation ( token ) ;
137
136
if ( context . errorCode === Diagnostics . _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead . code ) {
@@ -314,25 +313,8 @@ namespace ts.codefix {
314
313
if ( ! importList || importList . elements . length === 0 ) {
315
314
const newImportClause = createImportClause ( importClause . name , createNamedImports ( [ newImportSpecifier ] ) ) ;
316
315
return createChangeTracker ( ) . replaceNode ( sourceFile , importClause , newImportClause ) . getChanges ( ) ;
317
- // const start = importClause.name.getEnd();
318
- // return {
319
- // newText: `, { ${newImportText} }`,
320
- // span: { start, length: 0 }
321
- // };
322
316
}
323
317
324
- // if (importList.elements.length === 0) {
325
- // const start = importList.getStart();
326
- // return {
327
- // newText: `{ ${newImportText} }`,
328
- // span: { start, length: importList.getEnd() - start }
329
- // };
330
- // }
331
-
332
- // case 3:
333
- // original text: import { foo, bar } from "module"
334
- // change to: import { foo, bar, name } from "module"
335
- //const insertPoint = importList.elements[importList.elements.length - 1].getEnd();
336
318
/**
337
319
* If the import list has one import per line, preserve that. Otherwise, insert on same line as last element
338
320
* import {
@@ -346,10 +328,6 @@ namespace ts.codefix {
346
328
sourceFile ,
347
329
importList . elements [ importList . elements . length - 1 ] ,
348
330
newImportSpecifier ) . getChanges ( ) ;
349
- // return {
350
- // newText: `,${oneImportPerLine ? context.newLineCharacter : " "}${newImportText}`,
351
- // span: { start: insertPoint, length: 0 }
352
- // };
353
331
}
354
332
355
333
function getCodeActionForNamespaceImport ( declaration : ImportDeclaration | ImportEqualsDeclaration ) : ImportCodeAction {
@@ -408,11 +386,6 @@ namespace ts.codefix {
408
386
else {
409
387
changeTracker . insertNodeAfter ( sourceFile , lastImportDeclaration , importDecl , { suffix : context . newLineCharacter } ) ;
410
388
}
411
- // const importStatementText = isDefault
412
- // ? `import ${name} from "${moduleSpecifierWithoutQuotes}"`
413
- // : isNamespaceImport
414
- // ? `import * as ${name} from "${moduleSpecifierWithoutQuotes}"`
415
- // : `import { ${name} } from "${moduleSpecifierWithoutQuotes}"`;
416
389
417
390
// if this file doesn't have any import statements, insert an import statement and then insert a new line
418
391
// between the only import statement and user code. Otherwise just insert the statement because chances
0 commit comments