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 :)

800x400_blog@2x

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.

vgo support

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.

vgo support

Refactorings

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.

The new Move Refactoring dialog

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.

Quick-fixes

A new quick-fix called Convert to expected type is available to convert a value to the desired type whenever the language permits.

Convert to Expected Type quick-fix

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 Missing Method Quick-Fix

Code Generation

Implement Methods is now able to not only add methods from an interface to a chosen type, but also create this type right away.

Implement Methods

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.

dot Import Alias Intentions

Completion

The family of Postfix Completion templates gets new members: .sort and .rr.

The .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 sort.Slice method.

sort.Slice Postfix Completion template

The .rr template combines the power of two already available templates, .rre and .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.

Code Style

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.

Disable leading spaces for annotations

Debugger

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.

debugger_breakpoints_2018_2

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.

Performance

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.

Files Merged with Conflicts dialog

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.

User Interface

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?

800x400@2x

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.

File Watchers

Frontend development

Thank to our colleagues on the WebStorm team, GoLand includes the following improvements for frontend-related technologies:

  • A collection of React-specific live templates for JavaScript, TypeScript, and JSX: over 50 abbreviations that expand into different statements and blocks of code often used in React apps. All abbreviations are also available in the completion popup. You can find the full list of available templates in Settings | Editor | Live Templates | React.
  • 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.
  • Custom templates for postfix completion in JavaScript and TypeScript: Settings | Editor | General | Postfix Completion. They expand when you press Tab or when you select them in the code completion popup. Also, now you can add your own templates for postfix completion.
  • 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.
  • You can now debug JavaScript scratch files (the code will be run using Node).
  • The IDE now uses the TypeScript Language Service for any TypeScript file, even if the project has no tsconfig.json file.

Other

  • 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 gofmt.
  • 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 --rm option in Docker Run/Debug сonfigurations to launch a temporary container which will be automatically cleaned up after termination.

Grab your GoLand 2018.2 Beta from our website, update via Toolbox App, or install it beside your stable GoLand version.

Finally, we love hearing from you! Feel free to suggest a new feature or report a problem in whatever way works for you: this blog post, the issue tracker, or Twitter.

About Andrey Cheptsov

Part-time dreamer. JVM/JavaScript geek. IntelliJIDEA Marketing Manager at JetBrains.
This entry was posted in EAP, New Features and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *