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

[Feature] Add support for Svelte #628

Closed
HendrikPetertje opened this issue Sep 22, 2023 · 6 comments · Fixed by #630
Closed

[Feature] Add support for Svelte #628

HendrikPetertje opened this issue Sep 22, 2023 · 6 comments · Fixed by #630
Assignees
Labels
feature New feature or request

Comments

@HendrikPetertje
Copy link

Heya,

When running doge#generate on a .js, .ts or even .tsx file I see no problems at all, but when I try to execute doge on a .svelte file then I'm met with this error:

image

I can't really switch filetype on my svelte files to HTML (which it essentially looks like) as LSP and completion are all helping me out with svelte-specific help.

Can I do something to make doge play nicely or is a change required in this plugin to make jsdoc generation work on svelte files?

@HendrikPetertje HendrikPetertje added the question Further information is requested label Sep 22, 2023
@HendrikPetertje
Copy link
Author

I tried adding this:

vim.g.doge_filetype_aliases = {
  javascript = { 'svelte' }
}

But then my entire file is parsed as a javascript file all of a sudden (which does not recognize HTML tags)

Without this rule:
image

With the above snippet enabled:
image

@kkoomen
Copy link
Owner

kkoomen commented Sep 29, 2023

This indeed gives error in the current version. There is a tree-sitter svelt parser. I can implement this logic soon and make it a bit more dynamic so that I can also implement support for Vue files.

@kkoomen kkoomen added feature New feature or request and removed question Further information is requested labels Sep 29, 2023
@kkoomen kkoomen self-assigned this Sep 29, 2023
@kkoomen kkoomen changed the title can I run doge#generate on svelte files? [Feature] Add support for Svelte Sep 29, 2023
@kkoomen
Copy link
Owner

kkoomen commented Sep 29, 2023

@HendrikPetertje I have implemented everything locally on a new branch including tests. Basically the root-level <script> tag right now is being parsed and then the contents are passed to the typescript parser. I will dig in a bit deeper in other possible use cases this weekend in how people tend to work with Svelte, just to make sure I've handled all the use cases. I'll let you know once I'm finished, but I can definitely do a release with proper support for svelte.

This was referenced Sep 30, 2023
@kkoomen
Copy link
Owner

kkoomen commented Oct 1, 2023

This has been added v4.4.0.

@HendrikPetertje
Copy link
Author

THIS IS SO COOL, THANKS!

@kkoomen
Copy link
Owner

kkoomen commented Oct 4, 2023

@HendrikPetertje Hope you enjoy. By the way, I've already did release v4.5.0 which also supports HTML and VueJS as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants