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

(feat) event completion/hover for components with a type definition #1057

Merged
merged 6 commits into from
Jun 20, 2021

Conversation

jasonlyu123
Copy link
Member

Provide event hover info and completion for components with a type definition, mainly for components in component libraries.

@dummdidumm
Copy link
Member

W00t this is awesome! I was thinking about something like this recently (analyzing the TS AST ourselves) and now you open this PR 😄 I'll take a closer look later, excited for this!
Could something similar be used for the slot attributes on the default slot?


return new JsOrTsComponentInfoProvider(typeChecker, classType);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about making the instance of this a property on TsOrJsDocumentSnapshot? Then it could be cached and the cache would only be deleted on updates to the snapshot.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure about the performance implications, but could this be something we could also use for the svelte2tsx-components? Then we could ditch our own implementation of creating the "events" property on the svelte2tsx return type.

Copy link
Member Author

Choose a reason for hiding this comment

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

Cached in the snapshot seems like a good idea.

could this be something we could also use for the svelte2tsx-components

Yes. Tried with svelte2tsx-component. The biggest difference between this and the svelte2tsx approach is the fallback Event in the svelte2tsx.

@dummdidumm
Copy link
Member

Do you have time to add the caching logic the next few days or should I take over? This feature is too nice to not get it in as part of the next release 😄

@jasonlyu123
Copy link
Member Author

OK. I'll add the caching logic soon

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.

🎉

@dummdidumm dummdidumm merged commit 6ed31d0 into sveltejs:master Jun 20, 2021
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