asciidoctor-intellij-plugin icon indicating copy to clipboard operation
asciidoctor-intellij-plugin copied to clipboard

Intention to assert missing file(s) will exist

Open reitzig opened this issue 4 years ago • 3 comments

Why the new feature should be added

We re-use some files across projects and maintain them in a central place; when building our documents with a dedicated container, the files will be put in the appropriate places. Since they don't exist in the project sources, though, the plugin dutifully reports the problem.

image

This is distracting from "real" errors.

How the new feature should work

Provide an intention that disables the error for that single file, selectively; replace is with a "weak warning".

(I seem to remember a similar feature from BashSupport for environment variables, but I can't find a reference right now.)

reitzig avatar Dec 17 '20 16:12 reitzig

You can flag an include as "optional" for Asciidoctor like this:

include::missing.adoc[opts=optional]

This will render a warning instead of an error.

In similar situations I found myself to make such an include point at a dummy file that would also be shown in the preview.

As an alternative, you could use conditional rendering as described in the docs to avoid the error of Asciidoctor. You'll then need to suppress the inspection as well. This would result in a snippet like this:

ifndef::env-idea[]
// suppress inspection "AsciiDocLinkResolve"
include::missing.adoc[]
endif::[]

If one of these options matches your needs, please close this ticket. If it none of the options matches your needs, please elaborate.

If you think this should go to the FAQ, please consider a pull request for the docs. See Contributing as a writer for more information.

ahus1 avatar Dec 17 '20 20:12 ahus1

There hasn't been a comment in this issue for more than a month, therefore I close this issue. Please comment to re-open this issue.

ahus1 avatar Jan 27 '21 19:01 ahus1

@ahus1 Thanks for the good hints and sorry for the late reply!

[ops=optional] looks like what I was looking for. But the feature request is do add an intention (Alt+Enter) that would add this option. That is, the pop-up

image

should have an option "mark optional".

reitzig avatar Feb 01 '21 14:02 reitzig