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

Adding documentation comments to the return values of destructuring syntax #60759

Open
melxy1997 opened this issue Dec 13, 2024 · 1 comment
Open
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@melxy1997
Copy link

Type: Feature Request

  • In ReactJS, we often write code similar to const [stateX, setStateX] = useState({ ... });.

  • I would like to hover over the variable name stateX with the mouse in other places where this variable is used to get an explanation similar to JSDoc (not for type, but to more clearly annotate the purpose of the variable).

  • The reason I think this way is because the following approach often works:

/** It's a ref for X */
const refX = useRef({ ... });

(When I hover over the refX variable in other places where it is accessed, the tooltip can display the documentation "It's a ref for X".)

  • However, I have not found any way to annotate without disrupting the original code structure, so that VSCode can recognize my documentary comments for the tuple.
  • I'm not sure whether this should be considered a feature request or a bug report.

VS Code version: Code 1.95.3 (Universal) (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z)
OS version: Darwin arm64 22.3.0
Modes:

Copy link

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.96.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@mjbvz mjbvz transferred this issue from microsoft/vscode Dec 13, 2024
@mjbvz mjbvz removed their assignment Dec 13, 2024
@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants