(context, errorCode, pos, useAutoImportProvider)
| 153419 | } |
| 153420 | } |
| 153421 | function getFixesInfo(context, errorCode, pos, useAutoImportProvider) { |
| 153422 | var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos); |
| 153423 | var info; |
| 153424 | if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { |
| 153425 | info = getFixesInfoForUMDImport(context, symbolToken); |
| 153426 | } |
| 153427 | else if (!ts.isIdentifier(symbolToken)) { |
| 153428 | return undefined; |
| 153429 | } |
| 153430 | else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { |
| 153431 | var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()); |
| 153432 | var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); |
| 153433 | return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text }; |
| 153434 | } |
| 153435 | else { |
| 153436 | info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); |
| 153437 | } |
| 153438 | var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); |
| 153439 | return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) }); |
| 153440 | } |
| 153441 | function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) { |
| 153442 | var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }; |
| 153443 | return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); }); |
no test coverage detected