asciidoctor/asciidoctor-intellij-plugin

Explain one-sentence-per-line to user

Open

#315 opened on Aug 8, 2019

View on GitHub
 (1 comment) (1 reaction) (0 assignees)Java (155 forks)auto 404
enhancementgood first issue

Repository metrics

Stars
 (392 stars)
PR merge metrics
 (PR metrics pending)

Description

Situation

When a user re-formats the AsciiDoc source for the first time, she/he might be surprised by the on-sentence-per-line wrapping.

Suggestion

An editor notification like EditorNotificationPanel for "JCEF could be enabled" (JCEFCouldBeEnabledNotificationProvider) or could show the moment a user first triggers a re-format that performs a reformat of one-sentence-per-line.

It could link to the plugin's documentation site explaining why this might be a good thing and where to disable it.

(this issue was created after a user's feedback in #314)

Good First Issue

This issue is labeled "good first issue", and maintainers are willing to help. Please comment in this ticket to exchange ideas how this could be implemented. Feel free to pair up with a maintainer to help when you don't know where to start if when you're stuck.

Find out more about how to contribute at "Contribute as a coder" in the Contributor's guide.

Implementation Idea

  1. The method AsciiDocFormattingBlock.getSpacing() is the one responsible for one-sentence-per-line. When calling Spacing.createSpacing() to define the spaces that should be used, it can check at the same time the current spaces being present via ((AsciiDocFormattingBlock) child1).getNode().getTreeNext().

  2. To communicate this to the NotificationProvider, the simplest way would be to call a (static) method on the notification provider. See AsciiDocDownloadNotificationProvider.showNotification() for an example.

Contributor guide