asciidoctor-vscode icon indicating copy to clipboard operation
asciidoctor-vscode copied to clipboard

Provide inlay hints of attribute value

Open apupier opened this issue 2 years ago • 2 comments
trafficstars

it can be interesting to show the attribute value as inlay hint

apupier avatar Jun 19 '23 19:06 apupier

technical: regular expression to find attribute references: https://github.com/asciidoctor/asciidoctor/blob/be7356dafd3bdd82d9b515a59997da64f300eaf1/lib/asciidoctor/rx.rb#L153

Wondering in which measure it is possible that the Document "loaded" can provide the list of attribute reference (with their Range?)

apupier avatar Jul 03 '23 07:07 apupier

Wondering in which measure it is possible that the Document "loaded" can provide the list of attribute reference (with their Range?)

The parsing of inline content in Asciidoctor happens during rendering. In other words, the Asciidoctor AST/Document does not include "inline" nodes.

The AsciiDoc WG (as part of the specification) is currently working on closing this gap but for now using a regular expression is probably the right approach.

Attribute references/substitutions depend on the context:

:attribute-ref: a

{attribute-ref}

----
{attribute-ref}
----

[subs=+attributes]
----
{attribute-ref}
----

But we can ignore that for now.

ggrossetie avatar Jul 03 '23 21:07 ggrossetie