asciidoctor-intellij-plugin
asciidoctor-intellij-plugin copied to clipboard
Callouts in embedded source fragment show false error
Using Callouts in a code fragment show error message Invalid redirect
:
Use this AsciiDoc code fragment to see error
:parameter: paramvalue
[source, bash, subs=attributes+]
----
call my shell script \# <1>
with some additional parameters like {parameter} \# <2>
and a third continuation line # <3>
----
<1> First line
<2> Second line with additional parameter `{parameter}`
I think, it is independent from the subs=attributes+
setting (this is only needed to correctly render the parameter in the embedded source code).
BTW: Additionally it is not possible to rename the parameter
(e.g., by pressing Shift-F6). It is correctly replaced in the text fragment for callout <2> but not in the source fragment.
AsciiDoc Plugin Version: 0.30.84
IDE Name and Version: IntelliJ 2020.1.x
Hi Gerd, thanks for reporting this.
Regarding the "invalid redirect":
I suppose this is due to the language injection for "bash" support. Some plugin of your IDE adds highlighting for the contents of the listing. Do you know what plugin you installed to support the "bash" language, so I can reproduce it locally?
Looking at the listing with the callouts this is no valid shell script. Putting end-of-line comments in multiline shell statements is hard - see this stack overflow discussion as an example.
Options that might be available in a future version of the plugin:
- automatically exclude callouts from listings when when passing the contents to a different plugin for language highlighting (I'll have to see if this is possible). Usually code with callouts would still be valid code with comments, but not in this case.
Options that are available for you today:
- rewrite the shell script to be a valid shell script despite the callouts
- disable showing errors for all code snippets in the AsciiDoc plugin settings (see below in screen shot)
- disable language injection for bash scripts (see below in screen shot)
Regarding attribute references in listings for editor rename:
The plugin doesn't yet support attribute references in listings in the lexer and parser. Due to this it will not rename its occurrences in listings. I'll keep this ticket open as a reminder that this would be a helpful feature.
Thanks for the fast reply, find my comments below.
-- Gerd Aschemann --- Veröffentlichen heißt Verändern (Carmen Thomas) +49/173/3264070 -- [email protected] -- http://www.aschemann.net
On 18. Jul 2020, at 20:15, Alexander Schwartz [email protected] wrote: I suppose this is due to the language injection for "bash" support. Some plugin of your IDE adds highlighting for the contents of the listing. Do you know what plugin you installed to support the "bash" language, so I can reproduce it locally?
I am using https://plugins.jetbrains.com/plugin/4230-bashsupport/ https://plugins.jetbrains.com/plugin/4230-bashsupport/ version 1.7.18.201
Looking at the listing with the callouts this is no valid shell script. Putting end-of-line comments in multiline shell statements is hard - see this stack overflow discussion https://stackoverflow.com/questions/9522631/how-to-put-a-line-comment-for-a-multi-line-command as an example.
Yes, it is not a valid shell script if you put it to a file. Written this way it allows to copy/paste it directly from IntelliJ or HTML (the callouts/comments then seem to be dropped) which was the main purpose to write it this way. I did not only try to use callouts here to enable a proper documentation of the options, but to also use attributes from AsciiDoctor to have a single source of truth for the used values (which enhances testing of the documentation).
Options that might be available in a future version of the plugin:
automatically exclude callouts from listings when when passing the contents to a different plugin for language highlighting (I'll have to see if this is possible). Usually code with callouts would still be valid code with comments, but not in this case. Would this mean the callouts would not be visible in the preview pane then? This would be contradictory to my requirements. Options that are available for you today:
rewrite the shell script to be a valid shell script despite the callouts
As said above, I was not trying to get a correct shell file but to enable copy/paste from the AsciiDoctor artifact.
disable showing errors for all code snippets in the AsciiDoc plugin settings (see below in screen shot) disable language injection for bash scripts (see below in screen shot) https://user-images.githubusercontent.com/3957921/87859031-94c97580-c932-11ea-8b60-7377da8fb8fe.png
Thanks, both seem to re-solve (or at least suppress) the error messages.
Regarding attribute references in listings for editor rename:
The plugin doesn't yet support attribute references in listings in the lexer and parser. Due to this it will not rename its occurrences in listings. I'll keep this ticket open as a reminder that this would be a helpful feature.
:+1:
Looks like this is a problem of AsciiDoctor itself (asciidoctor/asciidoctor#582)? Using the CLI for the HSC README I get:
asciidoctor: WARNING: README.adoc: line 44: no callout found for <1>
.
In this case it is a (valid) Groovy/Gradle snippet using subs="attributes"
).
The plugin version is 0.41.13.
reveals no callout found for <1>
.
Using this settings does not help.
Dropping the subs="attributes"
solves the problem (but leaves me with an unresolved attribute then).