Skip to content

Make fixCannotFindModule return an empty array if there is no code action#21042

Merged
amcasey merged 3 commits intomicrosoft:masterfrom
amcasey:cannotFindModule
Jan 6, 2018
Merged

Make fixCannotFindModule return an empty array if there is no code action#21042
amcasey merged 3 commits intomicrosoft:masterfrom
amcasey:cannotFindModule

Conversation

@amcasey
Copy link
Copy Markdown
Member

@amcasey amcasey commented Jan 5, 2018

Don't send a code action containing just a fixId. Among other things, VS crashes if there's no description.

@amcasey amcasey requested a review from a user January 5, 2018 22:39
getCodeActions: context => [
{ fixId, ...tryGetCodeActionForInstallPackageTypes(context.host, context.sourceFile.fileName, getModuleName(context.sourceFile, context.span.start)) }
],
getCodeActions: context => (codeAction => codeAction && [{ fixId, ...codeAction }])(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Use const x = init; return f(x); instead of (x => f(x))(init). So in this case use `const codeAction = tryGet...; return codeAction && [{ fixId, ...codeAction }];

@amcasey amcasey merged commit 4437476 into microsoft:master Jan 6, 2018
@amcasey amcasey deleted the cannotFindModule branch January 6, 2018 01:51
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant