Disable markdown link warnings

已回答

I'm parsing a file where names are unfortunately in square brackets.  So I have a lot of comments like:

/**
 * parse a frobozz line, looks something like:
 *    F15[MARS]="Stuff irrelevant to the question"
 */

This causes the warning “Cannot resolve symbol 'MARS'”.  Is there any way to specify this is not a hyperlink? 

While I'm at it, is there a comprehensive list of @suppress arguments?

0

Hello Jim

As this is KDoc/Markdown link syntaxyou have two options to make it plain text:

  1. /**
     * parse a frobozz line, looks something like:
     * `F15[MARS]="Stuff irrelevant to the question"`
     */
  2. /**
     * parse a frobozz line, looks something like:
     * F15[MARS]="Stuff irrelevant to the question"
     */

Backticks put it in a code span; the backslash escape before [ tells the Markdown processor not to treat it as a link, while rendering just [MARS] in the doc output. 

If you’d rather silence the diagnostic instead of changing the text, use Kotlin’s @Suppress annotation with the specific inspection id, for example:

@Suppress("UNCHECKED_CAST")
fun f() { … }

There isn’t a single comprehensive, version-stable list of all possible @Suppress argument strings because they’re the internal names of compiler inspections and can change over time. The supported KDoc tag @suppress (lowercase) is different: it has no arguments and simply hides the documented element from generated documentation. 

In practice, the recommended ways to discover usable @Suppress ids are:

  • Use Alt+Enter on the warning and choose one of the “Suppress …” intentions; the IDE will insert the correct string.
  • For compiler warnings, compile with -Xrender-internal-diagnostic-names once to see the underlying diagnostic names, then use those names as @Suppress arguments. 
0

请先登录再写评论。