Avoiding the @ Sign Inside JSDoc Comments in NetBeans

I have a simple method in the API that allows me to search for objects using JSONPath. Since its syntax is almost unfamiliar with junior developers, I decided to give a few examples in a JSDoc comment. However, here's the catch, the @ sign is seen as the start of a new jsdoc tag, and so the description gets corrupted.

Question: how to make NetBeans (or jsdoc in general) ignore @ signs inside a specific code fragment. Preferably in the @example block.

So, this code will appear unmodified in the tooltip:

$..book[?(@.price<10)] // - filter all books cheaper than 10

In addition, @example , <code> , <pre> - do not help.

Html entity &#64; converts to @ in a tooltip, but it does not look readable in the code itself ( $..book[?(&#64;.price<10)] ) and works only in the jsdoc main text ...

+9
source share
2 answers

This is a pretty old question, but I had the same problem except for VSCode, and I decided to share a possible solution.

As a result, it turned out to move @returns below the example and, unfortunately, do not use @example , for example:

 /** * some description * * For example: * '''js * $..book[?(@.price<10)] // - filter all books cheaper than 10 * ''' * @returns {*} whatever you're returning */ 

This is not ideal, but works for a VSCode tooltip; I'm not sure if this will work with NetBeans.

+3
source

Not sure if this will work for all environments, but when using VSCode for a typescript file (.ts), I was able to use the template strings to get a well-displayed code example

 /** * @description * This function totally does something. * * @example''' import { SomeThing } from '@mycompany/my-cool-library'; DoSomething(SomeThing)''' * * @returns string */ 

Makes the tooltip display as follows:

escaping_the _ @ _ sign

0
source

Source: https://habr.com/ru/post/913607/


All Articles