Skip to content
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

Fix auto imports in opening JSX tag #44724

Merged
merged 1 commit into from Jun 24, 2021

Conversation

andrewbranch
Copy link
Member

Fixes #44657

Sometime in 4.3 I changed the completion symbol sort text and origin maps to be keyed by the symbol index in the symbols array instead of by symbol id (since the same symbol can sometimes be imported in different ways, thus having more than one completion entry). Missed in that refactor was the fact that JSX opening tag completions shift all the intrinsic element symbols onto the beginning of the symbols array, offsetting the indices, such that no origins or sort text were found while creating the final completion entries. Pretty weird that there was no test coverage for that.

@typescript-bot typescript-bot added For Milestone Bug PRs that fix a bug with a specific milestone labels Jun 24, 2021
tryGetGlobalSymbols();
symbols = tagSymbols.concat(symbols);
Copy link
Member Author

Choose a reason for hiding this comment

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

Here’s where all the symbols already in symbols got their indices shifted by tagSymbols.length, messing up the coordination with the maps that referenced the indices of this array.

@DanielRosenwasser
Copy link
Member

@typescript-bot cherry-pick this to release-4.3

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 30, 2021

Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into release-4.3 on this PR at 5545946. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

Hey @DanielRosenwasser, I've opened #44822 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Jun 30, 2021
Component commits:
5545946 Fix auto imports in opening JSX tag
DanielRosenwasser pushed a commit that referenced this pull request Jun 30, 2021
Component commits:
5545946 Fix auto imports in opening JSX tag

Co-authored-by: Andrew Branch <andrew@wheream.io>
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.3.5 milestone Jun 30, 2021
@Ghazgkull
Copy link

This PR introduced a breaking change from the 4.4 branch in a 4.3.x patch release. Upgrading to version 4.3.5, I now see this breaking change: https://devblogs.microsoft.com/typescript/announcing-typescript-4-4/#using-unknown-in-catch-variables

@DanielRosenwasser Can this change please be reverted asap on the 4.3.x branch?

@andrewbranch
Copy link
Member Author

This PR fixes auto imports in JSX tags and nothing else. Moreover, https://unpkg.com/typescript@4.3.5/lib/typescript.js has no reference to useUnknownInCatchVariables.

@Ghazgkull
Copy link

@andrewbranch I was able to consistently break/fix my TS by swapping between version 4.3.4 and 4.3.5. But I'll check again to reconfirm that I didn't do anything goofy.

@Ghazgkull
Copy link

Ghazgkull commented Sep 9, 2021

@andrewbranch I went back and carefully did a clean install of my modules, then tried bumping from version 4.3.4 to 4.3.5 and the problem I was seeing yesterday did not recur. My steps yesterday involved repeated upgrading and downgrading to different versions (e.g. 4.3.4->4.4.2->4.3.5->...) so something must have gotten messed up in that process. 🤷 Please disregard and sorry for the noise.

@andrewbranch
Copy link
Member Author

No problem @Ghazgkull, thanks for confirming 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-imports from within jsx don't work
5 participants