asciidoctor / asciidoctor-intellij-plugin

AsciiDoc plugin for products on the IntelliJ platform (IDEA, RubyMine, etc)
https://intellij-asciidoc-plugin.ahus1.de/
Apache License 2.0
345 stars 146 forks source link

Anotra playbook sourced from a wrong location #1293

Closed LukeCz closed 1 year ago

LukeCz commented 1 year ago

Observed vs. expected behavior

Hi, I found this by accident while investigating an issue similar to #1153 - plantuml is not rendered by Kroki in preview. It turned out that I do have 'kroki-fetch-diagram' defined but in yaml file that sits in an examples folder - see attached zip file. When I change it to false it all works. I was expecting the plugin to look for antora-playbook.yaml in the root folder only and not in a random place.

Steps to reproduce

  1. Open attached repo and go to index.adoc - the diagram is not rendered.
  2. Remove last line from antora-playbook-local.yml - the diagram is rendered.

Environment

Plugin Version: 0.38.10

IntelliJ Details: IntelliJ IDEA 2022.3.2 (Community Edition) Build #IC-223.8617.56, built on January 26, 2023 Runtime version: 17.0.5+1-b653.25 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 10 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 3006M Cores: 20 Non-Bundled Plugins: idea.plugin.protoeditor (223.8214.6) com.intellij.grazie.pro (0.3.202-223) org.asciidoctor.intellij.asciidoc (0.38.10)

Kotlin: 223-1.8.0-release-345-IJ8617.56

docs.zip

ahus1 commented 1 year ago

Thanks for raising this issue. I agree that a playbook from an examples folder shouldn't be picked up.

At the same time I see people placing them in other folders outside of the components, still accept if they are placed not in the root folder as long as they are placed outside of a component.

I'll see if I can tackle this in an upcoming release of the plugin, or if someone would volunteer for a PR here.

The method AsciiDocAntoraPlaybookIndex#getVirtualFiles() could have in its inner loop a check to call AsciiDocUtil.findAntoraModuleDir(project, fileBaseDir) to check if the file is part of a component, and then ignore it.

ahus1 commented 1 year ago

Fixed in upcoming release.

ahus1 commented 1 year ago

There's now pre-release 0.38.11 that includes this fix.

The pre-release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository.