5

PHPStorm has a vertical line on what they call the "right margin" which is set by default to 120 characters or columns...

Given that PSR standards state There MUST NOT be a hard limit on line length; the soft limit MUST be 120 characters; lines SHOULD be 80 characters or less., it'd be nice if I could get another visual indicator at the 80 character mark...

I'm well aware that it says what line/column you're on in the status bar, but I typically hide most panels (status bar included) while coding.

Therefore, is there a way (feature or plugin) that would allow me to add a 2nd vertical line to indicate the 80th column?

RST
  • 3,899
  • 2
  • 20
  • 33
user1960364
  • 1,951
  • 6
  • 28
  • 47
  • Not about this question: take a look here: http://regex101.com/r/cF0qX6/4 and here: http://stackoverflow.com/questions/22912915/preg-replace-callback-with-spoilers-into-spoilers/22913219#22913219 – Casimir et Hippolyte Nov 07 '14 at 16:07
  • @CasimiretHippolyte Un-deleted the question if you wish to post there. :) Thanks – user1960364 Nov 08 '14 at 05:10

3 Answers3

3

It is not currently possible .. and no plugin comes into my mind.

https://youtrack.jetbrains.com/issue/IDEA-99875 -- star/vote/comment to get notified on progress.

P.S. Considering that this is rather PHP/Python specific (other languages do not care about this) .. I would not expect JB to have it implemented in nearest future...

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • 1
    Considering PHPStorm is packaged for PHP development, I would think it'd be a strong point to push. – user1960364 Nov 08 '14 at 05:11
  • @user1960364 Considering that this ticket is located in platform-wide tracker (a feature that affects ALL possible IDEs)... that's not strong enough point for PhpStorm alone, which represents relatively small subset of supported languages compared to IntelliJ. – LazyOne Nov 08 '14 at 11:38
1

I suggest the following workaround, it works for me on PhpStorm 9.0:

  1. Open Settings page (usually Ctrl+Alt+S), go to Plugins -> Browse Repositories
  2. Find and install BackgroundImage plugin
  3. Restart IDE, it may output an error, something like "unknown protocol d" - don't worry, go forth
  4. Make an image with height=1px, and width=(desired width of additional margin). Give it, say, white background and paint one rightmost pixel to say, black. I took a screenshot of an editor and cropped it in PS, to avoid annoying search and adjustment of the image width. Every change of background image requires to restart PhpStorm.
  5. Open Settings again, goto Other settings -> BackgroundImage
  6. Set Enabled checkbox, browse your created image, and check the FileSystem radio button
  7. Restart IDE again and change the margin and you will get two margins

The image is left-aligned, so when you resize an editor on x-axis (move the splitter between Editor and Project View or File System View, etc.), the margin will remain truthy. Some side-effects - it appears also on console window, event log, perhaps somewhere else.

If the plugin doesn't work, check out this page (there said that most JetBrains plugins should work on all products on IntelliJ Platform, and some workaround if they does not): http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html

ADDED: Doesn't work with scaling an editor (Ctrl + MouseWheel) - the scale of the image (fake margin), remains the same and the margin becomes not truthy.

Yuriy Dyachkov
  • 439
  • 3
  • 16
1

In the latest PHPStorm, this is now possible. This would be PHPStorm 2017.3. The instructions on the ticket mentioned in the accepted answer explains it quite well:

Will be available in the next EAP build. You can set it up at Settings|Editor|Code Style|Visual guides for all languages or on "Wrapping and Braces" tab for a specific language ("Other" tab for XML/HTML). You can change the visual indent guide color at Settings|Editor|Color Scheme|General|Guides|Visual guides. Please submit separate reports if you find any problems.

I personally found the setting in Settings|Editor|Code Style|PHP|Wrapping and Braces|Visual guides. It should be there for every language.