0

I just moved from VSCode to PhpStorm. A small annoying thing is that when commenting a section (in a Blade file) PhpStorm adds a lot of (unneeded) space, which I have to go over and manually trim. This is a small thing, but give the amount of comments I'll write using this program, it's better to figure out the issue sooner.

Example:

I have the following code

enter image description here

I make space for a comment

enter image description here

Using the Mac shortcut for comment, PhpStorm adds a comment, but to the base line. This means I have to trim the comment each time.

enter image description here

Desired result: to start to comments below the opening tag on the previous line and placement of the input i.e

enter image description here

Sidebar:

VS Code does this by default, so I'm not sure if this is a known "feature", not a bug with PhpStorm.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Wally
  • 705
  • 1
  • 9
  • 24
  • 1
    I'm pretty sure this is intentional, the comment shortcuts are - AFAIK - more intended to comment out an existing selection of code, and that way, the comment out section jumps out more. In IntelliJ (which is the same base as PHPStorm), there is a Code Style setting called "Comments at first column". It doesn't seem to control this behaviour, but should do so when reformatting. – Mark Rotteveel Mar 20 '23 at 10:51
  • 1
    Turn on displaying whitespace symbols -- it will better show if you have the indents done right on that empty new line. When you insert the comment (Block comment on an empty line with no selection) it inserts it in the caret place. Normally (at very least here on my PC), when you hit `Enter` after `` (or alike tag) the IDE will make a new line and indent accordingly. In your case it looks to me that the indent is simply not there (the caret is placed at the first column). – LazyOne Mar 20 '23 at 11:20
  • 1
    1) So check your settings about indent behaviour. Not sure, check the Code Style for HTML and Blade, also check what you have at `Settings (Preferences on macOS) | Editor | General | Smart Keys --> Smart Indent` 2) Make a test file where you can reproduce the issue and share the file as well as your Code Style (export as XML format) -- maybe it's something there (specific file content perhaps, or specific block where it does not work right). Need to test and see. In my simple test it works fine here (the right indent and the comment gets inserted at the caret place). – LazyOne Mar 20 '23 at 11:24

0 Answers0