问题描述
我在API中有一个简单的方法,它允许使用JSONPath搜索对象。由于它的语法对于初级开发人员来说几乎是不熟悉的,所以我决定在JSDoc注释中提供一些示例。然而,这是捕获, - @
符号被视为新jsdoc-tag的开头,因此描述已损坏。
I have a simple method in API, that allows searching objects with JSONPath. As its syntax is pretty much unfamiliar to junior developers, i decided to provide some examples within JSDoc comment. Yet, here is the catch, - @
sign is treated as a start of new jsdoc-tag, and so description becomes corrupted.
问题:如何制作NetBeans (或一般的jsdoc)忽略 @
特定代码块内的符号?最好在 @example
块内。
Question: how to make NetBeans (or jsdoc in general) ignore @
signs inside of particular code chunk ? Preferably, within @example
block.
所以这段代码在工具提示中显示未经修改:
So this code, would show unmodified within tooltip:
$ .. book [?(@。price< 10)] // - 过滤所有比10便宜的书
此外, @example
,< code>
, < pre>
- 请勿帮助。
Also, @example
, <code>
, <pre>
- do not help.
Html实体&#64;
在工具提示中转换为 @
,但在代码本身看起来不可读( $ ..book [?(&#64; .price< 10)]
)和它只在主jsdoc文本中工作...
Html entity @
is converted to @
in tooltip, but it looks unreadable in the code itself ($..book[?(@.price<10)]
) and its only working in main jsdoc text ...
推荐答案
这是一个很老的问题,但我遇到了同样的问题,除了VS代码和想法我会分享一个可能的解决方案。
This is a pretty old question, but I was having the same problem, except in VSCode and thought I'd share a possible solution.
最终工作的是移动 @returns
示例,不幸的是,没有使用 @example
,例如:
What finally worked was moving @returns
below the example and, unfortunately, not using @example
, e.g.:
/**
* some description
*
* For example:
* ```js
* $..book[?(@.price<10)] // - filter all books cheaper than 10
* ```
* @returns {*} whatever you're returning
*/
这不太理想,但适用于VSCode的工具提示;我不确定它是否适用于NetBeans。
This is not ideal, but works for VSCode's tooltip; I'm not sure if it'll work with NetBeans.
这篇关于如何在NetBeans中的JSDoc注释中转义@符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!