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
Semantics of @example unclear (VSCode disagrees) #147
Comments
From a documentation perspective, TSDoc's design seems a little better to me:
This was an intentional design decision. TSDoc avoids assigning meaning to whitespace, since it's easy to mess up inside a I'm not sure what VS Code's approach is based on. Prior to TSDoc I couldn't find any formal spec for how TypeScript doc comments should be interpreted. That said, you can see from this thread that |
Yeah, I see where you're coming from. It's just this: we're building a class library that we recommend people to write extensions for using VSCode, and we intend to parse the doc comments using TSDoc, and that means we're stuck in an uncomfortable position where the tools we're recommending people to use are going to disagree on what a particular piece of text means. Specifically, the editor is going to apply confusing syntax highlighting to something that's not actually interpreted as code. (By the way, I just tried mixing descriptive text and fenced code blocks, and VSCode completely loses it when I do that). I appreciate that while trying to set a new standard there might be a transitionary period during which things are messed up. I just hope that VSCode and TSDoc can align quickly. Otherwise, to smooth the transition, is there a possibility to have 2 different tags with different interpretations? |
Yeah, we've been planning for a while to set up a conversation with the VS Code owners and improve alignment between the two projects. I've been delaying this because I thought it would be helpful to first write up the spec draft that codifies the TSDoc syntax and philosophy. But the last couple months most of my time in this area has been focused on shipping API Extractor 7, which will give us a complete application of TSDoc for a production tool. That should be done in the next week or so, but it's taken much longer than expected. In short, you're right, and we're working towards what you're describing, just rather slower than ideal but with plenty of great sounding excuses heheh.
Sure. The TSDoc parser configuration allows you to define custom tags. So you could make a tag See this sample code for an example of custom tags. |
Hi,
I'm just dipping my toe into TSDoc, so my apologies in advance if this discussion is out of place, or what I'm about to say is common knowledge. Having said that:
There seems to be disagreement about how
@example
blocks are supposed to be interpreted, specifically when using VSCode.If I add an
@example
block to my doc comment, VSCode responds by nicely syntax-highlighting the following code block:That's amazing, exactly what I want! However, TSDoc tries to parse the code inside the
@example
block as "regular" docstrings:Looks like TSDoc wants me to fence the code block with code delimiters, which is not as nice:
(Indentation by 4 spaces, which normally indicates literal code in MarkDown, doesn't work either, TSDoc still tries to parse the code)
The text was updated successfully, but these errors were encountered: