-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Support parsing TSDoc string comments #38106
Comments
This is an underrated feature. Nowadays, a lot of Here is the link of the related issue in the tsdoc repository. Here are a few real-world use-cases I thought of: React Native CSS<Text style={{
color: 'blue',
alignSelf: 'center',
}}> This is a blue text </Text> Adding string comments would simplify the understanding of each possibility (each color, each possible alignments). This is applicable to all properties with a defined set of string values. Configuration filesFor example, let's take a {
"module": "commonjs"
} Currently, the documentation looks like this: While we know all the possible options, there is no way to understand what they actually do. String comments could tell explicitly the user what each option is supposed to change. This is applicable to all configuration files that are made with TS, not only Material-UIMaterial-UI relies a lot on string enumerations, but they are not always easy to understand. <Button variant="contained"> My Button </Button> In the above example, while This is applicable to all React props with a defined set of string values. In conclusion, I think it's a very good idea, and it could simplify documentation in a lot of projects. |
It would be nice if at least this was working (it doesn't): /** Foo docs. */
type Foo = "foo"
/** Bar docs. */
type Bar = "bar"
type Test = Foo | Bar
const x: Test = "foo" // No docs for `foo` when typing. |
We often use string literal types as a lightweight alternative to full enums. It's really frustrating that we can't document the individual options in a way that VS Code recognizes. In the following code, all the doc-strings on the options are simply lost: /** Controls the alignment of text when printed. */
type TextAlignment =
/** Left-aligns the text. */
| "left"
/** Right-aligns the text. */
| "right"
/** Centers the text horizontally. */
| "center"; There are identical issues in the TypeDoc repo (TypeStrong/typedoc#1710) and the TSDoc repo (microsoft/tsdoc#164), but they all require proper support from TypeScript first. |
Any update on this? 😕 |
Any progress? It would be an amazing feature. 😕 |
We also have this requirement for adding TSDoc for our design system tokens. Similar ask on StackOverflow: For now, we're working around this limitation by providing the feature in a VSCode extension: |
Any updates? |
Hi there!
I had a issue trip around Github and finally ended up here :)
Last issue was: microsoft/vscode#95408
I am using String Literal types to define classnames and would love to populate with some more information.
So basically:
I would expect it to populate the docs on the right side of the intellisense:
This is how we can document with properties:
Which would be amazing to have on string literals.
I thought it was a TSDoc issue, but given this context: microsoft/tsdoc#164, it seems to be VSCode not parsing it... though then it seems to actually be Typescript related?
The text was updated successfully, but these errors were encountered: