GoLand 2018.2 Beta: vgo, Move, Quick-fixes, Postfix Completion, debugger, VCS, and More
We are happy to announce that GoLand 2018.2 Beta is now available to try!
You can already try features that are coming in the next major version. Compared to the updates we’ve made available over the last two months via our EAP program, the Beta is relatively stable, though it may still have bugs and other issues. If you’ve been following our news, you’ve probably noticed we typically call this kind of update a ‘Public Preview’ – we’re no longer working on major changes but instead focusing on fixing bugs and polishing everything. Well, this Beta is exactly the same inside except we’ve applied the Rename refactoring 🙂
With naming issues cleared up, you are welcome to get this update working on your machine and try it out!
Let’s have a look closer at what this Beta has in store.
GoLand 2018.2 provides integration with Versioned Go Prototype out of the box and supports its latest version. Read this blog post for more details.
Note: Before using, please make sure vgo is upgraded to this or a newer version.
We’ve improved the Move refactoring in a couple of ways:
- The new Move dialog shows whether an identifier is needed, and lets you decide if each of the identifiers will be exported or moved.
- The refactoring now enables cross-package moving of symbols. If the move is not possible, the IDE will alert you accordingly.
Besides, this update levels up Extract Variable to work with multi-value expressions.
Extract Method can now extract code into new methods on the type that the code belongs to.
A new quick-fix called Convert to expected type is available to convert a value to the desired type whenever the language permits.
Another noticeable addition, Implement missing methods, lets you quickly add missing methods if the expected type is an interface. For example, 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.
Implement Methods is now able to not only add methods from an interface to a chosen type, but also create this type right away.
New Intention Actions
A new intention action, Introduce local variable, lets you add the variables for function/method calls that return values.
It is now quicker to use the dot import alias or to switch back to using the package name, by using one of two intentions as appropriate.
The family of Postfix Completion templates gets new members:
.sort template transforms array or slice expressions and prepends them with an applicable sort method based on the element type. If the element type is a custom type, it will use the
.rr template combines the power of two already available templates,
.rrv, and сan be called on variables and expressions at the same time.
GoLand 2018.2 supports more scenarios where the completion engine suggests return values based on their type.
In addition, method names are now available in Smart Completion.
As you know, in Go language, comments are also used as annotations. In some libraries, spaces between comment markers and annotation instructions are not processed correctly.
In GoLand 2018.2, it is now possible to disable leading spaces for annotations that start with certain prefixes. If you go to Settings | Editor | Code Style | Go | Other, you will now see a custom exclusion list for the Add leading space to comment option. Use the Except for space to comments field to add any prefix name that you want to add as an exception.
Debugging in GoLand 2018.2 gets a set of improvements.
First off: non-suspending breakpoints. The debugger lets you set a breakpoint and log it in the console, or even get the stacktrace of the breakpoint when it was reached and then resume the execution. You can also do these actions when a breakpoint is hit and it stops.
Also, the debugger now supports lazy-loading for arrays, maps, and slices; supports deep nesting in maps; and offers a better presentation of key-value pairs in maps and slices.
In addition, this update comes with the latest version of Delve. It resolves a number of issues.
Goland 2018.2 comes with pre-built indices for the Go SDK 1.10. Now, when you set up the IDE for the first time and create your first new project, the IDE will finish the indexing much quicker for the Go distribution.
Version Control System
Sooner or later, everyone who works with Git faces merge conflicts. Sometimes this leads to difficulties which aren’t so easy to overcome. The upcoming GoLand 2018.2 will provide several updates to make this process pain-free.
A new Merge Conflicts node groups files with merge conflicts for each changelist, making it much easier to find them. The Resolve action link will open an improved Files Merged with Conflicts dialog. Now it displays the Git branch names when you perform a Pull, Merge, or Rebase, and allows you to group files by directory, which is especially useful when you have multiple files merged with conflicts.
The Log tab of the Version Control tool window gets a few nice improvements. Now you can:
- Open as many Log tabs as you need.
- Quickly filter commits by your favorite branches with the Branch filter.
- Easily delete a Git tag from a commit right from the context menu.
- Explore the Diff Preview Panel without switching the context.
- Monitor the state of the repository using the new Browse Repository at Revision action via the context menu, available only for Git for version control.
In addition, in the new version you will find an option to skip the Push dialog completely when using the Commit and Push action. Alternatively, you can choose to only show this dialog when pushing to protected branches. Set this up in Settings | Version Control | Git.
Finally, the icing on the cake is support for multiple GitHub accounts. Now you can easily manage as many GitHub account as you need without switching between them. Just configure all accounts you use in the Settings | Version Control | GitHub, and set the default GitHub account for each of your projects.
Good news for you, MacBook Pro owners! GoLand 2018.2 provides a completely new IDE experience: run, build, debug your project, commit changes and more – right from the Touch Bar. Sound cool enough?
The GoLand buttons are displayed in the app-specific area in the middle of the Touch Bar interface. They are dependent on the context or which modifier keys you press.
All the available Touch Bar contexts can be customized on the Touch Bar page in Settings | Appearance & Behavior | Menus and Toolbars.
In a related change, we have implemented an ability to make the GoLand title bars darker. Go to Settings | Appearance & Behavior | Appearance and select Use dark window headers to try this out.
Last but not least, like other IDEs based on IntelliJ Platform, GoLand gets new icons. Read this blog from our UI Team for a look behind the scenes at how our icons and toolbars have changed their colors, shapes, and style, and what the team is planning for the future.
The File Watchers plugin
If you haven’t tried File Watchers before, here is a quick overview. File Watchers is a GoLand system that tracks changes to your files and runs third-party standalone applications. It is available under Settings | Tools | File Watchers and enabled by default. GoLand provides predefined File Watcher templates for a number of such standard popular third-party tools (compilers, compressors, prettifiers, and others). You can also configure a custom File Watcher to run any other third-party tool.
In this release cycle, File Watchers gets a simple, but very user-friendly feature which helps reduce setup redundancy for developers working with many projects.
Previously, it was possible to set a File Watcher only per project. Now you can configure the level of impact to choose between the Project and Global option. You can also limit the scope to enable/disable the state of each Global Watcher per project.
Thank to our colleagues on the WebStorm team, GoLand includes the following improvements for frontend-related technologies:
- GoLand can now help you create a new React component by extracting the JSX code from the render method of an existing one.
- Support for Node.js on Windows Subsystem for Linux.
- Support for TypeScript 2.9 and 3.0.
- Ability to manage logs when running a Node.js app.
- It’s now possible to debug Karma tests in Chrome Headless.
- A new Reconnect automatically option in the Attach to Node.js/Chrome debug configuration. Thanks to this option, it is now easier to debug Node.js apps that use nodemon.
- In Vue templates, the IDE now provides code completion for events and event modifiers.
- The IDE now uses the TypeScript Language Service for any TypeScript file, even if the project has no
- When using the C package, the automatic imports optimizer is less aggressive in removing C imports.
- The built-in formatter is now better at formatting structure fields and tags, which makes our formatting engine more similar to
- External tools now have the correct sets of GOROOT and GOPATH environment variables.
- Docker gets an option to specify the base directory for executing a Docker build command for a dockerfile in the Context folder field of the Docker run configuration.
- The Docker plugin now recognizes several new runtime command line options in the run configuration: all the memory options,
--security-opt, and the option to support GPU:
--runtime=nvidia. Additionally, you can now use the
--rmoption in Docker Run/Debug сonfigurations to launch a temporary container which will be automatically cleaned up after termination.