-
Notifications
You must be signed in to change notification settings - Fork 12.8k
JSDoc stripping leading whitespace in code blocks #15749
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
Comments
The issue is still there, where should I have a look in order to fix it and open a PR? |
Take a look at |
I'm getting a slightly different results in vscode Version 1.28.2 (1.28.2) with newline after
|
In summary, the original issue is fixed, but unfenced code blocks still squash leading white space as in @psyrendust's last example. The parser doesn't know about markdown, so I suspect this is caused later in the pipeline. Needs investigation. |
The problem is that the code currently only handle indentations of the form /**
* @example if (true) {
* foo()
* }
*/ The code starts off parsing Edit: the code is wrong for @psyrendust's last example, not for the oddly-indented example I just gave. |
I see that this is closed but it appears to still be a bug in the latest release. |
False alarm. It wasn't working for me I swear, but just trying it again its now fine... Please ignore. |
Doubling what @tulio-coppola said, Example: /**
* Create a new type which has the properties of `Base` that match `Condition`
*
* @example <caption>This example extracts properties of `foo` that have a value type of `string`</caption>
* // `fooT` is now { a: string, d: string }
* // `fooKT` is now ` 'a' | 'd' `
* interface foo {
* a: string;
* b: number;
* c: string[];
* d: string;
* }
* type fooT = SubType<foo, string>;
* type fooKT = keyof fooT ;
* @example
* interface foo {
* prop: string;
* }
*/
export type SubType<Base, Condition> =
Pick<Base, AllowedNames<Base, Condition>>; This is 1.45.1 on Windows |
This issue is still present in the latest version of TS and VSCode. |
Please open a new issue; this one has been closed a long time. |
From: microsoft/vscode#26415
TypeScript Version: 2.3.2
Code
Expected behavior:
For the
@example
tag, we should return content including any leading whitespaceActual behavior:
In this case, whitespace is stripped:
This results in incorrect rendering of the code example:
The text was updated successfully, but these errors were encountered: