Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hard line breaks at configured column #137

Closed
matthewadams opened this issue Aug 23, 2016 · 6 comments
Closed

Add hard line breaks at configured column #137

matthewadams opened this issue Aug 23, 2016 · 6 comments

Comments

@matthewadams
Copy link

Add a togglable setting for Insert line break at column [ 80 ] (where [ 80 ] is a text box). In the editor, display a margin at the configured column and automatically reformat text while typing to ensure lines are no longer than the configured line length, and, optionally, so that artificially truncated lines are untruncated and reformatted.

AsciiDoc Plugin Version: 0.14.3

IDE Name and Version: WebStorm 2016.2.2
Build #WS-162.1628.41, built on August 16, 2016
Licensed to SciSpike / Matthew Adams
Subscription is active until March 15, 2017
For educational use only.
JRE: 1.8.0_76-release-b216 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

@ahus1
Copy link
Contributor

ahus1 commented Sep 4, 2016

Hello Matthew,

thanks for sharing. Do you know another open source IntelliJ plugin that does this so I can have a look how this might work?

We're doing something different in my current project: we use one sentence per line. This leads to long lines, but creates very nice-looking diffs. If we would reformat the lines to break at 80 characters, this would leads to very strange looking diffs as an added word could re-wrap a whole paragraph.

I hear that one line per sentence is not uncommon in the asciidoc community.

This works very well with IntelliJ's settings of "Use soft wraps in editor" and "Use original line's indent for wrapped parts".

Please give it a try and let me know what you think.

Regrads,
Alexander

@mojavelinux
Copy link
Member

While I'm not against adding this feature, understand that I strongly recommend against hard wrapping at a fixed column width. It allows minor changes to cause disproportionally-sized diffs and it takes the focus off the writing. I'm a strong proponent of the sentence-per-line style. It not only reinforces good writing habits, it also makes writers more efficient.

Of course, no wrapping at all is bad because it causes horizontal scrolling that makes the source hard to scan. That's why I use soft wrapping with line numbers enabled. The line numbers give me a clear indication where a line begins.

@matthewadams
Copy link
Author

I created this issue while reviewing existing asciidoc source, which I found tough to navigate due to the horizontal scrolling. However, since that time, I've authored a substantial amount of asciidoc and agree that inserting hard line breaks make for more difficult change tracking.

You might just leave this issue open and see if anyone else wants the feature. I prefer your suggestion of having the IDE insert soft breaks, which makes reading better, while using one sentence per line, which makes diffs easier to read.

@ahus1
Copy link
Contributor

ahus1 commented Sep 9, 2016

Hello Matthew,

thanks for sharing. I think at the minimum a "best practices" section about soft line wraps in the docs of the plugin could help. Maybe it is possible to have soft line wraps as default within the plugin independent of the settings in the general config - but I don't know if this is possible.

Best regards,
Alexander

@ahus1
Copy link
Contributor

ahus1 commented Oct 13, 2018

As part of #221 there will be a toolbar icon to toggle soft wraps. This is a gradual improvement for this issue.

@ahus1
Copy link
Contributor

ahus1 commented May 10, 2019

In the most recent IntelliJ versions you can enable soft-wrap per file type (see sceen shot). Therefore everyone using AsciiDoc can enable softwrap for all Asciidoc files as default - or use the per-editor-toggle in the toolbar.

I hope this solution works for most of you; I close this ticket. Please see a screenshot where to find the setting (and to setup the filter) below.

softwap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants