{"id":228504,"date":"2021-10-29T03:15:31","date_gmt":"2021-10-29T10:15:31","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/java\/?p=228504"},"modified":"2021-10-29T03:15:31","modified_gmt":"2021-10-29T10:15:31","slug":"java-on-visual-studio-code-update-september-2021","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/java\/java-on-visual-studio-code-update-september-2021\/","title":{"rendered":"Java on Visual Studio Code Update \u2013 September 2021"},"content":{"rendered":"<p>Hi everyone, welcome to the September edition of the Visual Studio Code Java update! In this post, we are going cover the new release of Gradle extension, more convenient Code Actions and recent 1.0 language server release.<\/p>\n<p><strong><span style=\"font-size: 18pt;\">Language Server for Java\u2122 1.0 Release<\/span><\/strong><\/p>\n<p>The 1.0 release of the Language Server for Java\u2122 was officially released recently!\u00a0 We believe this is an important milestone and result of a multi-year collaboration between Microsoft and Red Hat. Please visit this <a href=\"https:\/\/devblogs.microsoft.com\/java\/language-server-1-0\/\">special blog post<\/a> to see the release highlights as well as future plans in detail.<\/p>\n<p><strong><span style=\"font-size: 18pt;\">Gradle for Java Extension Release<\/span><\/strong><\/p>\n<p>Better Gradle support has been one of the top asks in the community. To better address the Gradle needs for developers, we are excited to announce that we have now released the &#8220;<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vscjava.vscode-gradle\">Gradle for Java<\/a>&#8221; extension (previously called &#8220;Gradle Tasks&#8221; extension). This extension was originally started by <a href=\"https:\/\/github.com\/badsyntax\">@badsyntax<\/a> and is now maintained by Microsoft. Please note that this extension is not yet part of <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vscjava.vscode-java-pack\">Extension Pack for Java<\/a> and you may need to download it separately.<\/p>\n<p>Let&#8217;s take a look at some highlights of this new version:<\/p>\n<p><strong><span style=\"font-size: 14pt;\"><span class=\"TextRun BCX0 SCXW143729728\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun BCX0 SCXW143729728\" data-ccp-parastyle=\"heading 3\">Local Gradle installation support<\/span><span class=\"NormalTextRun BCX0 SCXW143729728\" data-ccp-parastyle=\"heading 3\">\u00a0<\/span><\/span><span class=\"EOP BCX0 SCXW143729728\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/span><\/strong><\/p>\n<p><span data-contrast=\"auto\">In previous version, Gradle wrapper in the project folder is the requirement for the extension. There was a feature request (<a href=\"https:\/\/github.com\/microsoft\/vscode-gradle\/issues\/1004\">Issue #1004<\/a>) to support Gradle projects without wrapper, this feature was added to the recent release. Developers can now use<\/span><span data-contrast=\"auto\"> the following settings to control the activation behavior.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<ul>\n<li><span style=\"font-family: 'courier new', courier, monospace;\">java.import.gradle.wrapper.enabled\u00a0<\/span><\/li>\n<li><span style=\"font-family: 'courier new', courier, monospace;\">java.import.gradle.version\u00a0<\/span><\/li>\n<li><span style=\"font-family: 'courier new', courier, monospace;\" data-contrast=\"none\">java.import.gradle.home<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span class=\"TextRun BCX0 SCXW213689484\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun BCX0 SCXW213689484\">More details about these settings can be found at <\/span><\/span><a class=\"Hyperlink BCX0 SCXW213689484\" href=\"https:\/\/github.com\/microsoft\/vscode-gradle#vs-code-settings-1\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined BCX0 SCXW213689484\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun BCX0 SCXW213689484\" data-ccp-charstyle=\"Hyperlink\">https:\/\/github.com\/microsoft\/vscode-gradle#vs-code-settings-1<\/span><\/span><\/a><span class=\"TextRun BCX0 SCXW213689484\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun BCX0 SCXW213689484\">\u00a0<\/span><\/span><\/p>\n<p><strong><span style=\"font-size: 14pt;\">Dependency Management and Project View<\/span><\/strong><\/p>\n<p>Another exciting new feature is the project dependency view. Developers can now easily view the dependencies in a project from the extension.<\/p>\n<p>To view the dependencies of a project, simply click on the &#8220;Dependencies&#8221; item and all dependencies of a project is shown below. These dependencies are grouped by Gradle configurations and you can expand each configuration to see the dependencies in detail. For omitted dependency (marked with a (*)), you can click on the inline button on the right to reveal the previously listed dependency.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/dependency.png\"><img decoding=\"async\" class=\"alignnone wp-image-228514\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/dependency.png\" alt=\"Gradle dependency\" width=\"438\" height=\"606\" srcset=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/dependency.png 842w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/dependency-217x300.png 217w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/dependency-739x1024.png 739w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/dependency-768x1064.png 768w\" sizes=\"(max-width: 438px) 100vw, 438px\" \/><\/a><\/p>\n<p><strong><span style=\"font-size: 14pt;\">Gradle Authoring Experience (Groovy)<\/span><\/strong><\/p>\n<p>Gradle file authoring experience in Groovy is also greatly improved! There are a few new features we want to highlight:<\/p>\n<p><strong><span class=\"TextRun SCXW39210530 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW39210530 BCX0\" data-ccp-parastyle=\"heading 4\">Auto completion<\/span><\/span><span class=\"EOP SCXW39210530 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/strong><\/p>\n<p><span class=\"TextRun BCX0 SCXW121859428\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun BCX0 SCXW121859428\">The Gradle language server supports basic auto completions for a Gradle file,\u00a0<\/span><span class=\"NormalTextRun BCX0 SCXW121859428\">when you\u2019re trying to type a Gradle closures<\/span><span class=\"NormalTextRun BCX0 SCXW121859428\">\u00a0or properties<\/span><span class=\"NormalTextRun BCX0 SCXW121859428\"> in a Gradle script, the extension will automatically suggest available <\/span><span class=\"NormalTextRun SpellingErrorV2 BCX0 SCXW121859428\">Gradle<\/span><span class=\"NormalTextRun BCX0 SCXW121859428\">\u00a0closures for you.<\/span><\/span><span class=\"EOP BCX0 SCXW121859428\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:240,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/autocomplete.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228515\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/autocomplete.gif\" alt=\"Gradle auto completion\" width=\"1729\" height=\"1522\" \/><\/a><\/p>\n<p>When you\u2019re typing a dependency in \u201cdependencies\u201d closure, the extension will automatically search in the Maven central and suggest result for you.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/autosuggestdependency.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228518\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/autosuggestdependency.gif\" alt=\"Gradle auto suggest dependency\" width=\"1113\" height=\"752\" \/><\/a><\/p>\n<p><strong><span class=\"TextRun SCXW109994641 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW109994641 BCX0\" data-ccp-parastyle=\"heading 4\">Syntax Highlighting<\/span><\/span><span class=\"EOP SCXW109994641 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/strong><\/p>\n<p><span class=\"NormalTextRun BCX0 SCXW180704793\">When opening a Groovy Gradle file, the Gradle language server will start and provide language features for you.<\/span><span class=\"NormalTextRun BCX0 SCXW180704793\">\u00a0<\/span><span class=\"NormalTextRun BCX0 SCXW180704793\">Basically, we offer <\/span><span class=\"NormalTextRun BCX0 SCXW180704793\">Groovy syntax highlighting (using VS Code default style) in <\/span><span class=\"NormalTextRun SpellingErrorV2 BCX0 SCXW180704793\">Gradle<\/span><span class=\"NormalTextRun BCX0 SCXW180704793\"> files. After language server starts, it will analyze the<\/span><span class=\"NormalTextRun BCX0 SCXW180704793\">\u00a0opened<\/span><span class=\"NormalTextRun BCX0 SCXW180704793\"> Gradle file and provide semantic tokens information, providing more precise highlighting results.<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/syntax.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228516\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/syntax.gif\" alt=\"Syntax highlighting\" width=\"1248\" height=\"750\" \/><\/a><\/p>\n<p><strong><span class=\"TextRun SCXW98968911 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW98968911 BCX0\" data-ccp-parastyle=\"heading 4\">Document<\/span><span class=\"NormalTextRun SCXW98968911 BCX0\" data-ccp-parastyle=\"heading 4\">\u00a0<\/span><span class=\"NormalTextRun SCXW98968911 BCX0\" data-ccp-parastyle=\"heading 4\">outline<\/span><\/span><span class=\"EOP SCXW98968911 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/strong><\/p>\n<p><span class=\"TextRun Highlight BCX0 SCXW260345589\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun BCX0 SCXW260345589\">The Gradle language server will provide the document outline for the current Gradle file. This type of view will help you to navigate to any part of the Gradle file easily<\/span><\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/documentoutline.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228519\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/documentoutline.gif\" alt=\"Gradle document outline\" width=\"2486\" height=\"1522\" \/><\/a><\/p>\n<p><strong><span class=\"TextRun BCX0 SCXW84361623\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun BCX0 SCXW84361623\" data-ccp-parastyle=\"heading 4\">Error<\/span><span class=\"NormalTextRun BCX0 SCXW84361623\" data-ccp-parastyle=\"heading 4\">\u00a0<\/span><span class=\"NormalTextRun BCX0 SCXW84361623\" data-ccp-parastyle=\"heading 4\">reporting<\/span><\/span><span class=\"EOP BCX0 SCXW84361623\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/strong><\/p>\n<p><span class=\"TextRun Highlight SCXW89835140 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW89835140 BCX0\">The Gradle language server will use Groovy compile engine to analyze the Gradle build file and report syntax errors if exist. It will also get script\u00a0<\/span><span class=\"NormalTextRun SpellingErrorV2 SCXW89835140 BCX0\">classpaths<\/span><span class=\"NormalTextRun SCXW89835140 BCX0\">\u00a0from Gradle Build so that it can report compilation errors. The\u202f<\/span><\/span><a class=\"Hyperlink SCXW89835140 BCX0\" href=\"https:\/\/docs.gradle.org\/current\/userguide\/writing_build_scripts.html#script-default-imports\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Highlight Underlined SCXW89835140 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW89835140 BCX0\" data-ccp-charstyle=\"Hyperlink\">Gradle default imports<\/span><\/span><\/a><span class=\"TextRun Highlight SCXW89835140 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW89835140 BCX0\">\u202fare supported.<\/span><\/span><span class=\"EOP SCXW89835140 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/erroreporting.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228520\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/erroreporting.jpg\" alt=\"Gradle error reporting\" width=\"941\" height=\"753\" srcset=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/erroreporting.jpg 941w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/erroreporting-300x240.jpg 300w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/erroreporting-768x615.jpg 768w\" sizes=\"(max-width: 941px) 100vw, 941px\" \/><\/a><\/p>\n<p>There are many more features in this extension. Please visit <a href=\"https:\/\/github.com\/microsoft\/vscode-gradle#feature-overview\">the GitHub documentation<\/a> to see the full list of features! You can follow <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vscjava.vscode-gradle\">this link<\/a> to get this Gradle extension.<\/p>\n<p><strong><span style=\"font-size: 18pt;\">More Convenient Code Actions\u00a0<\/span><\/strong><\/p>\n<p>We have been constantly receiving feedback that the current code actions are sometimes hard to find. Previously, developer has to right click, select &#8220;Source Action&#8221; and then find all the Java code actions in the menu.<\/p>\n<p>Now, developers can simply use the lightbulb icon (Quick Fix) to generate common Java functions. Here is a list of scenarios we support<\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Generate Getters and Setters<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">Generate\u00a0hashCode() and equals()<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">Generate\u00a0toString()<\/span><\/li>\n<\/ul>\n<p>Here is a quick demo:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/codeactions.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228523\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/10\/codeactions.gif\" alt=\"Code Actions\" width=\"1728\" height=\"1080\" \/><\/a><\/p>\n<h3 id=\"try-it-out\" class=\"x-hidden-focus\"><strong><span class=\"x-hidden-focus\">Feedback and Suggestions<\/span><\/strong><i class=\"fabric-icon fabric-icon--Link\" aria-hidden=\"true\"><\/i><\/h3>\n<p>Please don\u2019t hesitate to try our product! Your feedback and suggestions are very important to us and will help shape our product in future. There are several ways to leave 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<\/ul>\n<h3 id=\"try-it-out\" class=\"x-hidden-focus\"><strong>Resources<\/strong><i class=\"fabric-icon fabric-icon--Link\" aria-hidden=\"true\"><\/i><\/h3>\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<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi everyone, welcome to the September edition of the Visual Studio Code Java update! In this post, we are going cover the new release of Gradle extension, more convenient Code Actions and recent 1.0 language server release. Language Server for Java\u2122 1.0 Release The 1.0 release of the Language Server for Java\u2122 was officially released [&hellip;]<\/p>\n","protected":false},"author":31999,"featured_media":228527,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,8,15],"tags":[],"class_list":["post-228504","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-open-source","category-vscode"],"acf":[],"blog_post_summary":"<p>Hi everyone, welcome to the September edition of the Visual Studio Code Java update! In this post, we are going cover the new release of Gradle extension, more convenient Code Actions and recent 1.0 language server release. Language Server for Java\u2122 1.0 Release The 1.0 release of the Language Server for Java\u2122 was officially released [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/228504","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=228504"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/228504\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media\/228527"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media?parent=228504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/categories?post=228504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/tags?post=228504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}