That is, if I have a function like:
angular.module('sessionController',[]);
and I want to change it to
(function () {
'use strict';
angular.module('sessionController',[]);
}());
I was thinking there would be a "code/surround with" type option
Navigate to a file with the Navigation bar Use the Navigation bar as a handy tool to find your way across the project. Press Alt+Home to activate the Navigation bar. Use the arrow keys or the mouse pointer to locate the desired file.
Simply select the code block to surround (don't forget to use Ctrl + W to increase the current selection) and then press Ctrl + Alt + T (or right-click the selection and select Surround with… from the menu). IntelliJ IDEA will show a list of options to choose from.
These are most used shortcuts of WebStorm. The complete list can be found under File menu > Settings > Keymap. matches. . To see every shortcut, go to the full page . Find Action. This command allows you to search in all commands and settings Another way to learn shortcuts is to use Key Promoter X plugin.
While there, you can search by action name or by shortcut: Alternatively, start typing an action name in the Search everywhere popup, and you’ll see some matching shortcuts. Also you can also try Visual Shortcut Mapper with the WebStorm default keymap available.
If you prefer a hard copy, download the default WebStorm keymap reference and print it out as a card: WebStorm provides several possibilities to learn shortcuts: Find Action lets you search for commands and settings across all menus and tools. Press Ctrl+Shift+A and start typing to get a list of suggested actions.
With WebStorm, you can instantly jump to the definition of a symbol: just press ⌘ or Ctrl and click on that symbol, or place the caret on it and press ⌘B / Ctrl+B. This shortcut can also help you jump to the referenced file or imported module.
You can create the corresponding Live Template (Settings/Live Templates) like the following:
(function () {
'use strict';
$SELECTION$
}());
Make sure to set the context (Applicable In...) to 'JavaScript'.
Template can be applied using Code/Surround with live template (Ctrl+Alt+J)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With