{"id":23041,"date":"2018-07-23T10:38:26","date_gmt":"2018-07-23T10:38:26","guid":{"rendered":"https:\/\/blog.jetbrains.com\/webstorm\/?p=9787"},"modified":"2018-07-25T12:05:50","modified_gmt":"2018-07-25T12:05:50","slug":"webstorm-2018-2","status":"publish","type":"webstorm","link":"https:\/\/blog.jetbrains.com\/zh-hans\/webstorm\/2018\/07\/webstorm-2018-2","title":{"rendered":"WebStorm 2018.2: Extract React component, integration with &#8216;ng add&#8217;, Node.js on WSL, and more"},"content":{"rendered":"<p>&#x1f389; Today we\u2019re announcing WebStorm 2018.2! &#x1f389;<\/p>\n<p>WebStorm 2018.2 brings a lot of new powerful features and improvements, including the Extract React component refactoring, new integrations with Angular CLI, better testing workflow and Node.js debugging experience.<\/p>\n<p><a href=\"https:\/\/www.jetbrains.com\/webstorm\/whatsnew\/\" target=\"_blank\" rel=\"noopener\">Explore the top new features and download WebStorm 2018.2 on our website.<\/a><\/p>\n<p>https:\/\/youtu.be\/CZFooXiqxs8<\/p>\n<p>We\u2019ve been running the Early Access Preview program for WebStorm 2018.2 for the past two months. We published WebStorm EAP builds on a weekly basis, covering all the new features on this blog. Now we want to share with you the detailed release notes for the WebStorm 2018.2 update as compiled from these <a href=\"https:\/\/blog.jetbrains.com\/webstorm\/tag\/webstorm-2018-2\/\">EAP blog posts<\/a>.<\/p>\n<p>Here are the features and improvements grouped by the WebStorm subsystems:<\/p>\n<ul>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#development_with_react\">Development with React<\/a>: Extract React Component refactoring, convert class components into functional components, and code snippets.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#development_with_angular\">Development with Angular<\/a>: faster project startup,\u00a0add new features using the integration with ng add, and run schematics from the IDE.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#development_with_vue\">Development with Vue.js<\/a>: completion for Vue events and event modifiers.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#node_js_development\">Node.js development<\/a>: support for Node.js on Windows Subsystem for Linux, an ability to automatically reconnect the debugger to the running node process, and remote mappings in Attach to Node.js configuration.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#built_in_tools\">Built-in tools<\/a>: find unused code in the client-side app with Code Coverage reports, global File Watchers.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#editor\">Editor<\/a>: new UI for inspection tooltip.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#javascript_and_typescript_support\">JavaScript and TypeScript support<\/a>: custom templates for postfix completion, and TypeScript 2.9 and 3.0 supported.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#json_support\">JSON support<\/a>: JSON5, and Iimproved support for JSON Schemas.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#linters\">Linters integrations<\/a>: different highlighting for TSLint errors and warnings, and an ability to automatically apply code style rules from all types of ESLint and TSLint configuration files.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#debugger\">Debugging<\/a>: breakpoint intentions, Drop Frame action, and debugging JavaScript scratch files.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#testing\">Testing<\/a>: rerun failed tests, navigate to Jest snapshot, compare Jest snapshots, and debugging Karma tests using Chrome Headless.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#version_control\">Version Control<\/a>: Browse Repository at Revision action, completion for tags, register roots automatically.<\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/07\/webstorm-2018-2\/#other_ide_improvements\">Other IDE improvements<\/a>: Touch Bar support.<\/li>\n<\/ul>\n<p align=\"center\"><a class=\"jb-download-button\" href=\"https:\/\/www.jetbrains.com\/webstorm\/download\" target=\"_blank\" rel=\"noopener\">Download WebStorm 2018.2<\/a><\/p>\n<h2 id=\"development_with_react\">Development with React<\/h2>\n<h3 id=\"extract_react_component\">Extract React component<\/h3>\n<p>We\u2019re very excited about this feature! WebStorm can now help you create a new React component, by extracting the JSX code from the render method of an existing one.<\/p>\n<p>Select the code you want to extract, and then select <em>Component\u2026<\/em> from the <em>Refactor this\u2026 <\/em>popup (<em>Ctrl-T<\/em> on macOS or <em>Ctrl-Alt-Shift-T<\/em> on Windows and Linux). Name the component and select whether it should be a class component or a functional component.<\/p>\n<p>That\u2019s it! Now your new component is defined next to the existing one and used in it.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9721\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-extract-react-component.png\" alt=\"extract-react-component\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-extract-react-component.gif\" \/><!--more--><\/p>\n<p>You can then use the <em>Move<\/em> refactoring to move the new component and all the required imports to a separate file. (Do let us know if you\u2019d like this option to be available right on the Extract Component refactoring dialog.)<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9724\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-move-react-component.png\" alt=\"move-react-component\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-move-react-component.gif\" \/><\/p>\n<p>In this <a href=\"https:\/\/gist.github.com\/prigara\/c394275935aed6e079f042b354ae180a\" target=\"_blank\" rel=\"noopener\">Gist<\/a> you can see the code before and after the refactoring.<\/p>\n<p>You can modify the code templates WebStorm uses for the new components, by going to <em>Preferences | Editor | File and Code Templates<\/em> and selecting the <em>Code <\/em>tab. For example, you can switch from using <code>Component<\/code> to using <code>React.Component<\/code> or <code>PureComponent<\/code> when creating a class component. Or, change the template for functional components to using arrow function. You can also change the style of using PropTypes or remove them altogether.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9725\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-code-template-for-extract-react-component.png\" alt=\"code-template-for-extract-react-component\" width=\"600\" \/><\/p>\n<h3>Convert React class components into functional components<\/h3>\n<p>With the new intentions, you can now convert React class components into functional components and back again \u2013 press <em>Alt-Enter<\/em> on the component definition and select the action you need.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9794\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/07\/webstorm-convert-react-component.png\" alt=\"convert-react-component\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/07\/webstorm-convert-react-component.gif\" \/><\/p>\n<h3 id=\"react_code_snippets\">React code snippets<\/h3>\n<p>WebStorm now has a collection of code snippets for React. It has over 50 abbreviations that expand into different statements and blocks of code often used in React apps. The collection was adapted from the popular <a href=\"https:\/\/github.com\/xabikos\/vscode-react\" target=\"_blank\" rel=\"noopener\">plugin<\/a> for VS Code.<\/p>\n<p>Type the abbreviation in the editor and then press Tab to expand it. Or press <em>Cmd\/Ctrl-J<\/em> (<em>Insert Live Template<\/em>) and select the snippet from the list. All abbreviations are also available in the completion popup.<\/p>\n<p>Here we use the abbreviation <code>rcjc<\/code> to create a class that defines a new React component:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9629\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-react-live-template.png\" alt=\"react-live-template\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-react-live-template.gif\" \/><\/p>\n<p>You can find the full list of available templates in <em>Preferences | Editor | Live Templates &#8211; React<\/em>.<\/p>\n<p>For the JSX tags, you can now also see the breadcrumbs and colorful highlighting for the tag tree on the editor gutter.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9623\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-jsx-tree-highlighting.png\" alt=\"jsx-tree-highlighting\" width=\"600\" \/><\/p>\n<h3 id=\"better_support_for_proptypes\">Better support for PropTypes<\/h3>\n<p>Code completion is now more precise when you use <a href=\"https:\/\/reactjs.org\/docs\/typechecking-with-proptypes.html\" target=\"_blank\" rel=\"noopener\">PropTypes<\/a> like <code>shape<\/code>, <code>oneOf<\/code>, <code>instanceOf<\/code>, or <code>arrayOf<\/code>. Here are a couple of examples. Here in the completion we have the values listed using <code>PropTypes.oneOf<\/code>:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9727\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-props-one-of.png\" alt=\"props-one-of\" width=\"600\" \/><\/p>\n<p>And here we have completion for array methods because <code>PropTypes.arrayOf<\/code> is used:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9728\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-props-array-of.png\" alt=\"props-array-of\" width=\"600\" \/><\/p>\n<h3 id=\"react_code_snippets\"><\/h3>\n<h3 id=\"support_for_react_namespaced_components\">Support for React namespaced components<\/h3>\n<p>WebStorm now has better support for React components that have a namespace in their name. You can now get appropriate code completion and navigation to the definition for these components in JavaScript and TypeScript files.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9726\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-react-namespaced-components.png\" alt=\"react-namespaced-components\" width=\"600\" \/><\/p>\n<h2 id=\"development_with_angular\">Development with Angular<\/h2>\n<h3 id=\"faster_project_startup\">Faster project startup<\/h3>\n<p>Previously, when you opened your Angular project for the first time, WebStorm would spend significant time indexing the compiled JavaScript files shipped with the Angular core modules.<\/p>\n<p>We\u2019ve decided to update the way WebStorm handles the core Angular module and modules written in TypeScript in general. Now, if the module\u2019s package.json has a <code>typings<\/code> field with the path to the <em>*.d.ts<\/em> file, then WebStorm indexes only the TypeScript files and ignores all the JavaScript files.<\/p>\n<p>As a result, we\u2019ve <em>halved the time WebStorm needs to index a new Angular project<\/em>, with no compromises affecting the quality of code completion and resolve (which also work faster now, too!).<\/p>\n<h3 id=\"run_more_angular_schematics_using_the_angular_cli_integration\">Run more Angular schematics using the Angular CLI integration<\/h3>\n<p>With the <em>New&#8230; &#8211; Angular Schematic\u2026<\/em> action in the Project view, you can now generate code using schematics that are defined in libraries like @angular\/material (note that you need to use Angular 6 for this). Previously, you could only generate components, services, and other blueprints defined in the Angular CLI itself.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9733\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-generate-material-component.png\" alt=\"generate-material-component\" width=\"600\" \/><\/p>\n<p>In addition, WebStorm now shows the schematic\u2019s description and provides code completion and description for available options.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9734\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-generate-component-options.png\" alt=\"generate-component-options\" width=\"600\" \/><\/p>\n<h3 id=\"adding_new_features_to_an_angular_app_with_ng_add\">Adding new features to an Angular app with ng add<\/h3>\n<p>Another new feature introduced by the <a href=\"https:\/\/blog.angular.io\/version-6-of-angular-now-available-cc56b0efa7a4\" target=\"_blank\" rel=\"noopener\">Angular and Angular CLI 6 update<\/a>\u00a0in the new <code>ng add<\/code> command to help add new capabilities to your app. It will install the selected dependency and then invoke the installation script to take care of all the rest.<\/p>\n<p>In WebStorm, you can now use the new <em>Angular Dependency\u2026 <\/em>action to install libraries that support installation with <code>ng add<\/code> without using the terminal. This action is available via the <em>Find Action<\/em> (<em>Cmd-Shift-A\/Ctrl+Shift+A<\/em>) popup or the <em>New\u2026<\/em> popup (<em>Cmd-N\/Alt+Insert<\/em>) in the Project view.<\/p>\n<p>In the list you can select the library you want to add. Right now it contains only the libraries that we know have <code>ng add<\/code> support, but you can also specify any package name you want. By the way, the list is available on <a href=\"https:\/\/github.com\/JetBrains\/intellij-plugins\/blob\/master\/AngularJS\/resources\/org\/angularjs\/cli\/ng-packages.json\" target=\"_blank\" rel=\"noopener\">GitHub<\/a> and you can send us Pull Requests to add more libraries.<\/p>\n<p>In this example, we are adding Angular Material to our project:<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-9760\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-webstorm-ng-add.png\" alt=\"webstorm-ng-add\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-webstorm-ng-add.gif\" \/><\/p>\n<p>If you add a dependency to package.json that WebStorm knows supports <code>ng add<\/code>, the IDE will suggest installing it with <code>ng add<\/code>:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9758\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-webstorm-install-with-ng-add-inspection.png\" alt=\"webstorm-install-with-ng-add-inspection\" width=\"600\" \/><\/p>\n<p>And even if a dependency is already installed, it can still make sense to reinstall it with <code>ng add<\/code>. To do so, press <em>Alt-Enter<\/em> on the package name in package.json and select <em>Reinstall with `ng add`<\/em>:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9759\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-webstorm-reinstall-with-ng-add.png\" alt=\"webstorm-reinstall-with-ng-add\" width=\"600\" \/><\/p>\n<h3 id=\"run_configurations_for_new_angular_projects\">Run configurations for new Angular projects<\/h3>\n<p>If you create a new Angular project using Angular CLI in the IDE, WebStorm now automatically adds run\/debug configurations that will help you start and debug the app and run Karma and Protractor tests in the IDE.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9756\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-angular-cli-project-configurations.png\" alt=\"angular-cli-project-configurations\" width=\"600\" \/><\/p>\n<h2 id=\"development_with_vue\">Development with Vue.js<\/h2>\n<h3 id=\"completion_for_vue_events_and_event_modifiers\">Completion for Vue events and event modifiers<\/h3>\n<p>In Vue templates, WebStorm now provides code completion for events and event modifiers.<\/p>\n<p>The list of events is available following `v-on:`:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9664\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-v-on-vue.png\" alt=\"v-on-vue\" width=\"600\" \/><\/p>\n<p>You can also use the shorthand notation, <code>@event<\/code>:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9665\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-vue-event-shorthand.png\" alt=\"vue-event-shorthand\" width=\"600\" \/><\/p>\n<p>Event modifiers can also be automatically completed:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9666\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-vue-event-modifier.png\" alt=\"vue-event-modifier\" width=\"600\" \/><\/p>\n<h2 id=\"node_js_development\">Node.js development<\/h2>\n<h3 id=\"support_for_node_js_on_windows_subsystem_for_linux\">Support for Node.js on Windows Subsystem for Linux<\/h3>\n<p>If you\u2019re using Node.js on WSL, we have some good news for you: you can now run and debug Node.js apps using Node.js on WSL right in WebStorm.<\/p>\n<p>You can select Node.js on WSL as a project\u2019s node version in <em>Preferences | Languages &amp; Frameworks | Node.js and <\/em><em>npm<\/em> or you can configure and use this node version in a Node.js Run\/Debug configuration.<\/p>\n<p>In <em>Preferences | Languages &amp; Frameworks | Node.js and npm<\/em>, click <em>\u2026<\/em> next to the field with the path to Node.js, then click <em>+<\/em> in the opened dialog and select <em>Add Node.js on WSL.<\/em><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-9694\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-select-wsl-in-preferences.png\" alt=\"select-wsl-in-preferences\" width=\"600\" height=\"833\" \/><\/p>\n<p>Now select the Linux distribution you\u2019re using from the drop-down menu and set the path to Node.js and click Save.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9695\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-select-linux-and-node-on-wsl.png\" alt=\"select-linux-and-node-on-wsl\" width=\"400\" \/><\/p>\n<p>WebStorm will now use this Node.js version when running npm scripts or creating new Node.js run\/debug configurations.<\/p>\n<p>If you want to use Node.js on WSL only in some specific run\/debug configuration, instead of changing the project\u2019s node version in Preferences, you can add a new Node.js WSL interpreter in the Node.js configuration. Again, click on the <em>\u2026<\/em> button next to the path and follow the steps described above.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9696\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-node-on-wsl-in-debug-configuration.png\" alt=\"node-on-wsl-in-debug-configuration\" width=\"600\" \/><\/p>\n<p>This integration is still work in progress. We are now working on support for Node.js on WSL for test runners, linters, and build tools integrated in WebStorm. Stay tuned!<\/p>\n<h3 id=\"reconnect_the_debugger_to_the_running_node_process\">Reconnect\u00a0 the debugger to the running node process<\/h3>\n<p>We have added a new <em>Reconnect automatically<\/em> option to the <em>Attach to Node.js\/Chrome<\/em> debug configuration.<\/p>\n<p>Thanks to this option, it is now easier to debug Node.js apps that use <a href=\"https:\/\/nodemon.io\/\" target=\"_blank\" rel=\"noopener\">nodemon<\/a>. Nodemon is a utility that automatically reloads your node process when you change the code of your app.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9616\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-attach-to-node-reconnect.png\" alt=\"attach-to-node-reconnect\" width=\"600\" \/><\/p>\n<p>Here\u2019s how you can debug such an application:<\/p>\n<ul>\n<li>Start your app in the debug mode. To do this, pass an <code>--inspect<\/code> flag to nodemon. You can create and run a new <code>npm debug script<\/code> that would look like this: <code>debug\": \"nodemon --inspect .\/app.js<\/code> (be sure to replace <em>.\/app.js<\/em> with the path to the file that starts your app).<\/li>\n<li>Create a new Attach to a Node.js\/Chrome configuration and select the <em>Reconnect automatically<\/em> check-box.<\/li>\n<li>Usually, you don\u2019t need to change the port in the configuration (9229) because it\u2019s the default port the debugger is listening on. But you can double-check what port is used in the message logged when you run the app in the debug mode.<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9620\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-debug-port-nodemon.png\" alt=\"debug-port-nodemon\" width=\"600\" \/><\/p>\n<ul>\n<li>Now run the new configuration. The debugger will stop on the breakpoints that you\u2019ve put in your code in the IDE.<\/li>\n<li>If you make any changes to the code and click Save, nodemon will automatically reload the app. The debugger will now be able to automatically re-attach to the restarted process.<\/li>\n<\/ul>\n<h3 id=\"remote_mappings_in_attach_to_node_js_configuration\">Remote mappings in Attach to Node.js configuration<\/h3>\n<p>We have added another Node.js-related improvement in the Attach to Node.js configuration that you can use to attach WebStorm\u2019s debugger to the running node application.<\/p>\n<p>You can now specify the remote paths for the project folders. Which is useful if the app root folder on the remote server or the Docker container have a different name to the local root folder.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9697\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-remote-mappings-in-attach-to-node-configuration.png\" alt=\"remote-mappings-in-attach-to-node-configuration\" width=\"600\" \/><\/p>\n<h3 id=\"breakpoint_intentions\">Manage logs when running a Node.js app<\/h3>\n<p>If you\u2019re using a logging tool like <a href=\"https:\/\/www.npmjs.com\/package\/morgan\" target=\"_blank\" rel=\"noopener\">morgan<\/a> in your Node.js app, and the tool writes logs to a file, you can now see these logs on the Console tab in the Node.js Run tool window. To enable this, go to the new Logs tab in the Node.js run\/debug configuration. While there, you can also enable saving the console output to a log file.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9732\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-logs-in-node-configuration.png\" alt=\"logs-in-node-configuration\" width=\"600\" \/><\/p>\n<h2 id=\"built_in_tools\">Built-in tools<\/h2>\n<h3 id=\"javascript_code_coverage\">Find unused code in the client-side app with Code Coverage reports<\/h3>\n<p>You can now find unused JavaScript (or TypeScript) as well as CSS code in your client-side app thanks to the new <em>Code Coverage<\/em> feature.<\/p>\n<p>Run your app in the browser and then see the report in WebStorm showing how much code in every file and folder was used.<\/p>\n<p>The great thing is that the coverage will be shown for your source files and not for the compiled code that was actually run in the browser (as long as the source maps are available).<br \/>\nHere\u2019s how it works:<\/p>\n<ul>\n<li>Create a new JavaScript debug configuration by selecting <em>Run &#8211; Edit configurations&#8230;<\/em><\/li>\n<li>Specify the URL your app is running on and save the configuration.<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9684\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-javascript-debug-configuration.png\" alt=\"javascript-debug-configuration\" width=\"600\" \/><\/p>\n<ul>\n<li>Now click <em>Run with Coverage<\/em>.<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9683\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-run-with-coverage.png\" alt=\"run-with-coverage\" width=\"600\" \/><\/p>\n<ul>\n<li>Once your app opens in Chrome, wait till the page is loaded if you want to know what code was executed during the page load, and then stop the configuration in the IDE. If you want to see the coverage report for some specific features of your app, use these features in the browser and then stop the configuration.<\/li>\n<\/ul>\n<p>The coverage report will now open in the Coverage tool window: look at the Project view for info about the coverage of files and folders. Meanwhile, if you look at the left gutter in the editor, you will see green and red markers next to some lines. Green means that the line was executed, and red means it was not. And if you click on the market, you&#8217;ll see how many times this particular block of code was executed.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9682\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-coverage-report-with-editor.png\" alt=\"coverage-report-with-editor\" width=\"600\" \/><\/p>\n<p>In the example above, we see that the <code>togglePast<\/code> method is marked with red because we haven\u2019t clicked the link that shows the past events.<\/p>\n<h3 id=\"global_file_watchers\">Global File Watchers<\/h3>\n<p>With File Watchers, you can run command-line tools like <a href=\"https:\/\/prettier.io\/\" target=\"_blank\" rel=\"noopener\">Prettier<\/a> automatically when you change or save a file. Before, it was only possible to configure and use a file watcher in a specific project. If you wanted to use the same watcher in a different project, you had to repeat the whole configuration. But now you can create and store File Watchers on the IDE level, and easily enable them in different projects.<\/p>\n<p>To create a global File Watcher, open the IDE Preferences (from the project or from the Welcome screen) and go to <em>Tools | File Watchers<\/em>, click the <em>+<\/em> button, and select <em>Custom <\/em>from the list. Now configure the File Watcher for the tool you want to use (for more information on how to do that, see our <a href=\"https:\/\/www.jetbrains.com\/help\/webstorm\/using-file-watchers.html\" target=\"_blank\" rel=\"noopener\">documentation<\/a>).<\/p>\n<p>Once you\u2019ve saved the new File Watcher, you can decide if it\u2019s going to be available only in the current project &#8211; select Project in the right column or for all projects &#8211; then select Global.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9739\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-enable-global-watcher.png\" alt=\"enable-global-watcher\" width=\"600\" \/><\/p>\n<p>Note that the global File Watchers will be available in all projects, but disabled by default. If you want to use it, go to the project\u2019s <em>Preferences | Tools | File Watchers<\/em> and select the check-box next to it.<\/p>\n<p>Let\u2019s create a new global File Watcher for Prettier following the steps described in the <a href=\"https:\/\/prettier.io\/docs\/en\/webstorm.html#running-prettier-on-save-using-file-watcher\" target=\"_blank\" rel=\"noopener\">Prettier docs<\/a>. What we want to change is the path to Prettier \u2013 for every project where we want to enable this File Watcher, we want to use Prettier installed in the project\u2019s node_modules folder. To do that, we use a macro in the path: <em>$ProjectFileDir$\/node_modules\/.bin\/prettier<\/em>.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9730\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-global-watcher-for-prettier.png\" alt=\"global-watcher-for-prettier\" width=\"600\" \/><\/p>\n<h2 id=\"editor\">Editor<\/h2>\n<h3 id=\"new_ui_for_inspection_tooltip\">New UI for inspection tooltip<\/h3>\n<p>Probably the most notable (and definitely the most visible) change in this week\u2019s Early Preview build is the new inspection tooltip.<\/p>\n<p>You see these tooltips when you hover over the warning or errors in the code. As you might know, for all the warnings WebStorm will offer quick fixes that you can see if you press Alt-Enter or click on the bulb icon.<\/p>\n<p>And to make these quick fixes more discoverable, we now show the first available fix right next to the error description. You can then press <em>Alt-Shift-Enter<\/em> to apply the fix or <em>Alt-Enter<\/em> to see the usual pop up with all the available quick fixes and intentions.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9692\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-new-error-tooltips.png\" alt=\"new-error-tooltips\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-new-error-tooltips.gif\" \/><\/p>\n<h2 id=\"javascript_and_typescript_support\">JavaScript and TypeScript support<\/h2>\n<h3 id=\"new_intentions_in_javascript_typescript_and_json\">New intentions in JavaScript and TypeScript<\/h3>\n<p>We\u2019ve added a bunch of new intentions that are available in the TypeScript and partially in JavaScript code. To use an intention, press <em>Alt-Enter<\/em>, select it in the list and press Enter.<\/p>\n<p>Here\u2019s what was added:<br \/>\n<em><strong>Implement interface and Create derived class<\/strong><\/em><\/p>\n<p>The <em>Implement interface<\/em> intention works for the TypeScript interfaces and creates a new class that implements this interface.<\/p>\n<p>The <em>Create derived class<\/em> intention creates a new class in the JavaScript or TypeScript file that extends another class<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9698\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-implement-interface.png\" alt=\"implement-interface-create-class\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-implement-interface-create-class.gif\" \/><\/p>\n<p><em><b>Implement interface or abstract class member<\/b><\/em><\/p>\n<p>This TypeScript intention allows you to implement properties and members of an interface or an abstract class in classes that directly implement or extend them.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9700\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-implement-members.png\" alt=\"implement-members\" width=\"600\" \/><\/p>\n<p><em><b>Generate cases for \u2018switch\u2019<\/b><\/em><\/p>\n<p>This intention helps to generate the switch block when a switch argument is an enum.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9701\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-generate-cases-for-enum.png\" alt=\"generate-cases-for-enum\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-generate-cases-for-enum.gif\" \/><\/p>\n<p>In JavaScript this intention can use the information from an argument provided in the JSDoc comment:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9702\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-generate-cases-in-js.png\" alt=\"generate-cases-in-js\" width=\"600\" \/><\/p>\n<p><em><b>Iterate with \u2018for..of\u2019<\/b><\/em><\/p>\n<p>This intention is available for an array or symbol that you can iterate over with <code>for..of<\/code> in the JavaScript and TypeScript files.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-9704\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-iterate.png\" alt=\"iterate-with-for-of\" width=\"600\" height=\"400\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-iterate-with-for-of.gif\" \/><\/p>\n<p><em><b>Convert type alias to enum<\/b><\/em><\/p>\n<p>This intention can convert a type alias with string literals in it into an enum and is available only in TypeScript.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9706\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-convert-type-alias-to-enum.png\" alt=\"convert-type-alias-to-enum\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-convert-type-alias-to-enum.gif\" \/><\/p>\n<p><em><b>Add and remove digit separators<\/b><\/em><\/p>\n<p>This intention uses the <a href=\"https:\/\/github.com\/tc39\/proposal-numeric-separator\/\" target=\"_blank\" rel=\"noopener\">numeric separators<\/a> feature of JavaScript (now it\u2019s a Stage 3 proposal) which allows you to add underscores to the numeric values to improve their readability.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9708\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-add-digit-separators.png\" alt=\"add-digit-separators\" width=\"600\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9709\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-remove-digit-separators.png\" alt=\"remove-digit-separators\" width=\"600\" \/><\/p>\n<h3 id=\"custom_templates_for_postfix_completion\">Custom templates for postfix completion<\/h3>\n<p>Postfix completion is a great feature for adding template code around an expression you\u2019ve just typed. The available templates are listed in <em>Preferences | Editor | General | Postfix Completion<\/em>. They expand when you press Tab or when you select them in the code completion popup.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9626\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-postfix-completion.png\" alt=\"postfix-completion\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-postfix-completion.gif\" \/><\/p>\n<p>Now you can add your own templates for postfix completion!<\/p>\n<p>Let\u2019s see how we can create a template that will expand into a class for a new React component:<\/p>\n<ul>\n<li>In <em>Preferences | Editor | General | Postfix Completion<\/em>, click the <em>+<\/em> icon.<\/li>\n<li>Select the language where the template will work. Note that all JavaScript templates will also be available in TypeScript files.<\/li>\n<li>Select the key (abbreviation). We\u2019ll use <code>rcomp<\/code><\/li>\n<li>Specify the JavaScript language level. For our template, we want it to work only in JSX code.<\/li>\n<li>Now add the template code and add <code>$EXPR$<\/code> in the places where the initial expression should appear. Add <code>$END$<\/code> where you want the cursor to be at the end:<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-title=\"\">class $EXPR$ extends Component {\r\n  render() {\r\n    return (\r\n      &lt;div&gt;\r\n        \r\n      &lt;\/div&gt;\r\n    );\r\n  }\r\n}\r\n\r\nexport default $EXPR$;<\/pre>\n<ul>\n<li>Save the template. Now you can use it in the editor!<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9619\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-custom-postfix-template-in-action.png\" alt=\"custom-postfix-template-in-action\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-custom-postfix-template-in-action.gif\" \/><\/p>\n<h3 id=\"typescript\">Support for TypeScript 2.9 and 3.0<\/h3>\n<p>WebStorm adds support for the following TypeScript 2.9 and 3.0 features:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/pull\/23327\" target=\"_blank\" rel=\"noopener\">`import.meta` property<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/issues\/14844\" target=\"_blank\" rel=\"noopener\">import(&#8230;)-ing types<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/pull\/23430\" target=\"_blank\" rel=\"noopener\">Passing generics to tagged template calls<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/pull\/23592\" target=\"_blank\" rel=\"noopener\">Using number and symbol named properties with keyof and mapped types<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/pull\/24897\" target=\"_blank\" rel=\"noopener\">Tuples in rest parameters and spread expressions<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/pull\/24439\" target=\"_blank\" rel=\"noopener\">New unknown top type<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/pull\/23696\" target=\"_blank\" rel=\"noopener\">Named type arguments &amp; partial type argument inference<\/a><\/li>\n<\/ul>\n<h3 id=\"more_typescript_quick_fixes\">TypeScript quick fixes from the language service<\/h3>\n<p>WebStorm now shows more quick fixes provided by the TypeScript language service. Now you can use not only the quick fixes for the reported errors, but also suggestions like this one:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9772\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/07\/webstorm-quick-fix-from-ts.png\" alt=\"quick-fix-from-ts\" width=\"600\" \/><\/p>\n<p>Press <em>Alt-Enter<\/em> to see the available intentions provided by WebStorm, and those from the TypeScript language service.<\/p>\n<h3 id=\"new_quick_fix_make_method_protected_or_public\">New quick-fix \u201cMake method protected or public\u201d in TypeScript<\/h3>\n<p>We\u2019ve also added a new quick-fix that fixes the visibility of a method if it was inaccessible:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9796\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-ts-fix-method-visibility.png\" alt=\"ts-fix-method-visibility\" width=\"600\" \/><\/p>\n<h3 id=\"use_typescript_language_service_for_all_projects_with_typescript_files\">Use TypeScript Language Service for all projects with TypeScript files<\/h3>\n<p>Now WebStorm uses the TypeScript Language Service for any TypeScript file, even if the project doesn\u2019t have a <em>tsconfig.json<\/em> file. WebStorm will then use the bundled TypeScript version and the default configuration.<\/p>\n<p>You can disable this behavior if you uncheck the <em>\u201cAlso for projects without tsconfig.json\u201d<\/em> option in <em>Preferences | Languages &amp; Frameworks | TypeScript.<\/em><\/p>\n<h2 id=\"json_support\">JSON support<\/h2>\n<h3 id=\"support_for_json\">Support for JSON5<\/h3>\n<p>WebStorm 2018.2 now supports the <a href=\"https:\/\/json5.org\/\" target=\"_blank\" rel=\"noopener\">JSON5<\/a> standard. By default, you can use the new syntax only in files with the <em>.json5<\/em> extension, but you can extend it to all .json files. To do this, open <em>Preferences | Editor | File types<\/em>, find JSON5 in the list and add <em>*.json<\/em> to the registered pattern for it.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9621\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-json-five.png\" alt=\"json-five\" width=\"600\" \/><\/p>\n<h3 id=\"copy_json_pointer\">Copy JSON Pointer<\/h3>\n<p>Another useful improvement in this area is the new action that allows you to copy the JSON pointer, a path-like string for the selected object.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9617\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-copy-json-pointer.png\" alt=\"copy-json-pointer\" width=\"600\" \/><\/p>\n<h3 id=\"improved_support_for_json_schemas\">Improved support for JSON Schemas<\/h3>\n<p>For some time already, WebStorm has been able to validate JSON files and provide code completion in such files using JSON Schema, a special format for describing their structure and contents.<\/p>\n<p>In WebStorm 2018.2, we have improved support for JSON Schema in many ways.<br \/>\nWebStorm can now automatically download and use schemas from the <a href=\"http:\/\/schemastore.org\/json\/\" target=\"_blank\" rel=\"noopener\">JSON Schema Store<\/a> that hosts schema files for many popular configuration files.<\/p>\n<p>As soon as you\u2019ve opened a file whose name is associated with one of the available schemas (for example, <em>composer.json<\/em>), WebStorm will download and use this schema for it. You will see the name of the applied schema in the status bar.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9622\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-json-schema-from-store.png\" alt=\"json-schema-from-store\" width=\"600\" \/><\/p>\n<p>If you have a custom name for a config file, you can manually select a required schema from the list on the status bar.<\/p>\n<p>We have also updated the configuration of custom JSON Schemas that you can add to the IDE and use for specific files in your project. You can now specify the URL of the schema file. It\u2019s available in <em>Preferences | Languages and Frameworks | Schemas and DTDs | JSON Schema Mappings<\/em>.<\/p>\n<h3 id=\"add_missing_required_properties_in_json_files\">Add missing required properties in JSON files<\/h3>\n<p>As we\u2019ve already mentioned in one of the earlier EAP updates, WebStorm can <a href=\"https:\/\/blog.jetbrains.com\/webstorm\/2018\/05\/webstorm-2018-2-eap\/#improved_support_for_json_schemas\">validate your JSON files using the JSON Schema<\/a>. We\u2019ve added a quick fix that allows you to add all the missing required properties to your JSON file.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-9710\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-json-add-required-properties.png\" alt=\"json-add-required-properties\" width=\"600\" \/><\/p>\n<h2 id=\"linters\">Linters integration<\/h2>\n<h3 id=\"different_highlighting_for_tslint_errors_and_warnings\">Different highlighting for TSLint errors and warnings<\/h3>\n<p>WebStorm now respects severity levels selected for rules enabled in the TSLint configuration file. By default, the errors will now be highlighted with a red squiggly line, while warnings will be marked with a yellow background.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9649\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-tslint-severity.png\" alt=\"tslint-severity\" width=\"600\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9650\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-tslint-severity-highlighting.png\" alt=\"tslint-severity-highlighting\" width=\"600\" \/><\/p>\n<h3 id=\"tslint_and_eslint\">Automatically apply code style rules from all types of ESLint and TSLint configuration files<\/h3>\n<p>For some time already, WebStorm has enabled you to apply the known code style rules specified in the ESLint and TSLint configuration files to the IDE JavaScript or TypeScript code style settings.<\/p>\n<p>Now WebStorm can <em>automatically import known rules from any configs<\/em> when you open your project for the first time, as long as you have ESLint (or TSLint) installed. (This is because WebStorm needs to run ESLint itself to transform the config into JSON that the IDE understands.)<\/p>\n<p>Before, WebStorm did this only for simpler configs written using JSON. For configs written in JavaScript or YAML or extending some preset, WebStorm required you to use the <em>Apply ESLint Code Style Rules<\/em>\u00a0action. Now, you still need to use the action if you\u2019ve updated your ESLint or TSLint configuration. It\u2019s available via the <em>Find Action<\/em> popup or in the file\u2019s context menu.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9668\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-apply-tslint-rules.png\" alt=\"apply-tslint-rules\" width=\"600\" \/><\/p>\n<p>By the way, you can now also apply code style for the TSLint configurations that have the <code>extends<\/code> field. For example, if your\u00a0<em>tslint.json<\/em> file extends the <em>tslint-config-standard<\/em>\u00a0preset, WebStorm will automatically apply the rules related to the use of semicolons and defined in the preset to the TypeScript code style settings in the IDE.<\/p>\n<h2 id=\"debugger\">Debugging<\/h2>\n<h3 id=\"breakpoint_intentions\">Breakpoint intentions<\/h3>\n<p>You can now simply press Alt-Enter on a line with a breakpoint and see the breakpoint-related actions in the list, along with all the other available intentions!<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9799\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/07\/webstorm-brk-intentions.png\" alt=\"brk-intentions\" width=\"600\" \/><\/p>\n<h3>Drop frame in debugger<\/h3>\n<p>Now you can use the Drop frame action when debugging JavaScript and Node.js. This can be helpful to re-enter a function if you missed a critical spot you would like to see again.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9653\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-drop-frame.png\" alt=\"drop-frame\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-drop-frame.gif\" \/><\/p>\n<h3 id=\"debug_scratch_files\">Debug scratch files<\/h3>\n<p>You can now debug JavaScript scratch files \u2013 temporary files that you can quickly create by using the <em>Cmd-Shift-N<\/em> shortcut on macOS or <em>Ctrl+Shift+Alt+Insert<\/em> on Windows and Linux.<\/p>\n<p>Put the breakpoints anywhere in your file and then press <em>Ctrl-Alt-D \/ Alt+Shift+F9<\/em> to start debugging it using the built-in Node.js debugger. Please keep in mind that your code will be run using node, which means it should not use any browser APIs or any syntax that is currently not supported in node.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9667\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-debug-scratch-file.png\" alt=\"debug-scratch-file\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-debug-scratch-file.gif\" \/><\/p>\n<h2 id=\"testing\">Testing<\/h2>\n<h3 id=\"rerun_failed_tests\">Rerun failed tests<\/h3>\n<p>There\u2019s a new <em>Rerun Failed Tests<\/em> action available when you run tests with Karma, Jest, or Mocha in WebStorm. As the name suggests, it allows you to rerun only those tests that have failed, instead of running all tests after the fix.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9731\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-rerun-failed-tests-button.png\" alt=\"rerun-failed-tests-button\" width=\"600\" \/><\/p>\n<h3 id=\"navigate_to_jest_snapshot\">Navigate to Jest snapshot<\/h3>\n<p>If you are doing snapshot testing with Jest, you will notice a new icon shown on the left editor gutter when your test file is opened. Use it to navigate to the related snapshot file. Or put the caret on <em>toMatchSnapshot<\/em> and use the <em>Related Symbol<\/em> action.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9800\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/07\/webstorm-navigate-to-jest-snapshot.png\" alt=\"navigate-to-jest-snapshot\" width=\"600\" \/><\/p>\n<h3>Diff view for Jest snapshots<\/h3>\n<p>If your Jest test has failed because of the mismatch in the snapshot, you can now see why using the familiar IDE side-by-side diff view. To open it, click on the link in the Run tests tool window.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-9793\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/07\/webstorm-jest-diff.png\" alt=\"jest-diff\" width=\"600\" height=\"1195\" \/><\/p>\n<h3 id=\"debugging_karma_tests_using_chrome_headless\">Debugging Karma tests using Chrome Headless<\/h3>\n<p>Karma allows you to use Chrome Headless for running your tests (check out this great <a href=\"https:\/\/developers.google.com\/web\/updates\/2017\/06\/headless-karma-mocha-chai\" target=\"_blank\" rel=\"noopener\">tutorial<\/a> in the Chrome blog). With Karma, your tests are executed in a real browser environment but without the overhead created by running a full Chrome instance.<\/p>\n<p>WebStorm now enables you to debug Karma tests in Chrome Headless (whereas previously you could only run them there).<\/p>\n<p>To run and debug tests in Chrome Headless using Karma, add <code>browsers: ['ChromeHeadless']<\/code> to the <em>karma.conf.js<\/em> file, or list it as a browser in WebStorm\u2019s Karma configuration (see the screenshot below). For more info on setting up your project to use Chrome Headless, see this <a href=\"https:\/\/developers.google.com\/web\/updates\/2017\/06\/headless-karma-mocha-chai\" target=\"_blank\" rel=\"noopener\">tutorial<\/a>.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9624\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/05\/webstorm-karma-headless-debug-config.png\" alt=\"karma-headless-debug-config\" width=\"600\" \/><\/p>\n<h3 id=\"test_files_in_the_tests_scope\">Test files in the Tests scope<\/h3>\n<p>Now, test files whose names follow common patterns like <em>*.test.js<\/em> or <em>*.spec.js<\/em> are now automatically added to the default Tests scope. You can select this scope in the Project view to see the test files available in the project. Or you can use it to configure the use and severity of inspections.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9680\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-tests-scope-in-project-view.png\" alt=\"tests-scope-in-project-view\" width=\"600\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9681\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/06\/webstorm-tests-scope-in-inspection-profile.png\" alt=\"tests-scope-in-inspection-profile\" width=\"600\" \/><\/p>\n<h2 id=\"version_control\">Version Control<\/h2>\n<h3 id=\"improvements_in_the_version_control\">Automatically register Git and Mercurial repos as VCS roots<\/h3>\n<p>If you open a folder that is part of a Git or Mercurial repository, WebStorm now automatically enables version control integration for it. So, no more \u201cunregistered roots detected\u201d notifications when you open a project.<\/p>\n<h3 id=\"new_browse_repository_at_revision_action\">New Browse Repository at Revision action<\/h3>\n<p>With the new <em>Browse Repository at Revision<\/em> action, which is available from the context menu in the VCS Log or from the file history, you can now explore files in your project at any given revision without a checkout. From the special Repositories view, you can see the project structure and view the files in read-only mode.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9773\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/07\/webstorm-repositories-tool-window.png\" alt=\"repositories-tool-window\" width=\"600\" \/><\/p>\n<h3 id=\"delete_a_git_tag_in_log\">Delete a Git tag in Log<\/h3>\n<p>You can now remove Git tags from a commit right from the context menu of the Log tab.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9774\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/07\/webstorm-delete-tag.png\" alt=\"delete-tag\" width=\"600\" \/><\/p>\n<h3 id=\"completion_for_git_tags\">Completion for Git tags<\/h3>\n<p>WebStorm now autocompletes tags in the <em>Checkout<\/em> dialog.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9775\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/07\/webstorm-completion-for-tags.png\" alt=\"completion-for-tags\" width=\"600\" \/><\/p>\n<h3 id=\"perforce_and_cvs_plugins\">Plugins for Perforce and\u00a0CVS now need to be installed separately<\/h3>\n<p>If you want to use the <a href=\"https:\/\/plugins.jetbrains.com\/plugin\/69-perforce-integration\" target=\"_blank\" rel=\"noopener\">integration with Perforce<\/a>\u00a0or <a href=\"https:\/\/plugins.jetbrains.com\/plugin\/10746-cvs-integration\" target=\"_blank\" rel=\"noopener\">CVS<\/a>\u00a0in WebStorm, you now need to install the corresponding plugin\u00a0via <em>Preferences | Plugins &#8211; Install JetBrains plugins<\/em>. These plugins\u00a0fully bring the functionality\u00a0that was earlier available in WebStorm out-of-the-box.<\/p>\n<h2 id=\"other_ide_improvements\">Other IDE improvements<\/h2>\n<h3 id=\"global_file_watchers\">Touch Bar support<\/h3>\n<p>Last, but not least is the <strong>MacBook Touch Bar<\/strong>\u00a0support.<\/p>\n<p>Now you can run, build, and debug your project, along with committing changes or updating the project right from the Touch Bar. The Touch Bar shows the controls depending on the context or which modifier keys you press. We support the most popular contexts, and even better \u2013 the contexts can be customized! Read more in the <a href=\"https:\/\/blog.jetbrains.com\/idea\/2018\/05\/intellij-idea-2018-2-early-access-program-is-open\/\">IntelliJ IDEA\u2019s blog<\/a>.<\/p>\n<h3 id=\"dark_window_headers_on_macos\">Dark window headers on macOS<\/h3>\n<p>If you like the dark theme and you use macOS, you can now make WebStorm ever darker with the dark window headers. To turn them on, go to <em>Preferences | Appearance &amp; Behavior | Appearance<\/em>, select the new <em>Use dark window headers<\/em> option, and restart the IDE to apply the changes.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9776\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2018\/07\/webstorm-dark-header-mac.png\" alt=\"dark-header-mac\" width=\"600\" \/><\/p>\n<p>For the full list issues and bugs fixed in WebStorm 2018.2, please see the <a href=\"https:\/\/youtrack.jetbrains.com\/releasenotes\/WEB?q=Fix%20versions:%202018.2%20%23Resolved%20\" target=\"_blank\" rel=\"noopener\">release notes<\/a>.<\/p>\n<p><em>WebStorm Team<\/em><\/p>\n","protected":false},"author":221,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","categories":[907],"tags":[2822,263,2812,2837,2720,2855,2801,365,1290,207,2835,2844,2850],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/webstorm\/23041"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/webstorm"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/types\/webstorm"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/users\/221"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=23041"}],"version-history":[{"count":0,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/webstorm\/23041\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=23041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=23041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=23041"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/cross-post-tag?post=23041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}