Open frkd-dev opened 1 month ago
As I'm thinking more on the problem I'm inclining towards an idea this is not the AsciiDoc plugin issue. Leading spaces have special meaning in AsciiDoc and the plugin correctly ensures to not have them unintentionally.
On another hand perhaps AsciiDoc plugin doesn't return enough info for the IDE's wrapping engine so it could be considered to change the wrapping strategy?
Observed vs. expected behavior
When "Enable AsciiDoc formatting" option is enabled along with with "Wrap on typing", this breaks IDE's wrapping engine as it wraps lines incorrectly by producing lines with 2-5 words per each. The resulting text looks heavily chopped.
https://github.com/user-attachments/assets/34aade46-cacc-4d28-b37d-d203b7260f9c
Disabling "AsciiDoc formatting" makes wrapping to work fine again.
https://github.com/user-attachments/assets/f542d51b-cab5-4b97-a05a-6ecb5e5f0f53
After hours of debugging and experiments I ended up with the fact that IDE's wrapper engine expects either a space character at the end of the current line or at the beginning of the next one.
Interestingly, IDE's wrapper inconsistent on decisions where to put a space character: sometimes it remains on the end of the current line, sometimes it appears at the beginning of the next one. In cases when wrapper adds it to the beginning of the next line, the AsciiDoc plugin seemingly trims it. Once this happens, the wrapper doesn't work as expected and produces very short lines.
Steps to reproduce
Enable both options "Wrap on typing" and "AsciiDoc formatting" in code style settings and try add extra spaces to the following text:
Environment
Plugin Version: 0.42.2
IntelliJ Details: CLion 2024.1.4 Build #CL-241.18034.45, built on June 18, 2024 Licensed to *** Subscription is active until July 23, 2024. Runtime version: 17.0.11+1-b1207.24 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 14.4.1 .NET Core v8.0.1 ARM64 (Server GC) GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 12 Metal Rendering is ON Registry: actionSystem.update.actions.warn.dataRules.on.edt=false debugger.attach.dialog.enabled=true run.processes.with.pty=TRUE ide.experimental.ui=true ide.slow.operations.assertion=false Non-Bundled Plugins: commit-prefix-plugin (1.3.0) org.asciidoctor.intellij.asciidoc (0.42.2) PlantUML integration (7.10.1-IJ2023.2) zielu.gittoolbox (500.2.10+233) org.editorconfig.editorconfigjetbrains (241.14494.150) com.jfrog.conan.clion (2.0.4) org.sonarlint.idea (10.7.0.78874)