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: twoslash-svelte #57

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open

Feat: twoslash-svelte #57

wants to merge 43 commits into from

Conversation

Hugos68
Copy link

@Hugos68 Hugos68 commented Oct 29, 2024

This PR attempts to create twoslash-svelte which is an extension of twoslashthat supports Svelte.

Copy link

netlify bot commented Oct 29, 2024

Deploy Preview for twoslash ready!

Name Link
🔨 Latest commit 16a7c9b
🔍 Latest deploy log https://app.netlify.com/sites/twoslash/deploys/675f4c9f0d145c0008eb2b97
😎 Deploy Preview https://deploy-preview-57--twoslash.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Hugos68 Hugos68 marked this pull request as draft October 30, 2024 09:13
@Hugos68
Copy link
Author

Hugos68 commented Oct 31, 2024

@antfu @orta
A review would be appreiciated, I'm now at a point where I feel confident I have the code working. I was able to copy some code from twoslash-vue as it works similarly (convert source to tsx then typecheck and use sourcemaps to backtrack the original location).

All that's left is tests.

@Hugos68 Hugos68 marked this pull request as ready for review October 31, 2024 09:35
@orta
Copy link
Member

orta commented Oct 31, 2024

From a high level, this looks very cool to me!

@Hugos68
Copy link
Author

Hugos68 commented Oct 31, 2024

@antfu There seems to be a bug related to the $ inside twoslash or @shikijs/vitepress-twoslash. Everytime a variable has the $ inside of it there are 2 popups:

1: image
2: image

As you can see both popups show information about $state but one is at the first index of the word and the other is at the middle index (which is the correct one). Why is there an extra popup for the $?

In the HTML output you can see that instead of a single span the $ and state are seperated:
image

@Hugos68
Copy link
Author

Hugos68 commented Nov 1, 2024

Also, for some reason twoslash-vue test aren't passing anymore, I have no clue why as I didn't touch the tests from twoslash-vue.

@Hugos68
Copy link
Author

Hugos68 commented Nov 30, 2024

@antfu This is ready for review btw, not sure if you have missed it as I know you're inbox is quite lengthy.

@Hugos68
Copy link
Author

Hugos68 commented Dec 19, 2024

@dominikg, I might need some help as you're one of the maintainers of svelte2tsx correct?
When compiling the tsx coming from svelte2tsx how can I include the .d.ts files? I've tried many methods but can't find a consistent way where the user can install svelte2tsx and the twoslash-svelte package can use those files.

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.

2 participants