question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documenting components with a docstring that appears on hover documentation

See original GitHub issue

Problem

With React’s tooling, you can comment on a component like this:

/** Documentation that will appear on hover in other places where this is imported */
function MyComponent() { return null }

However, in Svelte, I haven’t found a way to do this.

Solution

I would like to know where I can place a comment that will be taken up by the on-hover documentation of editors like VSCode and Vim/Neovim (with coc.nvim).

To illustrate, here I’m hovering MyComponent but I only see import MyComponent:

image

I would like my docstring Documentation that will appear on hover in other places where this is imported to be included in the tooltip.

I’ve googled around for this for a while and tried my local setup with TypeScript and I can’t find a way to do it. I found an interesting related discussion on metadata for Svelte components but the discussion is more about prop types.

Question

On the analogous issue I made on language-tools https://github.com/sveltejs/language-tools/issues/280 we’ve been talking about HTML comments that can be picked up by svelte2tsx. However, using something like <svelte:options documentation="blabla" /> seems more idiomatic, but it would require support by the compiler.

What do you think is the best option?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Conduitrycommented, Jul 5, 2020

Closing, as this does indeed sound like more of a language-tools thing.

1reaction
dummdidummcommented, Jul 5, 2020

Yes, you are welcome to do a PR at language-tools 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Docstring: Documenting And Introspecting Functions
This tutorial explains what is Python Docstring and how to use it to document Python functions with examples.
Read more >
How can I make the documentation pop-up on hover in ...
I would like to know how to configure PyCharm so that when I hover over an object or method I get a ...
Read more >
How to Use Python Docstrings for Effective Code Documentation
Documenting your code is a critical skill for any data scientist or software engineer. This tutorial will show you how using docstrings.
Read more >
Documentation tool window - PyCharm - JetBrains
By default, PyCharm shows Quick Documentation in a popup; to view it in the tool window, click App actions more in the popup...
Read more >
Documentation · The Julia Language
The basic syntax is simple: any string appearing just before an object (function, macro, type or instance) will be interpreted as documenting it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found