Skip to content

Avoid convertExport when there's a non-identifier or a bogus one #44106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2021

Conversation

elibarzilay
Copy link
Contributor

Fixes #44105

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels May 15, 2021
@elibarzilay elibarzilay requested review from andrewbranch and sandersn and removed request for andrewbranch May 15, 2021 16:52
@elibarzilay elibarzilay requested a review from jessetrinity May 18, 2021 08:45
@elibarzilay
Copy link
Contributor Author

@jessetrinity: ping

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Couple of additional questions. I personally think returning emptyArray is OK for a bug fix, but I agree that we should get @jessetrinity's opinion.

/////*[| |]*/ /** x */ export default x;

goTo.eachRange(r => {
goTo.selectRange(r);
Copy link
Member

Choose a reason for hiding this comment

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

interesting, do you have to select each range? I thought having the cursor there would be enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But there are three ranges in three files... In any case, existing cases use markers, which I didn't want to mix with a comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

The cursor there alone is not supposed to be enough unless invoked by the refactor command, because I thought it would be too annoying. See https://github.com/microsoft/TypeScript/blob/master/tests/cases/fourslash/refactorConvertExportForTriggerReason.ts

Copy link
Member

Choose a reason for hiding this comment

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

OK. Some refactors are offered in cases other than explicit invoking of the refactor command, right? I always forget about that.

@elibarzilay
Copy link
Contributor Author

@jessetrinity: I made it an error now. I think that there is one minor difference to the previous code where it returns this error instead of undefined, but no changes to tests.

@elibarzilay elibarzilay merged commit fb5f855 into microsoft:master May 24, 2021
@elibarzilay elibarzilay deleted the 44105 branch May 24, 2021 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Cannot read property 'length' of undefined
6 participants