Merge pull request #21042 from amcasey/cannotFindModule
Make fixCannotFindModule return an empty array if there is no code action
This commit is contained in:
Коммит
4437476856
|
@ -4,9 +4,10 @@ namespace ts.codefix {
|
|||
const errorCodes = [Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code];
|
||||
registerCodeFix({
|
||||
errorCodes,
|
||||
getCodeActions: context => [
|
||||
{ fixId, ...tryGetCodeActionForInstallPackageTypes(context.host, context.sourceFile.fileName, getModuleName(context.sourceFile, context.span.start)) }
|
||||
],
|
||||
getCodeActions: context => {
|
||||
const codeAction = tryGetCodeActionForInstallPackageTypes(context.host, context.sourceFile.fileName, getModuleName(context.sourceFile, context.span.start));
|
||||
return codeAction && [{ fixId, ...codeAction }];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: context => codeFixAll(context, errorCodes, (_, diag, commands) => {
|
||||
const pkg = getTypesPackageNameToInstall(context.host, getModuleName(diag.file, diag.start));
|
||||
|
|
Загрузка…
Ссылка в новой задаче