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

(chore) bumps typescript to 4.7 #1496

Merged
merged 4 commits into from May 29, 2022
Merged

Conversation

jasonlyu123
Copy link
Member

@jasonlyu123 jasonlyu123 commented May 26, 2022

Draft for now as it seems like the string literal prop completion is broken. From my debugging, it seems like typescript now looks at the first argument of the component class construtor instead of the JSX.ElementAttributesProperty. Since we plan to switch to the new transformation, not sure if it's still worth the effort to ask the typescript team to support it.

@@ -18,7 +18,7 @@ export class FindReferencesProviderImpl implements FindReferencesProvider {
const { lang, tsDoc } = await this.getLSAndTSDoc(document);
const fragment = tsDoc.getFragment();

const references = lang.getReferencesAtPosition(
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't know what's the difference between these two methods. But the one we used before no longer returns isDefinition

Copy link
Member

Choose a reason for hiding this comment

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

From a quick TS codebase search it seems that findReferences is like getReferencesAtPosition with an additional step afterwards, at least they both call getReferencedSymbolsForNode which does the actual work. Not sure what exactly changed that the definition is no longer part of it. Maybe they filter out the definition-position already now, which means we can keep using and just remove the check? Edit: When rewriting the store transformation and do additional logic in references/rename/etc instead, we need the definition to appear, so it would be bad if the definition is filtered out by TS now, and using findReferences would be better.

Copy link
Member Author

Choose a reason for hiding this comment

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

Found a place where it does make a difference. If you use a go-to reference on the definition.
It would invoke includeDeclaration: true. Previously if there is only one reference it would take you to the reference. if we use the findReferences and remove the check it would not take you to the reference but show both reference and definition.

@dummdidumm
Copy link
Member

I'm ok with it no longer working, it doesn't appear in many places and I want to switch to the new transformation in about a month.

@jasonlyu123
Copy link
Member Author

I ported the string literal completion as a fallback before you commented XD. I think we can use this fallback and if someone finds any difference we can just tell them it won't matter soon.

It's ready for merge now. Do we want to merge it now? Or do we want to wait a few days until vscode release a new version with 4.7? To see if people have problems with 4.7.

@jasonlyu123 jasonlyu123 marked this pull request as ready for review May 29, 2022 10:35
Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

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

Changes look good 👍 although I'm glad we can get rid of all the conditional checks for the new transformation once we remove the old one 😄

@dummdidumm dummdidumm merged commit 46a3dd8 into sveltejs:master May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants