Code completion pair braces issue

Problem:

When I type for example i inside an HTML tag, phpStorm pops auto complete suggest id="" and places coursor between quotes. In order to move out of quotes I have three options:

  1. Delete closing one and re-insert it myself - auto-completion transforms to auto-hindrance in this case
  2. Use key combination to move to the end of the line - a partial solution, because I dont want to move to the end in some cases and actually prefer to close braces/quotes myself instead of pressing extra keys
  3. Use Right Arrow key to move coursor forward but thats extremely inconveinient, especially when touch typing


Possible solutions:

  1. Enable "code-eating" feature like other IDEs do: if I manually close brace/quote while being inside auto-generated pair, it does not add a third one, but rather moves coursor forward
  2. Disable auto pairing at code completion

The problem is that I haven't found neither any option in phpStorm settings nor any solution on the internet. Any suggestions?

0

Hi there,

>Enable "code-eating" feature like other IDEs do: if I manually close brace/quote while being inside auto-generated pair, it does not add a third one, but rather moves coursor forward

It does that by default. No issues here.

>Disable auto pairing at code completion

What exactly you wish to disable? There are few different settings. Auto-inserting ="" when completing HTML/XML is a one thing (option), auto-inserting pair ")] etc is another.

 

But in general -- they are all here: "Settings/Preferences | Editor | General | Smart Keys" -- see https://www.jetbrains.com/help/phpstorm/smart-keys.html

Check them .. and if still the same -- post your settings.

0

>It does that by default. No issues here.

In my case it does not, what can be the reason?

>What exactly you wish to disable? There are few different settings. Auto-inserting ="" when completing HTML/XML is a one thing (option), auto-inserting pair ")] etc is another.

I know about Smart Keys, but as I said, no option there can solve the problem. Disabling Auto-inserting ="" does nothing with php function auto-completion brackets as well as auto-inserting pair ")]

0

Show your settings as well as provide some screencast that would clearly show the issue (need to see how it all happens) and the context (it might be important) using Default or Darcula theme.

At first it was about plain HTML context .. now it seems to be more about PHP. Need more details.

I believe i was answering similar kind of question during this year .. but I do not remember the outcome and how it was resolved.

0

Okay, here is what actually happens

Here is the link for my setting (or do you want a screenshot?)
https://www.dropbox.com/s/95rgu3sapgy1sb2/PHPStorm_settings.jar?dl=0 

0

Hi there,

Many thanks for very good screenshot / illustration -- it clearly explains the issue that you are having. No idea on why it happens to you .. but at least it's veruy clear now on what you are seeing there (general picture at very least).

Thing is -- IDE eats the ")" for me just fine.

In case if it's important:

  • was typing "ab" and then choose "abc()" from the completion popup using Enter
  • caret was automatically placed inside the "()" so it was "abc([CARET])"
  • typed "bo" and then choose "$books" using Enter
  • caret is located just before ")" (as seen on screenshot)
  • typed ")" -- IDE eat it .. and caret just moves past ")"

Maybe it needs more complex context / different file structure etc?

In any case: use "Submit a Request" link at the top of this page to submit a ticket to the Support team (attach your settings and your screnshot as well). I had a quick look at your settings ... but could not spot anything obviously wrong as first glance (by looking at config files only) .. and I cannot play around with your limited settings on my own PC  (I need to backup and delete mine, install yours, deal with other associated nuances (like caches etc); I do not see what other plugins you have got there; plus, I'm using PhpStorm and you have IntelliJ -- it can make the actual difference) -- but support team can do that. Just do not forget to state your OS and IDE version -- might be important.

0

Thank you for a fast reply, actually I do use PhpStorm as well, idk why does the settings archive has 'IntelliJ IDEA Global Settings' inside it (if that is what made you think that I am using smth different). Okay, I will do as you told and try to contact support, I will post the response here as well.

0

I have returned to this thread after these months to say that I've found what was the problem. I will try to explain.
It is indeed in: "Settings/Preferences | Editor | General | Smart Keys" -> "Insert pair bracket", "Insert pair quote options". Here is how it works:

Options disabled:
1. Typing "(" anywhere in editor will not add closing ")"
2. "Code eating" is implicitly disabled too, thus typing ")" inside "()" will lead to "())"
3. On code completion, paired brackets after functions are still added, that's why if you use code completion but disable the above options, you will end up with the problem I got.

Options enabled:
1. Typing "(" in editor will add closing ")"
2. "Code eating" is implicitly enabled, typing ")" inside "()" will lead to "()" and move cursor to the right of the bracket
3. Advantage of code completion is fully usable

In a perfect world, there must be another option in addition to "Insert pair bracket" and  "Insert pair quote", called "Enable code eating" or smith like that, but anyway, PhpStorm is most configurable IDE I've ever seen, so I don't complain.

Problem solved, thanks to @Andriy Bazanov for assistance.

 

0

请先登录再写评论。