1

GoLand 2021.3 EAP #6: Type Inference for Generics, Remote Development, gRPC Requ...

 2 years ago
source link: https://blog.jetbrains.com/go/2021/10/29/goland-2021-3-eap-6-type-inference-for-generics-remote-development-grpc-requests-in-the-http-client/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Early Access Program

GoLand 2021.3 EAP #6: Type Inference for Generics, Remote Development, gRPC Requests in the HTTP Client

Sergey Kozlovskiy
Sergey Kozlovskiy October 29, 2021

GoLand 2021.3 EAP #6 is available. 

You can get the EAP build via the Toolbox App, download it from our website, use a snap package (for Ubuntu), or from inside GoLand, select Check IDE updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.  

Download GoLand 2021.3 EAP #6

Type inference for generics

Generics are coming to Go. Unless something changes drastically, type parameters will be available in Go 1.18, which should be released in February 2022. 

We began working on supporting type parameters in GoLand some time ago. In this build, we’re ready to give you type inference for generics. 

Currently, it is mostly invisible from the perspective of a user, as IDE subsystems such as inspections, completion, and others need to be updated to recognize instantiated types. This will be our next step, so stay tuned!

Remote development with JetBrains Gateway

We have a big announcement this week – GoLand now supports remote development! We have to warn you, though, that this is an early preview, meaning the functionality is still unstable. Also, we can’t guarantee that remote development for GoLand will be fully supported in 2021.3; it might take us a little longer to polish it up.

With that disclaimer out of the way, let’s see how it works. Support for remote development is provided through JetBrains Gateway, our new application that allows you to deploy and run the IDE on a remote server. 

With JetBrains Gateway you can:

  1. Develop on any machine. Software developers are not limited by the power of their local devices – they can use as many resources from their remote machine as needed.
  2. Take advantage of a flexible environment configuration. Remote development environments can be separated from your local machine configuration. This can help avoid version conflicts and aid you in navigating between workspaces.
  3. Have source code–free laptops. No source code is hosted on the developer’s machine when they are using the remote development workflow. The company’s data remains secure in authorized repositories.
  4. Work securely from anywhere. The remote development functionality supports working from home and hybrid schedules, with your projects securely located on the remote machine and accessible from anywhere.

Below is a brief overview of how to get started with JetBrains Gateway (or you can find more detailed instructions on this page). 

How to use JetBrains Gateway

Download JetBrains Gateway from here and install it. Open the application and click Connect via SSH

If you’ve previously configured an SSH connection (such as for a run target), you can select the connection from the dropdown list.  

If not, set up a new connection by specifying the username and the host address of the remote machine you want to connect to (change the port if you’re not using the default port 22). Then click Check Connection and Continue

JetBrains Gateway will then ask you for the password (if you use one) to connect to your remote machine.

rm3root.png

Then you’ll need to enter your SSH key passphrase, if you configured one when you created the SSH keys.   

rm4root.png

Finally, you will see a window where you can select GoLand from the dropdown menu. Enter the path for your Go projects and click Download and Start IDE.  

rm5root.png

HTTP client enhancements

In this release cycle we have significantly improved the HTTP client. We added support for gRPC requests, output redirection to a custom file or directory, support for text and JSON streams, support for HTTP request identifiers, and support for binary responses. Let’s take a closer look at these new features.

gRPC requests in the HTTP client

GoLand’s HTTP client now supports gRPC requests. Simply start your requests with the GRPC keyword to have the HTTP client treat them as gRPC requests. 

The HTTP client now provides completion for gRPC: all known gRPC services, unary and server-streaming methods of a particular server, and, most importantly, fields of accepted messages in the request body.

grpc-completion.gif

You can automatically generate a gRPC request in the HTTP client by simply clicking on the gutter icons in your .proto files.

generate-req.gif

Currently the supported RPC types that can be executed in the HTTP client are unary and server-streaming. Like in ordinary HTTP requests, the request body and responses are plain JSON files.

streaming-http.1.gif

gRPC functionality is available thanks to two plugins – Protocol Buffers and gRPC, which are now bundled with GoLand.  

Support for text streams and JSON streams in the HTTP Client

It is now easier to test streaming applications in your favorite IDE because the upcoming release supports the following content types: text/event-stream, application/stream+json, and application/x-ndjson. This means the HTTP client will no longer wait for a stream to end and will instead display the output on the fly.

The HTTP client will also listen for the end of a stream and will show a message when the process is finished.

Binary responses in the HTTP client

In the upcoming release, the HTTP client shows an image preview in the response console if a response is an image.

The HTTP client does not show a preview for a response if it isn’t clear whether it is a text response.

http-binary-response-1.png

Output redirection to custom file or directory

The HTTP client can now redirect output to a custom file or directory. It supports two operators for force and soft redirects:

  • The >> operator always creates a new file, adding an -n suffix to a file name if the requested file name already exists.
  • The >>! operator rewrites the file if it already exists.

Support for HTTP request identifiers

GoLand now understands identifiers (or names) for requests. It understands identifiers that were declared as a comment with @name, as well as those declared as text in the first separator (###).

You can invoke a request by its identifier from the Services tool window or from the Run Configuration, Run Anything, or Search Everywhere dialogs.

Support for URLs in import statements in ES6

You can now download remote ES6 modules using a quick-fix on the import path in ES6 files. The module with all its dependencies will be downloaded and linked as a project library. The functionality should work the same way it does in the browser. To give it a try, place the caret on the import path, press ⌥↩ (Alt+Enter), and then select Download module.

url-import-js.png

Source preview for Show Usages

The Show Usages feature (⌥⌘F7 / Ctrl+Alt+F7) has received a small yet handy improvement in this release. You can now turn on the source code preview for a found usage by clicking the square icon.

preview-source.1.png

Update on the new Run / Debug UI

In the first EAP, we introduced a new UI for the Run and Debug tool windows. Since then, we’ve collected a lot of feedback from you and realized there’s still quite a bit of room for improvement. 

We’ve decided to bring the old layout back for now and continue to polish the new UI. The only thing that is left from the new UI is the updated implementation of the Evaluate Expression feature – you can still use it right from the Debug tool window, without opening a separate dialog.

old-debug-ui--1.png

If you prefer the new UI, tick the debugger.new.tool.window.layout flag in the Registry. To open it, invoke the Search Everywhere pop-up with ⇧⇧ / Shift+Shift and look for Registry there.

That’s it for today! Let us know what you think about the new features. Leave your comments here, tweet us, open an issue in our tracker, or drop us a message in the Gophers Slack #goland channel. Thanks!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK