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

Docstrings are ignored by svelte2tsx #281

Closed
fnune opened this issue Jul 5, 2020 · 2 comments · Fixed by #282
Closed

Docstrings are ignored by svelte2tsx #281

fnune opened this issue Jul 5, 2020 · 2 comments · Fixed by #282
Labels
feature request New feature or request

Comments

@fnune
Copy link
Contributor

fnune commented Jul 5, 2020

Edit: made a PR to fix it here #282

Problem

In util.ts:

/** Says hello */
export function sayHello() {
  return 'hello!'
}

Then, in some component:

<script type="text/typescript">
  import { sayHello } from './util'

  sayHello()
</script>

Hovering sayHello in VSCode or Vim/Neovim with coc.nvim doesn't show the docstring. I believe this is because these docstrings aren't added back by svelte2tsx? Edit: it was the language server provider.

Solution

Add docstrings that follow JSDoc TSDoc notation (which is what TypeScript uses) into the generated TSX.

Additional context

I found out about this shortcoming while working on a pull request for this #280
I believe the fixes are separate units of work, though.

@fnune
Copy link
Contributor Author

fnune commented Jul 5, 2020

I'm a bit confused. I believe the issue isn't actually in svelte2tsx, because (at least going by the tests) comments aren't removed from the produced TSX:

image

@fnune
Copy link
Contributor Author

fnune commented Jul 5, 2020

Starting to think it's the language server provider that's not making use of the comments.

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

Successfully merging a pull request may close this issue.

2 participants