-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
TypeScript class method decorator not rendering properly in version >= 1.63.2 #47679
Comments
Looks like a duplicate of #35310 but let's wait for feedback from the TS team |
None of the workarounds suggested in that issue work as it's also reported by other users in that same issue. It was marked as "work as intended", does it mean that decorators are not supposed to be rendered correctly? |
Since this was rescheduled/left out of the last two iterations, is there any chance that this can be added to the |
Looking at the parser, the problem is that backticks don't persist across lines, even triple backticks. |
A naive change to stop resetting the backtick parsing does stop treating |
Update: the fix at #50677 correctly makes single and triple backticks multiline, but this breaks unclosed backticks in the tests and would break them in the compiler source code itself. We're discussing whether to take the change or not. |
I don't think I've ever used or seen a single back tick anywhere, so a very few minority of people (if they even exist) can migrate. |
I think a solution should work with both code fences, and Personally I think GitHub has the best handling of back ticks. Might be worth looking at. But if back ticks can't be fixed, I think at least Another option for escaping JSDoc was designed before the language had decorators, so I think anything goes here really. |
better-docs is a sweet JSDoc parser and generator for TypeScript, backward compatible with the original JSDoc. https://github.com/SoftwareBrothers/better-docs @wojtek-krysiak do you have any thoughts on how to handle decorators? I think it would make sense to ensure that TypeScript's format aligns well with the best tools in the community (like better-docs). Better docs is great because it takes TypeScript code (with JSDoc) and can output 100% actual-JSDoc compatible JSDoc comments for compatibility with official JSDoc tooling, whereas other tools like TSDoc are not compatible. |
JSDoc itself is still active, and the community has open issues for this: jsdoc/jsdoc#1521 @hegemonic do you have any opinions on decorator support? I believe we should all aim to be on the same page to avoid community fracture. It would be so much better to coalesce into a common future. In the worst case, a tool like better-docs would have to take incompatible syntax and convert it to compatible syntax, which wouldn't be ideal. |
Hi everyone, any chance to get this addressed as part of the 5.0 milestone? |
Any progress on the code indentation portion of this issue? |
Decorators are non-experimental now with TypeScript 5. Can we have this fix soon pleeease? 🙏 |
@RNLN I tried your suggestion, but that causes weird formatting for me: For now, this is what I've settled with my docs looking like:
🤣 |
@trusktr It's odd because I tried adding this invisible character to your documentation and it worked for me. After that, I took the liberty of adjusting the indentation, using This is just an example and I'm not sure it will be of help, but here's a snippet just in case: Snippet/**
* @class Effectful -
*
* `mixin`
*
* Create Solid.js effects using `this.createEffect(fn)` and easily stop them
* all by calling `this.stopEffects()`.
*
* @example
* import {element, Effectful} from 'lume'
*
* @element('my-element')
* class MyElement extends Effectful(HTMLElement) {
* @attribute foo = "foo"
* @attribute bar = "bar"
*
* connectedCallback() {
* // Log `foo` and `bar` any time either of them change.
* this.createEffect(() => {
* console.log('foo, bar:', this.foo, this.bar)
* })
*
* // Log only `bar` any time it changes.
* this.createEffect(() => {
* console.log('bar:', this.bar)
* })
* }
*
* disconnectedCallback() {
* // Stop both of the effects.
* this.stopEffects()
* }
* }
*/ |
That snippet is working for me now. Not sure why I wasn't able to get it working before. EDIT: Ah, I was putting the invisible non-space after the Also, weird, I thought indentation when using code fences worked before (might be mis-recalling, and here's a bug report for that), but I do see it is currently broken. Unfortunately I have to keep the code fences for now because those JSDocs get consumed and rendered as markdown, f.e. the content here is from JSDoc tags: https://docs.lume.io/api/utils/Settable Source: https://github.com/lume/lume/blob/develop/src/utils/Settable.ts#L5 But perhaps I can update the JSDoc extractor to support |
@RNLN nice trick! <3 It didn't work for me, but it gave me a clue about the symbol "U+2064" (invisible plus). It's still a hack, but it's working :) |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
As you can see from the screenshot above the example appears not to be rendered correctly with two main issues:
*
Before opening this issue I've searched the repo (& the TypeScript one) and found a series of other issues. Most of them have been closed as duplicates or as fixed but as the above shows the issue is still there. Examples:
@
character (org package imports) #39371@example
parsing when an at-sign@
is used in the code-block. #38922If the issue has been indeed fixed, could you please take a second to clarify what's the intended usage to allow VS Code to render decorators correctly? I'm aware that decorators are an experimental feature, if that's the reason why this is not supported could you please state it?
Thanks in advance.
The text was updated successfully, but these errors were encountered: