Hi, Habr!
GoLand 2018.1 came out late last week! For our team, this release is special, this is the first major update of the IDE since its launch four months ago. Editing tips and code navigation, which our team is proud of, have become even smarter and more convenient. Integration with many tools brought to mind. The update supports partial Git commits, integration with
Dep , debugging of local Go processes, improved support for
Docker Compose , added hints for editing
Kubernetes files, and much more.
')
Below is more about what got into the release.
Refactoring
In this update, we have added
Move refactoring. With it, you can quickly move to another file within the same package any top-level character:
The name suggestion algorithm used by
Extract Variable now takes context into account and avoids name collisions.
Rename refactoring for global characters now works much faster (like
Find Usages ).
Autocompletion
The Boolean expression suggested by the compiler can now be selected while denying at the same time by pressing "!":
If the cursor is located to the right of the return statement inside a function, autocompletion suggests default values ​​according to the type of value returned by the function:
The new version added two templates
Postfix Completion .
• The new “.if” template converts a boolean expression into an if statement:
• The new “.p” template inserts a pointer operator at the beginning of an expression.
Intention actions
The update has several new
Intention actions , for example
Flip for binary expressions ,
Negate recursively and
Negate for boolean expressions:
In addition to
Negate , you can now also use
Invert for the
if expression:
Other supporting tools
Here are some other improvements that will help you in your work:
- The automatic import mechanism has become smarter and now works only if the resulting code is compiled without errors.
- If the cursor is on a call from a chain or on a string literal, by pressing Enter the IDE automatically formats the received code.
- The editor can now remove import statements for unused packages right while working in the editor. This parameter is called Optimize imports on the fly . It can be enabled in the Settings | Go | Imports .
- The Quick Documentation pop-up window now considers examples of functions and includes them in the documentation. If you click on the name of the example function, the IDE will open the Scratch File with the code for this function:
Scratch files
These same
Scratch Files , with which you may have already experimented, provide an
Go Playground editing session with full IDE support. In the new version they also became better. First, the
Scratch File , created from the selected Go code, now automatically adds all the necessary expression imports. Secondly, such files are now created from templates, which can be configured in the
Settings |
Editor |
File and Code Templates .
Debugger
In the new version, the debugger can be attached to locally running processes. To do this, simply click
Run in the main menu and select
Attach to Local Process :
IDE prompts you to select a process to debug:
After selecting the process, the
Debugger tool window opens and breakpoints begin to take effect.
Dep
Another important news is that the latest update has added support for the dep tool for managing dependencies.
When an existing dep project is imported, the IDE detects dep and asks to enable integration with it.
If, when working with the
dep project
, open a file that has an unresolved import statement, IDE offers
quick-fix , which starts
dep ensure :
Go 1.10 support
All IDE tools for working with the code are updated and fully support all the features of
Go 1.10 .
Code style
Among the parameters of the
Code Style there are several new ones:
Use back quotes for imports ,
Add parentheses for a single import and
Add leading space to comments .
VCS
Another major innovation in the latest update - support for partial Git commits has finally emerged.
Now you can choose which changes in the file you need to include in the commit:
These individual changes within the file can be distributed in different
Changesets . To do this, click on the change marker located on the left pane of the editor:
New actions for
rebasing have appeared in the pop-up window of
Git Branches :
Abort Rebase ,
Continue Rebase and
Skip Commit .
Finally, the
VCS tool window now allows you to group changes into repositories.
User interface
The
Replace in Path popup preview now works, even if a regular expression is used.
Any folder from the
Project tool window is now easy to open in the terminal window. To do this, use the action
Open in Terminal .
In addition, the IDE now correctly handles fractional scale factors when using multiple
HiDPI monitors.
Performance
In the new version, you can improve IDE performance by limiting the indexing area for a project, for example, in order not to index the entire
GOPATH .
Javascript / typeScript
Support for frontend technologies such as
TypeScript and
JavaScript has been greatly improved by the achievements of the WebStorm team.
Here are the most important changes:
- TypeScript 2.7 support
- New quick-fix Surround with type guard for "unresolved" properties.
- Rename refactoring for classes also suggests renaming the file. This refactoring can now be called through the Intention action on the class.
- If the Prettier package is installed , the Reformat with Prettier action appears in the IDE.
- New refactoring Extract a Vue component .
- It has become more convenient to work with package managers. Now you can explicitly select npm or Yarn to install dependencies and run scripts.
- If you have already switched to Webpack 4 , the IDE offers hints for parameter names in the webpack configuration file.
- Now npm scripts can now be executed directly from the editor using the icons on the left panel, like tests.
miscellanea
Finally, it is impossible not to mention the new plugin for
Kubernetes :
More information about working with the plugin can be found in a post on the blog
IntelliJ IDEA .
Here is such a long list. We hope you find some of this useful. And if not, tell us what you are missing or would like to add.
You can learn more about these and other changes on the
What's New page.
Download the update on the
download page or through the
Toolbox App .
As always, we welcome your feedback and will try to answer any questions.
Pleasant development!