GoLand 2018.2 Early Access Program is open! Native vgo support, better inspections, new quickfixes, multiple GitHub accounts and TouchBar support
Today we are happy to announce the start of the 2018.2 Early Access Program!
During the next few months, we plan to release updates based on the IntelliJ Platform 2018.2, and we would like to invite you to help us test and shape the future of this release. As usual, this release will feature a mix of new Go specific features as well as Web and Platform specific features.
Important! EAP builds are not fully tested and may be unstable.
Without further comments, let’s dive into what’s new for Go in this release.
Major changes
vgo support is now available by default in the IDE, no need to install an extra plugin. You can read more about how this work in our previous blog post.
When the IDE detects that a type does not implement an interface that you want to use, the IDE will now tell you why explaining more clearly what’s happening.
While the above picture shows an issue with a missing method, sometimes, you may implement a method with a similar name but with a different set of parameters. In this case, the IDE will explain what needs to be changed to the method to make it compliant with the interface you are trying to implement.
Knowing why an interface is not implemented by a type is not enough, so the IDE now allows you to also implement the interface straight from the place where the usage occurs.
The debugger now supports non-suspending breakpoints, which means you can set a breakpoint and log it in the console or even get the stacktrace of the breakpoint when it was reached.
Fixes and quality of life improvements
When viewing the overall benchmark results, you’ll now see the benchmark name as well.
The built-in formatter had more changes and bug fixes applied to make it better replicate the gofmt style.
You can see all the changes that are part of this release on the following page.
Web changes
React code snippets
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 plugin for VS Code.
Type the abbreviation in the editor and then press Tab to expand it. Or press Cmd/Ctrl-J (Insert Live Template) and select the snippet from the list. All abbreviations are also available in the completion popup.
Here we use the abbreviation rcjc
to create a class that defines a new React component:
You can find the full list of available templates in Preferences | Editor | Live Templates – React.
For the JSX tags, you can now also see the breadcrumbs and colorful highlighting for the tag tree on the editor gutter.
Custom templates for postfix completion in JavaScript and TypeScript
Postfix completion is a great feature for adding template code around an expression you’ve just typed. The available templates are listed in Preferences | Editor | General | Postfix Completion. They expand when you press Tab or when you select them in the code completion popup.
Now you can add your own templates for postfix completion!
Let’s see how we can create a template that will expand into a class for a new React component:
- In Preferences | Editor | General | Postfix Completion, click the + icon.
- Select the language where the template will work. Note that all JavaScript templates will also be available in TypeScript files.
- Select the key (abbreviation). We’ll use
rcomp
- Specify the JavaScript language level. For our template, we want it to work only in JSX code.
- Now add the template code and add
$EXPR$
in the places where the initial expression should appear. Add$END$
where you want the cursor to be at the end:class $EXPR$ extends Component { render() { return ( <div> </div> ); } } export default $EXPR$;
- Save the template. Now you can use it in the editor!
Debugger improvements
Debugging Karma tests using Chrome Headless
Karma allows you to use Chrome Headless for running your tests (check out this great tutorial on 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.
WebStorm now enables you to debug Karma tests in Chrome Headless (whereas previously you could only run them there).
To run and debug tests in Chrome Headless using Karma, add browsers: ['ChromeHeadless']
to the karma.conf.js file, or list it as a browser in WebStorm’s Karma configuration (see the screenshot below). For more info on setting up your project to use Chrome Headless, see this tutorial.
Reconnect the debugger to the running node process
We have added a new Reconnect automatically option to the Attach to Node.js/Chrome debug configuration.
Thanks to this option, it is now easier to debug Node.js apps that use nodemon. Nodemon is a utility that automatically reloads your node process when you change the code of your app.
Here’s how you can debug such an application:
- Start your app in the debug mode. To do this, pass an
--inspect
flag to nodemon. You can create and run a newnpm debug script
that would look like this:debug": "nodemon --inspect ./app.js
(be sure to replace ./app.js with the path to the file that starts your app). - Create a new Attach to a Node.js/Chrome configuration and select the Reconnect automatically check-box.
- Usually, you don’t need to change the port in the configuration (9229) because it’s 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.
- Now run the new configuration. The debugger will stop on the breakpoints that you’ve put in your code in the IDE.
- 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.
Platform changes
Touch Bar support
MacBook owners that have a Touch Bar will be happy to hear that now the IDE can make use of it.
For those of you who were expecting the MacBook Touch Bar support in GoLand, we have some welcome news for you – your days of waiting are over! The upcoming GoLand 2018.2 introduces the Touch Bar support!
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 – the contexts can be customized!
The GoLand buttons are displayed in the app-specific area in the middle of the Touch Bar interface, while its left part does not change in different contexts, the VCS buttons can be replaced.
To select a configuration, press on the run/build configuration popover.
If no configurations have been created, the Touch Bar shows the Add Configuration button.
The debugger is an essential part of the IDE, so we have given it its own particular layout, so when the Debug Tool Window becomes active, the Touch Bar shows:
When the debugger is paused or has stopped at a breakpoint, the Pause button is replaced with a Resume button, and the Touch Bar displays the Step and the Evaluate Expression buttons:
Need more debugger actions? Press the Alt key.
For the dialogs, the confirmation buttons are displayed in the center of the Touch Bar.
How to customize the Touch Bar?
You can currently configure both the main context and the debugger context of the Touch Bar. If you have a laptop with a Touch Bar, there is now a new Touch Bar page under Preferences | Appearance & Behaviour | Menus and Toolbars.
Try it right now and see for yourself. We’d love to hear about your experience of using the Touch bar with GoLand; please share your feedback with us!
Version Control Systems
Improvements are also being made for Version Control Systems. Firstly, to make it much easier for you to find files with merge conflicts, the upcoming GoLand 2018.2 groups such files under a new Merge Conflicts node for each changelist. You can invoke and resolve the merge conflicts by clicking on the Resolve action.
Favorite branches were added to the Branch filter in the Log tab of the Version Control tool window, so you can now quickly filter commits by your favorite branches.
One more improvement to the VCS Log tab is that you can now open as many Log tabs as needed, set different filters for each Log tab, and monitor the changes in separate tabs. There is no need to switch back and forth between different filters anymore.
Additionally, you can now preview Diff in the VCS Log.
It is now possible to skip the Push dialog when using Commit and Push action or show it only when pushing to protected branches.
The upcoming GoLand 2018.2 brings support for multiple GitHub accounts. Now you can easily work on your company project and your pet project without the need to switch GitHub account – just configure all accounts you use in the Settings | Version Control | GitHub, and specify the default GitHub account per project.
We’ve also improved the support for the JSON files in the upcoming GoLand v2018.2.
First of all, the IDE now supports JSON schema v4, schema v6, and schema v7.
You can now easily apply the required JSON schema for a chosen file using the brand new JSON schema drop-down menu in the status bar. To edit the existing Schema Mappings or create your own schema – click Edit Schema Mappings…
Another useful improvement in this area is the new action to copy JSON editor breadcrumbs. You can copy either a qualified name or a JSON Pointer. To invoke this action right-click in the editor breadcrumbs.
To check the compliance of a JSON file to an applied JSON schema we’ve added a new inspection.
That’s it for now! Download the first EAP build and give it a thorough try! As usual, we look forward to your feedback: discussion forum, issue tracker, Twitter or here in the comments!
Happy developing!
P.S. The Toolbox update is also available now!