Quarkus Tools for Visual Studio Code version 1.3.0 has been released on the VS Code Marketplace to start off the new year. As Quarkus continues to introduce improvements and new features like application.yaml
and server-side templating support, Quarkus Tools for Visual Studio Code continues to evolve to accompany these new features and improvements.
For a list of all changes, please refer to the changelog.
You can also watch a demo video of all the features presented in this article.
New features
The new features added to Quarkus Tools for Visual Studio Code 1.3.0 include:
- A new URL CodeLens for RESTEasy JAX-RS GET methods.
- Hover support for
@ConfigProperty
name in Java sources. - MicroProfile properties support for the REST Client.
- Kubernetes, Red Hat OpenShift, Docker, and S2I property support.
- A Quick Fix to add unknown property namespaces to ignore.
- Go to definition support for enum values from
application.properties
. - YAML support (experimental).
- A new extension descriptions toggle button.
- Different ways to open a new Quarkus project.
- Syntax highlighting for Qute languages.
URL CodeLens for RESTEasy JAX-RS GET methods
When editing a resource class while the current Quarkus application is running in development mode (./mvnw compile quarkus:dev
or ./gradlew quarkusDev
), there are now CodeLenses that provide the URL for the GET endpoints. This feature takes into account the pathname and the HTTP server port in your application.properties
file in order to create the URL.
Clicking on the CodeLens URL opens this URL in your default browser, as shown in Figure 1.
Once the Quarkus application stops running, the CodeLens URL will no longer appear, as shown in Figure 2.
Please keep in mind that CodeLenses in VS Code are only updated when certain events happen. If the URL CodeLens does not appear, there are two easy ways to trigger a CodeLens update: switch tabs or start typing in any file. Also, make sure that the quarkus.tools.codeLens.urlCodeLensEnabled
VS Code setting is set to true
.
Hover support for @ConfigProperty
name in Java sources
Hovering over the name value in a @ConfigProperty
annotation now displays the hovered property's value, as shown in Figure 3. Currently, the value either comes from application.properties
file, or the default value field.
MicroProfile properties support for the REST Client
There is now completion, hover, documentation, and validation for the MicroProfile properties from the REST Client. After registering a REST Client using @RegisterRestClient
like so:
package com.mycompany.remoteServices; @RegisterRestClient public interface MyServiceClient { @GET @Path("/greet") String greet(); }
Language features will become available for the related MicroProfile config properties, as shown in Figure 4.
More information about using the MicroProfile REST Client is available in the Quarkus guides here.
Kubernetes, Openshift, Docker, and S2I property support
Likewise, there is now completion, hover, documentation, and validation for the kubernetes.*
, openshift.*
, docker.*
, and s2i.*
properties coming from the Kubernetes Quarkus extension, as shown in Figure 5.
In-depth documentation about generating Kubernetes resources and the config properties involved can be found in the Quarkus guides here.
Quick Fix to add unknown property namespaces to ignore
There is now a new Quick Fix that helps you exclude large groups of unknown properties from unknown property validation, as long as they share the same parent namespace. For example, if your application.properties
file contains four properties with an unknown property error, like so:
# All four properties cause an 'Unknown property' error unknown.test1=a unknown.test2=b unknown.test3=c unknown.test4=d
Ignoring all four properties from unknown property validation is easily done with the Quick Fix, which adds unknown.*
to the quarkus.tools.validation.unknown.excluded
workspace configuration array, as shown in Figure 6.
Go to definition support for enum values from application.properties
Up until now, Go to definition was only supported for config property keys and not their values. This release brings the Go to definition feature for enum values, as shown in Figure 7.
YAML support (experimental)
The release of Quarkus 1.1.0.Final, brought YAML configuration support, meaning that you can now configure your Quarkus application with either an application.yaml
file or an application.properties
file (but try to stick with one or the other).
As a result, there is now completion support for application.yaml
files, as shown in Figure 8. Similar to application.properties
, the completion options in application.yaml
file will be in sync with the Quarkus extensions that are available to the current project at the time (in pom.xml
or build.gradle
), therefore giving you only the relevant completion options.
This feature depends on the YAML Language Support by Red Hat extension. If it is not currently installed, a new prompt will propose to install it.
Language feature support for application.yaml
files is in its experimental stages. Compared to application.properties
support, there are missing features:
- Go to definition support.
- Code action support.
- Automatic completion for default values.
- Limited config property and value validation support.
A new extension descriptions toggle button
As the number of Quarkus extensions continues to rise, the new extension descriptions in the extension selection prompt help you recognize and discover new extensions, as shown in Figure 9. The extension selection prompt appears when selecting Quarkus extensions from the Quarkus: Generate a Quarkus project and Quarkus: Add extensions to current project wizards.
There is also a new button on the top right of the selection box that toggles whether or not the extension descriptions should appear, as shown in Figure 10.
Different ways to open a new Quarkus project
After creating a new project with the Quarkus: Generate a Quarkus project wizard, there is now a new prompt that asks how the new project should be opened. The following before and after diagrams describe the changes:
To help visualize one of the possible scenarios, Figure 13 shows the options presented when generating a project while a workspace is open.
Syntax highlighting for Qute languages
Qute is a new server-side templating engine created with Quarkus in mind. This release brings new Qute language modes in VS Code: Qute HTML, Qute JSON, Qute YAML, and Qute Text. These new language modes are automatically applied to your current file if your file’s extension is .qute.html
, .qute.json
, .qute.yaml
, or .qute.txt
respectively.
Thanks to the new language modes, Qute-specific syntax highlighting and commenting are now provided, as shown in Figure 14.
For more information about the Qute templating engine, please refer to the Quarkus templating engine guide.
Moving forward
This wraps up the new major features in this release. If you have any suggestions or feedback, please feel free to open a GitHub issue.
For future releases, alongside general enhancements, we aim to bring more robust language feature support for application.yaml
and Qute languages. Stay tuned for the next release!
Links
Here are the important links:
Last updated: August 17, 2023