GithubHelp home page GithubHelp logo

abrookins / wraptocolumn Goto Github PK

View Code? Open in Web Editor NEW
59.0 3.0 12.0 7.64 MB

An IntelliJ plugin that wraps text

License: Apache License 2.0

Java 6.09% Kotlin 93.91%
intellij pycharm rubymine webstorm datagrip

wraptocolumn's Introduction

Wrap to Column: An IntelliJ Plugin That Wraps Text

This plugin wraps text to a maximum line width. It is intended as a replacement for the gq command in Vim and fill-paragraph in Emacs, which are both dear to my heart.

Supported IntelliJ Editors

This plugin should work in any IntelliJ editor, including IntelliJ IDEA Community, PyCharm, RubyMine, WebStorm, etc.

Editor Actions

This plugin adds two new actions to IntelliJ editors that you can use to wrap text:

  • Wrap Line to Column: Wraps selected text or the current line if no text is selected. This is useful for IdeaVim users who wish to pair the command with motions like vip (select current paragraph).

  • Wrap Paragraph to Column: Wraps all lines in the current paragraph. A paragraph is defined as text offset by blank lines -- including lines that only start with what looks like comment syntax (e.g., // ). Selected text is ignored (no selection is needed).

To learn how to you call these actions, read the __

Installing

Install the plugin from an IntelliJ editor (like IntelliJ Ultimate, PyCharm, etc.) inside the Preferences -> Plugins window.

From Within an IntelliJ Editor

Follow these steps to install this plugin from within an IntelliJ editor:

  • Open Preferences -> Plugins and click Marketplace
  • Search for "Wrap to column"
  • Choose Wrap to Column
  • Click Install
  • Restart the editor when prompted

From GitHub

To install the latest zip from GitHub:

  • Either clone the repository or download the latest release (https://github.com/abrookins/WrapToColumn/releases)
  • Open your IntelliJ editor of choice
  • Choose Preferences -> Plugins -> Install plugin from disk
  • Choose the WrapToColumn.zip (not the .jar file) file in the source checkout or your Downloads folder

How To Use the Plugin

To use this plugin, you trigger one of its actions (Wrap Line to Column, Wrap Paragraph to Column) with a keyboard shortcut, menu item, IdeaVim command, or using Search Everywhere.

Example usage:

To wrap the line you're currently editing, run the Wrap Line to Column action.

To wrap all of the lines in the paragraph that you are editing, run the Wrap Paragraph to Column action.

To wrap multiple lines and paragraphs in a file, select the text to wrap, then run the Wrap Line to Column action (this plugin wraps selected text).

Keyboard Shortcuts

The keyboard shortcuts for the Wrap Line to Column action are:

  • Mac: Command + Control + Shift + W
  • PC: Control + Alt + Shift + W

The keyboard shortcuts for the Wrap Paragraph to Column action are:

  • Mac: Command + Control + Shift + P
  • PC: Control + Alt + Shift + P

Feel free to change these in your keymap (Preferences -> Keymap) or IeaVim configuration file!

Menu Items

Menu items should exist for both commands in the Edit drop-down menu:

  • Edit -> Wrap Line to Column
  • Edit -> Wrap Paragraph to Column

IdeaVim

When using IdeaVim, you can invoke the above commands using the following actions:

  • Wrap Line to Column: com.andrewbrookins.idea.wrap.WrapAction
  • Wrap Paragraph to Column: com.andrewbrookins.idea.wrap.WrapParagraphAction

For example, you can add the following line to .ideavimrc to emulate Vim's gq command:

nmap gq :action com.andrewbrookins.idea.wrap.WrapAction<CR>

Settings

How Does WrapToColumn Determine the Line Length?

The maximum width of wrapped text is based on one of the following settings, in this order of priority:

  1. The "Right margin override" setting found in the Wrap to Column settings panel

  2. The right column setting configured for the language of the currently active editor tab

  3. The editor's default right column setting

Read Overriding the maximum line length in this README to learn how to set the right margin override setting for the WrapToColumn plugin.

Overriding the Maximum Line Length

By default, this plugin uses your configured global or language-specific right margin setting as the column width to wrap at. However, you may provide a column width that will override both of these settings.

This setting exists in Settings (Preferences on OS X) -> Tools -> Wrap to Column.

The setting is named Right margin override. This should be an integer that represents the column at which the plugin will wrap text, similar to IntelliJ's "right margin" setting.

Minimum Raggedness (Alpha!)

By default, text is wrapped using a greedy line-breaking algorithm. This can result in some lines having more whitespace than others.

You can turn on an alternative "minimum raggedness" algorithm in Settings -> Tools -> Wrap to Column. When this setting is on, the plugin will reconfigure text in a paragraph to produce the least amount of whitespace possible.

This feature is (still!) an alpha and may go away. Try it and see if you like it!

Tab Width Setting

Any lines that contain tabs (or are prefixed with tabs as an indent) will be reflowed as if the tabs were characters spaced using the tab size you have set in IntelliJ for the language you are editing.

This setting exists in the Code Style section of the IntelliJ settings page.

As a result of this behavior, text will look right to you if your tab width is 4, but not to your co-maintainer whose tab width is 8. This seems to be the best trade-off.

Monospaced Versus Variable Width Fonts

This plugin reflows selected text by assuming that each character takes one column's worth of space (except tabs, which are expanded to your tab width).

This works fine with monospaced fonts. However, if you use a variable-width font, which seems to be common for some languages like Chinese (see issue #11), then the individual glyphs of the font take up more than one column.

The plugin will still wrap your text to e.g. 80 characters wide, but the position won't match IntelliJ's right margin guide.

Anyway, I recommend that you use a monospaced font if you can.

Roadmap

  • Bug fixes

License

This plugin is licensed under the GPLv2 and Apache License 2.0. See COPYING.txt and LICENSE.txt.

wraptocolumn's People

Contributors

abrookins avatar edgarsi avatar rryk avatar viliam-durina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wraptocolumn's Issues

Javadoc asterisk prefix characters removed on paragraph format.

Executing the "Wrap paragraph to column" on Javadocs within a method appear to delete the javadoc line identifiers.

Example

Before

    @Override
    public boolean standardMethod(int number, String string) throws ServiceException {
        try {
            /** This section of code is to determine the standardMethod behavior as it relates to AwesomeFeature. The
             * {@link package#AwesomeFeature.Implementation#getAwesomeFeatureGetAuditCode(int, String)}
             * will perform varies checks to determine what the user is intending to do and which values those related
             * system variables are set to. If Awesome Feature is being attempted it will be reflected in the Reason Audit Code.
             * If Awesome Feature is being attempted, and the reason code returned from the determination method is {@link ReasonEnum#FT_SKIPPING}
             * the attempt was successful. {@link #standardMethod(int, String)} simply returns
             * FALSE, resulting in the RandomObject skipping the super inpsection work flow step (under the Awesome Feature feature). All other reason codes will result in the code dropping
             * down further into the method which will consider the olderButStillimportant feature.
             */

After

    @Override public boolean standardMethod(int number, String string) throws ServiceException { try { This section of
    code is to determine the standardMethod behavior as it relates to AwesomeFeature. The {@link
    package#AwesomeFeature.Implementation#getAwesomeFeatureGetAuditCode(int, String)} will perform varies checks to
    determine what the user is intending to do and which values those related system variables are set to. If Awesome
    Feature is being attempted it will be reflected in the Reason Audit Code. If Awesome Feature is being attempted, and
    the reason code returned from the determination method is {@link ReasonEnum#FT_SKIPPING} the attempt was successful.
    {@link #standardMethod(int, String)} simply returns FALSE, resulting in the RandomObject skipping the super
    inpsection work flow step (under the Awesome Feature feature). All other reason codes will result in the code
    dropping down further into the method which will consider the olderButStillimportant feature.
             */

Handling of sentence ending

Thank you for such an awesome tool! It satisfies basically all my need. But there might be a small problem with the space after a sentence ending. In both vim gq and emacs fill-paragraph, two spaces are automatically added after a sentence. For instance,

A sentence.
Another one.

would be wrapped into

A sentence.**Another one.

where *s are used emphasize spaces. It would be great if WrapToColumn could add support for this. This could make the plugin more vim/emacs-like and could be a great help for code bases with consistency requirement on this. For instance, Python PEP8 recommends this style of sentence spacing and it is used throughout its official code base.

Asterisk at start of line removed

I have a paragraph in markdown that looks like this:

Text blah blah blah (80 chars)
*some text meant to be italicized* etc.

Wrapping (both line and paragraph) removes the first asterisk.

Paragraphs in a comment string run together

If you wrap text that includes multiple paragraphs within a comment string, like this:

* One paragraph
*
* Another paragraph

The output is something like this:

* One paragraph Another paragraph

However, this works fine if the text has no comment indent portion (*).

nullPointerException

Interestingly, it works in the event log, but failed in the editor window. After a second restart, it worked ok.

Was editing a README.md

Installed v1.0.1 onto PyCharm CE 4.5.4 (OS X/El Cap)

Restarted

Clicked in editor window to be sure focus was correct.

Pressed cmd-ctrl-shft-w

Got:

null
java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
at java.util.regex.Matcher.reset(Matcher.java:291)
at java.util.regex.Matcher.(Matcher.java:211)
at java.util.regex.Pattern.matcher(Pattern.java:888)
at com.andrewbrookins.idea.wrap.CodeWrapper.wrap(CodeWrapper.java:80)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler$1.run(WrapAction.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler.execute(WrapAction.java:37)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doExecute(EditorActionHandler.java:172)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$4.perform(EditorActionHandler.java:217)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:109)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:214)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:98)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:109)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:83)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:593)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:644)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:483)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:213)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
at java.util.regex.Matcher.reset(Matcher.java:291)
at java.util.regex.Matcher.(Matcher.java:211)
at java.util.regex.Pattern.matcher(Pattern.java:888)
at com.andrewbrookins.idea.wrap.CodeWrapper.wrap(CodeWrapper.java:80)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler$1.run(WrapAction.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler.execute(WrapAction.java:37)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doExecute(EditorActionHandler.java:172)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$4.perform(EditorActionHandler.java:217)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:109)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:214)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:98)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:109)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:83)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:593)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:644)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:483)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:213)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
at java.util.regex.Matcher.reset(Matcher.java:291)
at java.util.regex.Matcher.(Matcher.java:211)
at java.util.regex.Pattern.matcher(Pattern.java:888)
at com.andrewbrookins.idea.wrap.CodeWrapper.wrap(CodeWrapper.java:80)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler$1.run(WrapAction.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler.execute(WrapAction.java:37)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doExecute(EditorActionHandler.java:172)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$4.perform(EditorActionHandler.java:217)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:109)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:214)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:98)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:109)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:83)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:593)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:644)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:483)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:213)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
at java.util.regex.Matcher.reset(Matcher.java:291)
at java.util.regex.Matcher.(Matcher.java:211)
at java.util.regex.Pattern.matcher(Pattern.java:888)
at com.andrewbrookins.idea.wrap.CodeWrapper.wrap(CodeWrapper.java:80)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler$1.run(WrapAction.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler.execute(WrapAction.java:37)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doExecute(EditorActionHandler.java:172)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$4.perform(EditorActionHandler.java:217)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:109)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:214)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:98)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:109)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:83)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:593)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:644)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:483)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:213)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
at java.util.regex.Matcher.reset(Matcher.java:291)
at java.util.regex.Matcher.(Matcher.java:211)
at java.util.regex.Pattern.matcher(Pattern.java:888)
at com.andrewbrookins.idea.wrap.CodeWrapper.wrap(CodeWrapper.java:80)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler$1.run(WrapAction.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler.execute(WrapAction.java:37)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doExecute(EditorActionHandler.java:172)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$4.perform(EditorActionHandler.java:217)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:109)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:214)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:98)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:109)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:83)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:593)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:644)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:483)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:213)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
at java.util.regex.Matcher.reset(Matcher.java:291)
at java.util.regex.Matcher.(Matcher.java:211)
at java.util.regex.Pattern.matcher(Pattern.java:888)
at com.andrewbrookins.idea.wrap.CodeWrapper.wrap(CodeWrapper.java:80)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler$1.run(WrapAction.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler.execute(WrapAction.java:37)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doExecute(EditorActionHandler.java:172)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$4.perform(EditorActionHandler.java:217)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:109)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:214)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:98)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:109)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:83)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:593)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:644)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:483)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:213)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
at java.util.regex.Matcher.reset(Matcher.java:291)
at java.util.regex.Matcher.(Matcher.java:211)
at java.util.regex.Pattern.matcher(Pattern.java:888)
at com.andrewbrookins.idea.wrap.CodeWrapper.wrap(CodeWrapper.java:80)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler$1.run(WrapAction.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler.execute(WrapAction.java:37)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doExecute(EditorActionHandler.java:172)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$4.perform(EditorActionHandler.java:217)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:109)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:214)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:98)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:109)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:83)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:593)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:644)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:483)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:213)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
at java.util.regex.Matcher.reset(Matcher.java:291)
at java.util.regex.Matcher.(Matcher.java:211)
at java.util.regex.Pattern.matcher(Pattern.java:888)
at com.andrewbrookins.idea.wrap.CodeWrapper.wrap(CodeWrapper.java:80)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler$1.run(WrapAction.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler.execute(WrapAction.java:37)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doExecute(EditorActionHandler.java:172)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$4.perform(EditorActionHandler.java:217)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:109)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:214)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:98)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:109)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:83)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:593)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:644)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:483)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:213)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Version 1.8.0 is not listed as a GitHub release

Thanks for the plugin.

IntelliJ reports that 1.8.0 is the latest version, but this GitHub repo shows 1.7.0 at the latest version. Having 1.8.0 listed as a release on GitHub would be helpful in some situations. For example, I'm curious as to what changed in 1.8.0 and whether some strange behavior I'm seeing might be a bug in this plugin. Thank you. 🙂

Select and wrap multiple paragraphs?

First of all, thanks for making such a great plugin to fill the gaps!

A common need of mine is to select multiple paragraphs and wrap them. For example, when you copy a large body of text from somewhere and use them as comment. Is there a way to wrap multiple paragraphs? Thanks!

Selecting a blank line as part of the block to wrap inserts a bad space into the result

To reproduce:

  • Select a block of text to rewrap
  • Increase your selection to include a blank line above the block

E.g.:

My block of text. My block of text. My block of text. My block of text. My block of text. My block of text.

Expected result:

My block of text. My block of text. My block of text. My block of text. My block
of text. My block of text.

(wrapped to 80 columns)

Actual result if blank line is included in selection:

My block of text. My block of text. My block of text. My block of text. My
block of text. My block of text.

(Note the leading space.)

Define multiple line lengths in settings and cycle through them with multiple hotkey presses

The situation I'm in is that I have code comments where some are wrapped to 100 columns and others are wrapped to 80 columns. Both lengths show up in the same project. I want to add some text to a comment and re-wrap it, but if my line length override isn't set up to match the comment I happen to be changing at that time, I can't do it using this plugin without going back to the settings. 🙁 I end up wrapping manually sometimes.

I'm used to the way VS Code plugin Rewrap handles this: https://stkb.github.io/Rewrap/configuration/#wrapping-column. There, I can define multiple "rulers" (right margins, or visual guides) and swap between them by pressing the wrap hotkey multiple times. Then it remembers the "current" margin for that file for the next time I press the hotkey.

Wrong wrapping of markdown list items at higher levels

In markdown, wrapping paragraphs works great for list items at the first level.

However, at higher levels it behaves strangely and removes some text from the start.

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dapibus massa. Ut feugiat risus ut neque facilisis, faucibus tempus est posuere.
  - Donec finibus in mi at imperdiet. In hac habitasse platea dictumst.

--> "Wrap Paragraph" with the cursor on the "Donec..." line results in:

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dapibus massa. Ut feugiat risus ut neque facilisis, faucibus tempus est posuere.
  - nec finibus in mi at imperdiet. In hac habitasse platea dictumst.

If you first format the Lorem ... line (which works correctly):

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dapibus massa. Ut feugiat
  risus ut neque facilisis, faucibus tempus est posuere.
  - Donec finibus in mi at imperdiet. In hac habitasse platea dictumst.

and then the "Donec..." line, you get the following (also wrong):

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dapibus massa. Ut feugiat
  risus ut neque facilisis, faucibus tempus est posuere. - Donec finibus in mi at imperdiet. In hac
  habitasse platea dictumst.

Wrap to Column keymap used in Refactor->Rename dialog

When I put the caret on a variable name and run the Refactor->Rename action (Alt-Shift-R by default), I cannot type the letter 'g', because it's finding the 'G,W' keymap to Wrap to Column and preventing it. In the bottom notification bar, I see the notification, "Prefix Key Pressed. Wrap to Column (W)".

This is on PyCharm 5.0.3 with Wrap to Column plugin 1.3.1 on Ubuntu 14.04 LTS. Also noting, in case it's relevant, that I'm using IdeaVIM plugin 0.44.

Invalid state: project settings exist but not loaded yet. The call may cause settings damage.

Issue:

After upgrading IDEA to 2021.1.3 or perhaps one of the earlier 2021 versions, I'm receiving the following exception upon the first attempt to wrap something. The wrap still works as expected and I just have to close the error message about the exception but there still seems to be a minor problem with the plugin. The exception only happens on the first use after opening the IDE but the msg that says "The call may cause settings damage." is a bit concerning.

Any ideas? Let me know if I should provide anything else. Thanks in advance.

Exception:

java.lang.Throwable: Invalid state: project settings exist but not loaded yet. The call may cause settings damage.
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:161)
	at com.intellij.psi.codeStyle.ProjectCodeStyleSettingsManager.checkState(ProjectCodeStyleSettingsManager.java:153)
	at com.intellij.psi.codeStyle.CodeStyleSettingsManager.getCurrentSettings(CodeStyleSettingsManager.java:217)
	at com.intellij.application.options.CodeStyle.getSettings(CodeStyle.java:55)
	at com.intellij.application.options.CodeStyle.getProjectOrDefaultSettings(CodeStyle.java:66)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl$1.documentChanged(FileDocumentManagerImpl.java:113)
	at com.intellij.openapi.editor.impl.DocumentImpl.changedUpdate(DocumentImpl.java:916)
	at com.intellij.openapi.editor.impl.DocumentImpl.updateText(DocumentImpl.java:820)
	at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:660)
	at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:597)
	at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler$execute$1.run(WrapAction.kt:48)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:959)
	at com.andrewbrookins.idea.wrap.WrapAction$WrapHandler.execute(WrapAction.kt:26)
	at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doExecute(EditorActionHandler.java:161)
	at com.intellij.openapi.editor.actionSystem.DynamicEditorActionHandler.doExecute(DynamicEditorActionHandler.java:52)
	at com.intellij.openapi.editor.actionSystem.EditorActionHandler.lambda$execute$4(EditorActionHandler.java:199)
	at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:89)
	at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:198)
	at com.intellij.openapi.editor.actionSystem.EditorAction.lambda$actionPerformed$0(EditorAction.java:89)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:216)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:172)
	at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:98)
	at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:73)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAware$5(ActionUtil.java:273)
	at com.intellij.util.SlowOperations.lambda$allowSlowOperations$0(SlowOperations.java:77)
	at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:64)
	at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:76)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:273)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:616)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$processAction$3(IdeKeyEventDispatcher.java:676)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:675)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:626)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:486)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:481)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:232)
	at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:889)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:833)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:808)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:502)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

stop paragraph wrapping also when syntax changes

At present the plugin detects the end of a paragraph by an empty line. However, in Go, the documentation of a declaration (type, func, etc.) must precede the declaration with no empty line in-between for the documentation tool to work properly. So, given this input and assuming the cursor is in the comment:

// Hello prints hello world.
func Hello() {
	fmt.Println("hello world")
}

It will be wrapped as one paragraph into:

// Hello prints hello world. func Hello() { fmt.Println("hello world") }

Would it be possible to stop a paragraph when the syntax changes? This will avoid taking the code with it. Thank you!

Tested on: CLion 2017.1.1

Unable to run version 1.3 with IntelliJ 14.1.6 on Mac

When I invoke the keyboard shortcut, I see the following error in the IntelliJ console:
7:32:58 PM NoClassDefFoundError: kotlin/jvm/internal/Intrinsics

Perhaps version 1.3 only compatible with IntelliJ 15? Thanks.

Inconsistent text width using minimum raggedness algorithm

I get different paragraph widths, sometimes dramatically different, within the same source file. This appears to occur only when using the minimum raggedness algorithm.

Screenshots of the inconsistent behavior between the two algorithms are attached. In case it is relevant, I have set visual markers at 80 characters and at 100 characters, and I have it set to hard wrap at 100 characters.

I hate to suggest this, especially given my own personal inclinations, but... As interesting as the SMAWK algorithm is, in practice it is likely to provide an advantage only in the most esoteric applications none of which are likely to be realizable within IntelliJ. The simplest dynamic programming algorithm, despite its O(n^2) asymptotic running time, is simpler, shorter, and likely runs faster for any given input it will ever see as an IntelliJ plugin.

Not that I'm criticizing. I totally would have implemented SMAWK, too! My point is only that, from the perspective of maintenance, bug squashing, and checking correctness, it might be worth swapping it out for the simple undergraduate version.

Thank you for such a useful plugin!

Screen Shot 2020-06-20 at 1 29 02 AM

Screen Shot 2020-06-20 at 1 30 20 AM

Bug: PHP line following series of line comments becomes commented out

Given:

            // Limiting to the current user so we do not subquery chatbot fields on _all_ users'
            // chatbot+ fields.
            $sub_query->condition('entity_id', $this->currentUser->id());

with cursor in the first line (or anywhere in the commented lines), invoke the Wrap Paragraph to Column function.

Expected:

            // Limiting to the current user so we do not subquery chatbot fields
            // on _all_ users' chatbot+ fields.
            $sub_query->condition('entity_id', $this->currentUser->id());

Instead:

            // Limiting to the current user so we do not subquery chatbot fields
            // on _all_ users' chatbot+ fields.
            // $sub_query->condition('entity_id', $this->currentUser->id());

Can strip text that looks like a comment symbol

STR

/**
 * Let's provide a javadoc comment the has a link to some method, e.g. {@link #m()}.
 */
public class WrapToColumn {

    public static void m() { }
}

Select line 02 (" * Let's provide..."), then Action "Wrap to Column".

Result:

/**
 * Let's provide a javadoc comment the has a link to some method, e.g. {@link
 * m()}.
 */
public class WrapToColumn {

    public static void m() { }
}

It removes "#" from inside the @link tag, breaking the javadoc.

Can "Wrap Line to Column" end with no selection if it began with no selection?

The current behavior is it will leave the wrapped text of the original line selected, ripe for accidental overwriting on subsequent typing. This behavior also seems counterintuitive given the command's name because the name does not suggest the resulting text will always be selected.

For your consideration. Thank you!

WrapAction does not respect hard wrap setting

Thanks for fixing #40!

As of version 1.6.0-SNAPSHOT, the WrapAction no longer respects the "Hard wrap at" setting. I'm not sure if the fix for #40 broke this, or if it was some other change.

Example

Both comment paragraphs had the WrapAction applied to them. The vertical line is at the 80-character hard wrap limit.

image

Settings

image

IDE version

Screen Shot 2021-08-10 at 3 31 36 PM

IDEA 2021.2 (Ultimate Edition) causing java.lang.ClassNotFoundException

Hi. Thanks so much for your plugin. It's great. Unfortunately I get this error after upgrading IDEA:

Plugin 'com.andrewbrookins.wrap_to_column' failed to initialize and will be disabled. Please restart IntelliJ IDEA.

Thanks.

IDEA version

IntelliJ IDEA 2021.2 (Ultimate Edition)
Build #IU-212.4746.92, built on July 27, 2021
Runtime version: 11.0.11+9-b1504.13 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: toolwindow.active.tab.contrast.background.color=255,255,255, debugger.watches.in.variables=false
Non-Bundled Plugins: Statistic (4.1.7), org.jetbrains.plugins.localization (212.4746.57), org.toml.lang (0.2.151.3997-212), Pythonid (212.4746.92), R4Intellij (212.4535.4), ru.adelf.idea.dotenv (2021.2.212)
Kotlin: 212-1.5.10-release-IJ4746.92

stack trace

Plugin 'com.andrewbrookins.wrap_to_column' failed to initialize and will be disabled. Please restart IntelliJ IDEA.

java.lang.ClassNotFoundException: com.andrewbrookins.idea.wrap.config.WrapSettingsProvider
         PluginClassLoader(plugin=PluginDescriptor(name=Wrap to Column, id=com.andrewbrookins.wrap_to_column, descriptorPath=plugin.xml, path=~/Library/Application Support/JetBrains/IntelliJIdea2021.2/plugins/WrapToColumn, version=1.4.0, package=null), packagePrefix=null, instanceId=14, state=active)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:254)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    at com.intellij.serviceContainer.ComponentManagerImpl.registerComponent(ComponentManagerImpl.kt:441)
    at com.intellij.serviceContainer.ComponentManagerImpl.registerComponents(ComponentManagerImpl.kt:380)
    at com.intellij.serviceContainer.ComponentManagerImpl.access$registerComponents(ComponentManagerImpl.kt:58)
    at com.intellij.serviceContainer.ComponentManagerImpl.registerComponents(ComponentManagerImpl.kt:255)
    at com.intellij.openapi.client.ClientAwareComponentManager.registerComponents(ClientAwareComponentManager.kt:63)
    at com.intellij.idea.ApplicationLoader$initApplication$2$1.accept(ApplicationLoader.kt:77)
    at com.intellij.idea.ApplicationLoader$initApplication$2$1.accept(ApplicationLoader.kt)
    at java.base/java.util.concurrent.CompletableFuture.uniAcceptNow(CompletableFuture.java:753)
    at java.base/java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:731)
    at java.base/java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2108)
    at com.intellij.idea.ApplicationLoader$initApplication$2.apply(ApplicationLoader.kt:75)
    at com.intellij.idea.ApplicationLoader$initApplication$2.apply(ApplicationLoader.kt)
    at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
    at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
    at com.intellij.idea.ApplicationLoader$initApplication$3.execute(ApplicationLoader.kt:107)
    at java.base/java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:568)
    at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1069)
    at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
    at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1742)
    at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1728)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

Wrap text in blockquotes in markdown

Thanks for this plugin.

It would be great if it would preserve block quotes in markdown.

Currently this:

> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dapibus massa. Ut feugiat risus ut neque 
> facilisis, faucibus tempus est posuere. Donec finibus in mi at imperdiet. In hac habitasse platea dictumst. 
> Vivamus et tincidunt nibh, at rhoncus nulla. Morbi ut urna tristique, maximus enim ac, hendrerit lacus. Quisque 
> ut dictum nibh. Nulla placerat, ipsum rhoncus bibendum fermentum, massa elit fringilla augue, in ullamcorper leo 
> lacus eget mi. Etiam diam augue, blandit luctus justo eu, faucibus pellentesque massa. Sed dapibus varius rhoncus. 
> Nunc rutrum justo in pretium gravida. Donec eget tincidunt lacus. Cras eget leo suscipit, tincidunt dui sed, dictum 
> massa. Morbi tellus nibh, rutrum id consectetur vitae, laoreet ac dolor.

gets reformatted to this:

> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dapibus massa. Ut feugiat
risus ut neque > facilisis, faucibus tempus est posuere. Donec finibus in mi at imperdiet. In hac
habitasse platea dictumst. > Vivamus et tincidunt nibh, at rhoncus nulla. Morbi ut urna tristique,
maximus enim ac, hendrerit lacus. Quisque > ut dictum nibh. Nulla placerat, ipsum rhoncus bibendum
fermentum, massa elit fringilla augue, in ullamcorper leo > lacus eget mi. Etiam diam augue, blandit
luctus justo eu, faucibus pellentesque massa. Sed dapibus varius rhoncus. > Nunc rutrum justo in
pretium gravida. Donec eget tincidunt lacus. Cras eget leo suscipit, tincidunt dui sed, dictum >
massa. Morbi tellus nibh, rutrum id consectetur vitae, laoreet ac dolor.

The blockquotes should be preserved.

It should for multiple levels of nested blockquotes.

Extra spaces added even when lines include trailing space

Given the following (where indicates a space):

The⋅quick⋅brown⋅fox⋅
jumps⋅over⋅the⋅lazy⋅
dog

I'd expect:

The⋅quick⋅brown⋅fox⋅jumps⋅over⋅the⋅lazy⋅dog

But I get:

The⋅quick⋅brown⋅fox⋅⋅jumps⋅over⋅the⋅lazy⋅⋅dog

Ideally, one might even collapse extra end-of-line space, so that:

The⋅quick⋅brown⋅fox⋅⋅⋅⋅⋅⋅⋅
jumps⋅over⋅the⋅lazy⋅⋅⋅⋅⋅⋅
dog
           ↓

The⋅quick⋅brown⋅fox⋅jumps⋅over⋅the⋅lazy⋅dog

instead of

The⋅quick⋅brown⋅fox⋅⋅⋅⋅⋅⋅⋅⋅jumps⋅over⋅the⋅lazy⋅⋅⋅⋅⋅⋅⋅dog

but I'd settle for not adding extra.

Can wrap be more 'fill-paragraph' like

I use WrapToColumn in both IDEA and PyCharm. It is incredibly helpful so thank you. And thank you in advance for the work you are planning to do on MarkDown, as I use it primarily on MarkDown text.

Currently, I need to highlight all of the lines I want to wrap.
I was wondering if you would consider making it operate more like 'fill-paragraph' or adding an additional wrapping method called "Fill Paragraph" that would wrap all of the lines in the paragraph containing the current cursor.

Thanks.

Ignore non-comments

Any adjacent lines of code are grouped together with the comment paragraph. This should only work for comments.

Originally I made this ticket to ignore the shebang line, but then I realized it groups everything, comment or not.

Incorrect text wrapping on markdown-like text

PHPStorm 10.0.2

I have the following (shorten) bit of text, which doesn't appear to wrap properly.

Given

Installation
============

Requirements
------------

After applying Wrap to column with a setting of 80, I get

Installation ============

Requirements ------------

Use single HTML tag as paragraph break for javadoc

We use this style of javadoc comments:

/**
 * Paragraph1.
 * <p>
 * Paragraph2.
 */

Reformatting this gives us:

/**
 * Paragraph1. <p> Paragraph2.
 */

It would be nice if sole <p> (or more generally sole HTML tag or tags) will be treated as paragraph break. This style is also used in JDK (see java.lang.String, for example).

Wrapping a long bullet line does not include a leading indent on wrapped lines

If you wrap a line like the following to 80 columns:

. My long bullet line. My long bullet line. My long bullet line. My long bullet line.

The result should appear like it does in Vim:

. My long bullet line. My long bullet line. My long bullet line. My long bullet
  line.

What you actually get is this:

. My long bullet line. My long bullet line. My long bullet line. My long bullet
line.

Support for strings (Python / Jinja2)

Thanks for the plugin. This is exactly what I was looking for.
But one feature is currently missing (or at least not working for me) if I use it for python files. If I have a long string and use "wrap to column", the string is not wrapped correctly (" or ' is missing).

This is what is happening for: 'test1 test2 test3 test4 test5 test6 test7 test8 test9'

AS-IS:
'test1 test2 test3 test4 test5
test6 test7 test8 test9'

TO-BE:
'test1 test2 test3 test4 test5'
'test6 test7 test8 test9'

Thanks again and regards!

Wrap TODOs in the format JetBrains syntax highlighting expects

This is a weird one, but after several years of usage, I only just now realized that if you have a TODO like this:

TODO: Check for null values before subtracting the Bitcoin
payment on the blockchain - derp!

JetBrains only highlights (in bold, or whatever your color scheme uses) the first line. But if you do this:

TODO: Check for null values before subtracting the Bitcoin
 payment on the blockchain - derp!

They both get highlighted! If you can't see the difference, there's a one-character indent on subsequent lines. If indented thus, the lines are syntax-highlighted as part of the TODO comment.

I envision this as an opt-out change with a configuration parameter (i.e. a new parameter switched on, that you can turn off).

Wrap markdown and (markdown in) YAML

I would like to wrap paragraphs (and list items) in markdown files.

I would also like to do this in YAML files, for example:

openapi: 3.0.2
info:
  version: 0.13.4
  title: My API
  description: |
    
    # Introduction
    
    This is a
    paragraph I would
    like to wrap.

    * This is a point
      I would like to wrap
    * This is another point
      that should be counted as its own paragraph

Selecting a partial line without the indent results in inconsistent final indentation.

Thanks for this plugin! It's quite needed. I just noticed one minor potential improvement:

Suppose I have the following

  # This is a line. This is a line. This is a line. This is a line. This is a line.
  # This is a second line.

The indentation depends on whether I select the first whole line or not. Suppose I use the default caret position from the editor and select from the end of the first indent and the whole second line, then the following occurs:

  # This is a line. This is a line. This is a line. This is a line. This is a
# line. This is a second line.

If i take extra care to select the whole first line, I get the correct result:

  # This is a line. This is a line. This is a line. This is a line. This is a
  # line. This is a second line.

Not sure if there's a case where we'd want the first behavior, but maybe the right thing to do is just to indent everything to the level of the first line. (Check emacs/vim source?)

Markdown blockquote syntax is incorrectly wrapped

Wrapping long blockquote does not insert new > pair

Suppose you have this text as a single line

> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation 

and wrap it. You get:

> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation

The desired result is that each new line should be preceded by the > pair, to preserve the blockquote, like so:

> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
> tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
> quis nostrud exercitation

Re-wrapping paragraph does not preserve blockquote > pair at start of line

Suppose you have this text as multiple lines

> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
> magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation

and wrap it. You get:

> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore > magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation

The start-of-line > pair is now in the middle of the line, and as before, new pairs are not inserted.

Missing Kotlin/StringsKit

Just installed the plugin to the latest version of pycharm using install from disk on the WrapToColumn.jar. I get this error when I try to wrap to column:

8/2/16
10:55 AM    NoClassDefFoundError: kotlin/StringsKt

I see the kotlin-runtime.jar in the WrapToColumn distribution, but there was no indication of what to do with it. Does it have to be installed somewhere?

Thanks.

Comments: Lines end up a bit too short, depending on comment style

I have the right margin (default) set to 120. In JS files, I noticed that the plugin wraps lines at different lengths, depending on the comment style.

  • Line comments (//):
    lines are wrapped if they exceed 117 characters.

  • Single-line, JSDoc-style comments (/** lorem ipsum */):
    wrapped if exceeding 116 characters (total, including end delimiter of comment).

  • Multi-line block comments:

    /**
    * Lorem ipsum ..
    */

    Wrapped if exceeding 118 characters.

In unrelated news, thanks for your super-helpful plugin! :)

Doesn't take tab width into account

I use tabs in Java, and I have the tab-width set to 4 in my settings. Wrap to column doesn't respect this and wraps past the end of the right margin. Not sure if it's considering tabs as 1 character or two, though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.