Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm: any solution for 4 annoying problems?

I'm a rather happy PhpStorm user, but there are a few things that really annoy me, but I'm not a settings expert and wish there is a solution for them (editing PHP files) :

  • Navigation

Often in the editor, one want to go back to where the cursor was 100 lines above etc... And in PhpStorm Back Alt-Shift-Left and Forward Alt-Shift-Right do this - but they follow an algorithm that is beyond me: it definitely misses "steps" (e.g. from line 500 go to line 300 using keys like arrows or -even worse- page-up/down, then Alt-Shift-Left doesn't bring you back to line 500)

=> Is there a way to refine the conditions that drive the behavior of Back and Forward?

  • Indentation

Is there a way to refine the indentor behavior? For instance

  $a = array('X' => 'Something',
             'Y' => 'Something else',[RETURN]
  ^          ^
 now       there

like in Emacs the cursor would go there right under the first quote after the spaces (and not at now where PS goes)?

=> Is a regexp (or something else) able to refine the behavior of the indentor, Not only for this very specific case but for the behavior in general?
(Not mentioning another problem when Shift-Inserting where the indent is often unreliable)

  • Quotes (automatic)

I don't want to disable the automatic quoting feature as it is sometimes convenient, but it seems the algorithm doesn't parse correctly the environment where the " or ' is inserted (don't have an example right now but at times it was annoying, like inserting 2 " unexpectedly while only one is required, deleting one will actually delete the 2 (normal because they were inserted automatically... but I needed 1 only!) so have in this case to trick PhpStorm to force a 1 ").

=> Is there a regexp or similar to control the quoting behavior?

  • Select via Shift-Arrow (for instance, to delete...)

Almost forgot: PhpStorm remembers at which column the cursor is when navigating Up and Down. Fine. But when one want to select (using Shift and Up/Down Arrows) from beginning of line it is usually to select lines. Not a line-to-where-cursor-was-earlier. An example will explain better: * is where the cursor is [beginning of line 3], % is where the cursor was [middle of line 2]

 1.   $x = 'string';
 2.   $y = %'string';
 3.*

doing Shift-Up will select (all s)

 1.   $x = 'string';
 2.   $y = *sssssssss
 3.

while in the specific case of a selection, it should select that:

 1.   $x = 'string';
 2.*sssssssssssssssss
 3.

not sure there is a way to configure that though - just in case there is?

Thanks

like image 221
Déjà vu Avatar asked Oct 06 '22 00:10

Déjà vu


2 Answers

Oh well...

1) Is there a way to refine the conditions that drive the behavior of Back and Forward?

No. Maybe (just maybe) it takes into consideration what you were doing at that location (even if you done nothing, then maybe how long the pause was). But mainly it looks at editing activity, navigation events (jump to declaration/implementation etc).


2) Is a regexp (or something else) able to refine the behavior of the indentor, Not only for this very specific case but for the behavior in general?

RegEx -- definitely no. This question is not clear for me anyway -- are you talking about formatting or navigation? If first -- then all currently existing settings are in "Settings | Code Style". If second -- then check "Settings | Editor | Smart keys" -- maybe they will help.

Otherwise -- please record some screencast/bunch of screenshots for current and desired behaviour and submit it as a new ticket to the Issue Tracker: http://youtrack.jetbrains.com/issues/WI


3) Is there a regexp or similar to control the quoting behavior?

No. You explanation is not clear enough. I suggest the same as for #2 -- get a code example and submit it as a new ticket to the Issue Tracker: http://youtrack.jetbrains.com/issues/WI . This way it may gets implemented/fixed for next version


4) not sure there is a way to configure that though - just in case there is?

Don't know. I'm also facing this usability issue and would like to know workaround. The way I'm using it -- pressing "Home" before (or during/after) making the selection (not ideal "solution" as it is still annoying to do so, but works). Alternatively you can use mouse to select the lines (use it over editor gutter area -- where the line numbers are).

If selection is to just delete/duplicate the line -- then there are shortcuts just for that.

like image 74
LazyOne Avatar answered Oct 10 '22 01:10

LazyOne


Regarding quotes, in cases when you just want the one quote, hit del instead of backspace after typing ".

I've some qualms about the indentation (and code (re)formatting in general) too, but it's that it changes from release to release, there's not much you can do about it though...

Re: selection - in your case you can just hit Home while still holding shift. It never even registered to me as unexpected behavior.

like image 29
raveren Avatar answered Oct 10 '22 02:10

raveren