I am looking to have JSON examples in my documentation, which in turn will have JSON examples in my intellisense for VScode.
I have tried every trick in the book that I can think of, is this possible to do with line breaks and things that would make the JSON readable? I cannot get this to work in VScode no matter what I do, it takes out white space and makes one line.
I try to do:
/**
* {
* "JSONData":"not going to format like this"
* }
*/
functionToDescribe()
this of course will end up in intellisense like so...
{ "JSONData":"not going to format like this" }
This is ok with small examples, but I would like to have a bit larger (still small) simple examples. There are other reasons I really want line breaks, not just JSON, I just want my text to be cleaner in my comments in general.
I will also take different examples of how other people document it. I am really looking to make my JS code easier to know what to expect the function to accept, return and use in operation before using it.
EDIT: I stumbled across this link: https://github.com/Microsoft/vscode/issues/30062
which now I understand that formatting works when you look at the declaration of the function or item, but not when you go to use it.
the following markup code works great when I hover over the function name, but when I use it like normal it is all on one line and worthless
/** This is a description
* with each line
* on it's own
*
* @example Test
* ```javascript
* let valueReturned = false;
* jest.fn(() => {
* if (!valueReturned) {
* valueReturned = true;
* return value;
* //no idea why it requires me to have so many spaces...
* }
* });
* ```
*/
functionTest() //When hovering over this, it looks great
functionTest( //at this point intellisense pops up and is worthless
I believe this is a bug or simply bad design, maybe I will put in a feature request, if it doesn't already exist.
I will keep this question open in case someone else has any suggestions or possible work arounds.
EDIT:
Good news, it looks like this was a bug and after searching for quite a while, it seems this was fixed just this month and will be with the September release!
https://github.com/Microsoft/vscode/issues/1920
I will close this now and leave this up for anyone else who was having troubles with this.