asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
323 stars 97 forks source link

Provide inlay hints of attribute value #729

Open apupier opened 1 year ago

apupier commented 1 year ago

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

apupier commented 1 year ago

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?)

ggrossetie commented 1 year ago

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.