I also started using PHPStorm, not just for PHP, but for jQuery. I liked the built in intellisense (autocomplete, quick info, list parameters, etc) that was offered in PHPStorm, but not in Sublime. Screenshot of PHPStorm showing some fancy jQuery that I authored. What I didn’t like about Sublime. Sublime is fast, but it’s bare-bones. Today’s knowledge point (2021.03.20) — day 704(I’m going to ask questions, too) html How to solve the problem of not being able to download on the H5 page of wechat?
Early Access ProgramFeaturesEarlier this week, we released the PhpStorm 8 EAP with a number of new features and improvements. We hear what you say on Twitter and on our issue tracker and that’s why we’re including your number one request: Multiple Selection. Let’s see how we can work with them!
Multiple Selection
With Multiple Selection, we can work with multiple cursors in one file simultaneously. Let’s start with some basics: press and hold Alt and use the mouse to select the locations where a cursor is desired.
Webstorm Install Electron
Please note that default hotkey for multiple selection (multiple carets) add/remove caret has been changed from PhpStorm 8 EAP 138.256 build to Alt+Click (used to be Alt+Shift+Click before). It can be always changed in Settings | Keymap | Add or Remove Caret.
Webstorm Debug Electron App
Cursor locations can also be added using Select Next Occurrence(Alt+J on Windows, Ctrl-G on Mac OS X): we can add the next occurrence of the current word to the selection and start working from there. Also we can Unselect Occurrence (Alt+Shift+J on Windows, Ctrl-Shift-G on Mac OS X). Select All Occurrences (Ctrl-Cmd-G on Mac OS X is already available, Windows hotkey Ctrl+Alt+Shift+J will be available from the next EAP – use double shift | Select All Occurrences action for now) will select all occurrences of current word/symbol in multiple caret mode. Hitting Escape lets us work with one cursor again.
Here’s a video of these concepts in action in an HTML file.
http://www.youtube.com/watch?v=aqGNM4rvyOE
Multiple selection works with all languages supported by PhpStorm such as PHP, HTML, JavaScript, CSS and more. Here’s a (slightly insane) example of converting a Markdown file into PHP code using nothing but multiple selection:
http://www.youtube.com/watch?v=PIqBf7Ekjgk
Autocompletion (Ctrl+Space) and live templates are also available with multiple selection. Copy/paste also works: copying will store selected text from all cursors on the clipboard, pasting will add all clipboard text to every cursor location.
Here’s another video where we demonstrate Column Selection Mode (Alt and drag the mouse to select a region of text) as well as Emmet support inside multiple selection:
http://www.youtube.com/watch?v=-A9BwBA3s8I
Refactoring
While we agree multiple selection is super awesome, there are situations where refactorings are more appropriate. With great power comes great responsibility so it’s worth knowing when to use that power! Consider the following piece of code:
How can we rename the $config variable to $configuration here? It’s really tempting to use multiple selection but that would break all usages of the $config variable. It’s better to use a Rename refacoring in this case (Shift+F6).
Another example would be replacing strings in one document: using Select Next Occurrence (Alt+J on Windows, Ctrl-G on Mac OS X) we can easily select these strings and update them. But having the same string multiple times in a document is an antipattern… Instead, try using the Extract Variable in such case.
Webstorm Electron
Want to give it a try? Find a new exercise in our PhpStorm Hands-On Workshop Materials!
As we are still working on this feature, we welcome your feedback through our issue tracker, in the comments below or in our forums! Current issues can be found by this link.
Webstorm 配置 Electron
Develop with pleasure!
– JetBrains PhpStorm Team
Comments are closed.