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
355 stars 145 forks source link

A list of links with custom markers doesn't fold properly #384

Closed ggrossetie closed 4 years ago

ggrossetie commented 4 years ago
= Training

== First section

[square]
* https://asciidoctor.org/

== Second section

Content

Yes it's a really specific bug! See the gif:

fold-list-links

As you can see, "Second section" will be folded when the list contains only links and has custom markers.

AsciiDoc Plugin Version

0.30.30

IDE Name and Version

IntelliJ IDEA 2019.3.1 (Ultimate Edition)
Build #IU-193.5662.53, built on December 18, 2019
Runtime version: 11.0.5+10-b520.17 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-72-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: 
Non-Bundled Plugins: BashSupport, Batch Scripts Support, CMD Support, CheckStyle-IDEA, FindBugs-IDEA, JFormDesigner, PsiViewer, com.dmarcotte.handlebars, com.intellij.ideolog, com.jetbrains.lang.ejs, com.jetbrains.plugins.jade, com.wix.eslint, org.asciidoctor.intellij.asciidoc, org.intellij.scala, org.jetbrains.idea.grammar, org.jetbrains.plugins.slim, org.jetbrains.plugins.ruby
ahus1 commented 4 years ago

Thanks for reporting this. I'm not sure how to teach the parser to recognize these kind of block correctly. As I have now real clue how to detect the end of an enumeration properly, I'll fall back to disable folding of such cases for now.

ggrossetie commented 4 years ago

But it's working when the list contains at least one item which is not a link.

Having said that, it's not easy to detect the end of a list because you can have nested list and list continuation.

ahus1 commented 4 years ago

I've given it a try and some refactorings. Now an list terminates with a list item followed by a blank and something that is not a list item. It also handles continuations. This should handle most cases. I tested your example and some other edge cases. It will be part of the next release.

ggrossetie commented 4 years ago

Thank you @ahus1

ahus1 commented 4 years ago

Version 0.30.32 is now available as a pre-release that includes this change. Please comment here if there is something not working related to this issue and I will re-open the issue.

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