{"id":228833,"date":"2022-04-19T00:30:25","date_gmt":"2022-04-19T07:30:25","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/java\/?p=228833"},"modified":"2022-04-19T00:33:17","modified_gmt":"2022-04-19T07:33:17","slug":"java-on-visual-studio-code-update-april-2022","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/java\/java-on-visual-studio-code-update-april-2022\/","title":{"rendered":"Java on Visual Studio Code Update \u2013 April 2022"},"content":{"rendered":"<p class=\"\">Hi everyone, welcome to the April update of Visual Studio Code Java. This time we are bringing you many exciting updates regarding our fundamental experience improvement including Java 18 support, inlay hints for parameter names, new language server status UX, lambda expression support in debugging and so on. Let&#8217;s get into it.<\/p>\n<h2><span style=\"font-size: 14pt;\"><strong>Microsoft JDConf<\/strong><\/span><\/h2>\n<p>Before we start our update, we want to share an exciting news: Microsoft JDConf is coming up! Join us for the second JDConf event on May 4 &#8211; 5, 2022. It is a virtual, Java focused conference where developers can come together to share interesting topics and stay engaged. Our goal with this event is to highlight external speakers and showcase the great work that\u2019s going on across the Java community. You can get more information and register via this link: <a href=\"https:\/\/aka.ms\/jdconf\">https:\/\/aka.ms\/jdconf<\/a><\/p>\n<h2><span style=\"font-size: 14pt;\"><strong>Java 18 Support<\/strong><\/span><\/h2>\n<p>We have always been targeting to support the latest Java technology. With Java 18 reaching General Availability in March this year, we have enabled the support for Java 18 in our latest version as well. This means you can now use Java 18 in your projects!<\/p>\n<h2><span style=\"font-size: 14pt;\"><strong>Support Inlay Hints for Parameter Names<\/strong><\/span><\/h2>\n<p>Have you ever wondered about which parameter you are filling for in some unfamiliar methods? Don&#8217;t worry, Inlay Hints is here to help you. In our latest release, we have enabled this feature for Java projects. Once enabled, Visual Studio Code will show a hint on the parameter name in the method signature, and there are three modes of this feature.<\/p>\n<ul>\n<li>none (Disable parameter name hints)<\/li>\n<li>literals (Enable parameter name hints only for literal arguments) <strong>(Default)<\/strong><\/li>\n<li>all (Enable parameter name hints for literal and non-literal arguments)<\/li>\n<\/ul>\n<p>You can change this setting at any time by going to the &#8220;inlay&#8221; setting under Java<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/inlaysetting.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228849\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/inlaysetting.png\" alt=\"Inlay Setting\" width=\"793\" height=\"373\" srcset=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/inlaysetting.png 793w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/inlaysetting-300x141.png 300w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/inlaysetting-768x361.png 768w\" sizes=\"(max-width: 793px) 100vw, 793px\" \/><\/a><\/p>\n<p>Here is a demo of the feature in action:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/inlay.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228851\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/inlay.gif\" alt=\"Inlay Hints\" width=\"2972\" height=\"1784\" \/><\/a><\/p>\n<h2><strong><span style=\"font-size: 14pt;\">New Java Language Server Status UX<\/span><\/strong><\/h2>\n<p>Previously, there are multiple items on the status bar to show the current state of the Java language server, this can make the UX crowded and confusing sometimes. Since version 1.65, Visual Studio Code <a href=\"https:\/\/code.visualstudio.com\/updates\/v1_65#_language-status-items\">has finalized its new Language Status Item APIs<\/a>. In our latest release, we not only adopted the new API, but also made some minor adjustments. If you update to the latest version of Visual Studio Code and <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vscjava.vscode-java-pack\">Extension Pack for Java<\/a>, you will see the language server items have been merged into a unified item, not only making it more concise, but also providing more actions for developers to access from a single place. Here is a demo:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/languageserverstatus.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228861\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/languageserverstatus.gif\" alt=\"Language Server Status\" width=\"1360\" height=\"992\" \/><\/a><\/p>\n<p>As you can see from the demo above, currently the language status item provides the following information and action:<\/p>\n<table style=\"border-collapse: collapse; width: 100%; height: 112px;\">\n<tbody>\n<tr style=\"height: 28px;\">\n<td style=\"width: 50%; height: 28px;\"><strong>Information<\/strong><\/td>\n<td style=\"width: 50%; height: 28px;\"><strong>Click Action<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 28px;\">\n<td style=\"width: 50%; height: 28px;\">Build Status<\/td>\n<td style=\"width: 50%; height: 28px;\">Detailed build information in the terminal<\/td>\n<\/tr>\n<tr style=\"height: 28px;\">\n<td style=\"width: 50%; height: 28px;\">Build file (Whether a build configuration exists or not)<\/td>\n<td style=\"width: 50%; height: 28px;\">Navigate to the actual Maven or Gradle build configuration file<\/td>\n<\/tr>\n<tr style=\"height: 28px;\">\n<td style=\"width: 50%; height: 28px;\">Project JDK information<\/td>\n<td style=\"width: 50%; height: 28px;\">Configure Java Runtime<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>If there is an issue or error, you will see an indicator on the status icon and you can click on &#8220;Show problems&#8221; to reveal the error details.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/languageservererror.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228862\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/languageservererror.png\" alt=\"Language Server Error\" width=\"548\" height=\"203\" srcset=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/languageservererror.png 548w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/languageservererror-300x111.png 300w\" sizes=\"(max-width: 548px) 100vw, 548px\" \/><\/a><\/p>\n<p>We hope this improvement will provide better user experience about the state of the Java language server and please share your feedback with us so we can continue to improve this area.<\/p>\n<p><strong><span style=\"font-size: 14pt;\">Code action to extract lambda body to method<\/span><\/strong><\/p>\n<p>As a minor feature update, we have also added a code action (from Quick Fix) to allow developers to easily extract lambda body to a method. Here is a quick demo:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/lambda.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228852\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/lambda.gif\" alt=\"Extract Lambda Body\" width=\"748\" height=\"398\" \/><\/a><\/p>\n<p><strong><span style=\"font-size: 14pt;\">Lambda expression evaluation support in debugging<\/span><\/strong><\/p>\n<p>Lastly, we wanted to provide an update on lambda expression support in debugging. Previously, there was <a href=\"https:\/\/github.com\/microsoft\/vscode-java-debug\/issues\/754\">an issue<\/a> that prevents developer from properly evaluating variables inside lambda expressions when debugging. In our latest release, we have fixed this issue. Here is a quick demo of evaluating a variable from enclosing methods when using lambda in a chain call:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/debugginglambda.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228859\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/04\/debugginglambda.gif\" alt=\"Lambda debugging\" width=\"1898\" height=\"726\" \/><\/a><\/p>\n<p>For complete list of supported case, please visit the <a href=\"https:\/\/github.com\/microsoft\/vscode-java-debug\/issues\/754\">original issue<\/a>.<\/p>\n<h2><span style=\"font-size: 14pt;\"><strong><span class=\"x-hidden-focus\">Feedback and suggestions<\/span><\/strong><\/span><\/h2>\n<p>As always, your feedback and suggestions are very important to us and will help shape our product in future. There are several ways to give us feedback<\/p>\n<ul>\n<li>Leave your comment on this blog post<\/li>\n<li><a href=\"https:\/\/github.com\/microsoft\/vscode-java-pack\/issues\/new\/choose\" target=\"_blank\" rel=\"noopener\">Open an issue<\/a>\u00a0on our GitHub Issues page<\/li>\n<li>Send an email to: vscjfeedback@microsoft.com<\/li>\n<\/ul>\n<h2 id=\"try-it-out\" class=\"x-hidden-focus\"><span style=\"font-size: 14pt;\"><strong><span class=\"x-hidden-focus\">Resources<\/span><\/strong><\/span><\/h2>\n<p>Here is a list of links that are helpful to learn Java on Visual Studio Code.<\/p>\n<ul>\n<li class=\"x-hidden-focus\">Learn more about\u00a0<a class=\"x-hidden-focus\" href=\"https:\/\/code.visualstudio.com\/docs\/languages\/java\" target=\"_blank\" rel=\"noopener noreferrer\">Java on Visual Studio Code<\/a>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Hi everyone, welcome to the April update of Visual Studio Code Java. This time we are bringing you many exciting updates regarding our fundamental experience improvement including Java 18 support, inlay hints for parameter names, new language server status UX, lambda expression support in debugging and so on. Let&#8217;s get into it. Microsoft JDConf Before [&hellip;]<\/p>\n","protected":false},"author":31999,"featured_media":228865,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,22,1,8,15,17],"tags":[],"class_list":["post-228833","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud","category-desktop","category-java","category-open-source","category-vscode","category-web"],"acf":[],"blog_post_summary":"<p>Hi everyone, welcome to the April update of Visual Studio Code Java. This time we are bringing you many exciting updates regarding our fundamental experience improvement including Java 18 support, inlay hints for parameter names, new language server status UX, lambda expression support in debugging and so on. Let&#8217;s get into it. Microsoft JDConf Before [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/228833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/users\/31999"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/comments?post=228833"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/228833\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media\/228865"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media?parent=228833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/categories?post=228833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/tags?post=228833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}