Many “right margins” or manuals in PHPStorm

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

Given that PSR standards comply with There MUST NOT be a hard limit on line length; the soft limit MUST be 120 characters; lines SHOULD be 80 characters or less. 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 would be nice if I could get another visual indicator at around 80 characters ...

I am well aware that it says which row / column you are in the status bar, but I usually hide most of the panels (including the status bar) when encoding.

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

+5
source share
3 answers

This is currently not possible .. and the plugin does not occur to me.

https://youtrack.jetbrains.com/issue/IDEA-99875 - star / vote / comment to receive notification of progress.

PS Given that this is rather specific PHP / Python (other languages ​​do not care about this). I would not expect JB to be implemented in the near future ...

+3
source

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

  • Open the settings page (usually Ctrl + Alt + S), go to plugins → Browse repositories
  • Find and install the BackgroundImage plugin
  • Restart the IDE, it may display an error, something like "unknown protocol d" - don't worry, go ahead
  • Make an image with height = 1px and width = (desired width of the extra margin). Give, say, a white background and draw one rightmost pixel to say black. I took a screenshot of the editor and trimmed it to PS to avoid annoying searching and adjusting the image width. For each background image change, restart PhpStorm.
  • Open settings again, go to Other settings → BackgroundImage
  • Check the "Enabled" box, view the created image and select the "FileSystem" switch
  • Restart the IDE again and change the field and you will get two fields

The image is left-aligned, therefore, when the editor is resized along the X axis (moving the separator between the editor and the project view or file system view, etc.), the margin will remain true. Some side effects - this also appears in the console window, the event log, possibly elsewhere.

If the plugin does not work, check out this page (it says that most JetBrains plugins should work on all IntelliJ platform products, and some workarounds if they do not): http://www.jetbrains.org/intellij/ sdk / docs / basics / getting_started / plugin_compatibility.html

ADDED: Does not work with editor scaling (Ctrl + MouseWheel) - the image scale (fake margin) remains unchanged and the field becomes implausible.

+1
source

In the latest PHPStorm, this is now possible. This will be PHPStorm 2017.3. The ticket instructions indicated in the accepted answer explain this pretty well:

Will be available in the next EAP build. You can set it to Settings | Editor | Code Style | Visual Guides for All Languages ​​or Wrap and Snap Tab for a Specific Language (Other Tab for XML / HTML). You can change the color of the pointer in Settings | Editor | Color scheme | General | Guides | Visual guides. please, if you find any problems, send separate reports.

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

+1
source

Source: https://habr.com/ru/post/1206319/


All Articles