Home > Enterprise >  Simultaneous quotation mark editing in JetBrains IDEs?
Simultaneous quotation mark editing in JetBrains IDEs?

Time:05-22

In PhpStorm (and other JetBrains IDEs), there is a nice option when typing HTML to edit both HTML tags as you type, so that they are always in sync:

return '<buttond > hello </buttond>'

It is managed by the setting: Simultaneous <tag></tag> editing in PhpStorm.

I was wondering if there was something similar for quotation marks, and even symbols like (), {} and [] so that the closest quotation mark would also be modified, to avoid stuff like this:

return "<button > hello </button>'

I understand that this would cause syntax errors, since if you change the symbol you change the inner content's structure, but if the IDE can tell when a quotation ends, is it possible to do this as well?

CodePudding user response:

I understand that this would cause syntax errors,

Why? If it's PHP then just use the appropriate quick fix action from the Intentions/Quick Fix menu (Alt Enter here on Windows or by using a mouse on the light bulb icon):

enter image description here

Final result:

return "<buttond class=\"btn\"> hello </buttond>";

I was wondering if there was something similar for quotation marks, and even symbols like (), {} and [] so that the closest quotation mark would also be modified...

Check options under Settings (Preferences on macOS) | Editor | General | Smart Keys

enter image description here

This will work for quotes changing.

For brackets/braces etc it's more about inserting the closing one automatically when typing the opening one. Although in some contexts it will also work: e.g. in JSON file, change the opening { by [ and it will also replace the closing } to ].

  • Related