bug? autocomplete replacing next word
in PHPstorm 98.108 I have an issue with the autocomplete handling...
I have some pre-existing code I want to wrap in a function
right now in release 98.108,
if I insert the cursor to the left of the $ and start typing,
Code Complete works, as shown:
however, once I hit the tab key, it replaces $ThisActiveDoc as shown here:
it should look like this:
This happens if I use the tab key, the return key or the enter key.
I am running the OSX version of PHPStorm. (98.108).
I did the File-Invalidate Caches after installing it.
I really like the autopopup feature that was added in 98.91, - if you could change it so it doesn't autoselect the next word, then replace it, that would be helpful.
Thanks!
Please sign in to leave a comment.
Hi Jack,
I will use this code in my reply/message (just random line from one of my files):
Now, if I will start typing something like this (the red vertical line represents where cursor is located when I press Ctrl+Space to see autocompletion pop-up):
I have the same behaviour: the next keyword get replaced by the entry from autocompletion list. This will happen ONLY if I hit tab key.The result in this case will be:
However, if I press Enter, then result is quite different:
I do not think that PhpStorm can or (maybe even) should do what you are expecting (image #3 from your post: -- include the following text after cursor inside the function brackets) -- in my examples you would expect this:
I think you're describing the nature of my bug report -
pressing enter for me does not behave the way it does for you,
pressing enter and tab do the same thing - they replace the text to the right
That's what I'd like changed/fixed.
(this is on 98.108 on OSX)
the automatic assignment of the ) wasn't part of my request - I apologize if it looked that way from the code - I had put in the ')' by myself manually.
If I can ask, how do you get those separate code sections in your post? I don't see an option to format code in my editor (Could be browser specific - I am using Safari on OSX
Hmm -- this must be platform specific bug (I'm using Windows 7 and, as you can see, it works fine for me) ... or ... maybe this is some other plugin that messing things up. The Question is: do you have "Extended Code Sense" plugin installed (or any other plugin that is not part of standard distribution (not bundled in)) ?
If this is definitely not a plugin -- then it's a bug for me and you should report it (same link as before).
As for the second part: I have used "Quote" feature (the last button in first row in the bar above this message box -- the one with comment bubble and double quote sign -- just select the text and click on it).
Hmm, well I just tried it again, and it worked as expected.
So maybe not a bug after all.
Sorry about the false alarm.
The only thing I can think of to explain it is that maybe I didn't invalidate my caches when I thought I did (ie when I installed the 108 release)
Either that or a reboot of the IDE.
Thanks for the weekend assistance!
@Andriy Bazanov We really appreciate your help here and other threads. The quality and style of your responses is quite impressive.
We'd like to grant you a free personal license for PhpStorm. You'll be contacted via your issue tracker credentials by our PR team.
Alexey Can this thread be deleted? It does not look like a bug. I'd like to avoid cluttering up your forum with junk.
- Jack
We prefer to keep it.
Ok Alexey.
Also Just wanted to let you know how much I love PHP Storm - it has been a huge help to me!
I also watched your video from IPC Spring 2010, which was pretty cool to see a few things in action.
- Jack
I have this problem too. Any update on this?
@Aminyahyaabadi74
Which bug? Please provide details instead of "me too".
Autocomplete removes next word
@Aminyahyaabadi74
>Autocomplete removes next word
That's expected / correct behaviour.
In code completion (when completion popup is visible):
So use [Enter] instead of [Tab] in such cases.
https://www.jetbrains.com/help/phpstorm/auto-completing-code.html#accept
P.S. Huge thanks for the gif/animation that shows keys pressed -- it adds the context / clarifies things straight away
Is there any way to re-configure Tab to behave like Enter? Looking at the settings under `Code Completion` does not seem to have an option to do that. Ideas?
UPDATE: found solution.
For those who would want simple completion (no deletion) upon hitting tab - you need to change `Choose Lookup Item` and `Choose Lookup Item and Replace` in Settings | Keymap.
I realise this is for PHPStorm - I use Rider and the same issue occurs.
This is actually a bug - I chose VSCode keyboard settings. In VSCode the behaviour of TAB is just to insert, not to delete the next word.
Please could you update the VSCode default keyboard mappings and fix this.
@Stuart
Use Rider Issue Tracker – more appropriate place for requests.
https://youtrack.jetbrains.com/issues/RIDER (just check for existing tickets before submitting new one)