{"id":227459,"date":"2020-06-01T02:46:00","date_gmt":"2020-06-01T09:46:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/java\/?p=227459"},"modified":"2020-06-08T22:36:06","modified_gmt":"2020-06-09T05:36:06","slug":"java-on-visual-studio-code-update-may-2020","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/java\/java-on-visual-studio-code-update-may-2020\/","title":{"rendered":"Java on Visual Studio Code Update \u2013 May 2020"},"content":{"rendered":"<p>Welcome back to the May update of Java on Visual Studio Code.<\/p>\n<p>Your satisfaction continuously motivates us delivering the best product for you. Therefore, whatever it is a new feature or an enhancement, we hope you like it. In this update, we will show enhancements on Java side that make the product more friendly and also answer a frequently asked question. On to the update.<\/p>\n<h3>Display Java language level on status bar<\/h3>\n<p>As Java evolves, developers need deal with language level. Today, VS Code applies language level for your project based on project setting. As an enhancement, now VS Code&#8217;s status bar displays the language level directly, so no need open your project file to look for it anymore. When you click the language level on status bar, it will take you to \u201cjava.configuration.runtimes\u201d setting, where you can configure your JDK settings. To get the benefit of this enhancement, you need the latest version of Language Support for Java extension and set active editor tab to a \u201c.java\u201d file.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-227463\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2020\/05\/language-level.gif\" alt=\"Image language level\" width=\"1024\" height=\"623\" \/><\/p>\n<h3>Refactor package name<\/h3>\n<p>Renaming a folder in the explorer view now triggers package refactoring. At the 1st time, you&#8217;ll be prompted to select either always automatically apply or always preview before apply:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-large wp-image-227466\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2020\/05\/Refactorying-package-1024x383.png\" alt=\"Image Refactorying package\" width=\"640\" height=\"239\" srcset=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2020\/05\/Refactorying-package-1024x383.png 1024w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2020\/05\/Refactorying-package-300x112.png 300w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2020\/05\/Refactorying-package-768x287.png 768w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2020\/05\/Refactorying-package-1536x574.png 1536w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2020\/05\/Refactorying-package.png 1904w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>The behavior is controlled by \u201cjava.refactor.renameFromFileExplorer\u201d in <a href=\"https:\/\/code.visualstudio.com\/docs\/getstarted\/settings#_creating-user-and-workspace-settings\">your preference setting<\/a> with below options:<\/p>\n<ul>\n<li>never: Don&#8217;t enable refactoring for rename operations on File Explorer.<\/li>\n<li>autoApply: Always automatically update the imports and package declarations.<\/li>\n<li>preview: Always preview the changes before applying.<\/li>\n<li>prompt: Ask user to confirm whether to bypass refactor preview.<\/li>\n<\/ul>\n<h3>Attach debugger by process ID<\/h3>\n<p>Debugger extension now supports Attach by Process ID. To work with this new capability, you need the latest version of debugger extension, and add <a href=\"https:\/\/code.visualstudio.com\/docs\/java\/java-debugging#_configuration\">a debugger configuration<\/a> with \u201cjava: Attach to Process\u201d option. When run debugger, you will be promoted to pick a debugging process to attach.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-227467\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2020\/05\/attach-to-process.gif\" alt=\"Image attach to process\" width=\"2048\" height=\"1338\" \/><\/p>\n<h3>Other enhancements<\/h3>\n<ol>\n<li>Command \u201cCreate Java Project\u201d now allows you to select creating a Java project with Maven support (as long as the Maven extension is installed) or a project without any build tools.<\/li>\n<li>A new argument of \u201csourcePaths\u201d supports specifying source path as part of your customer configuration for running your tests. You can find the argument under \u201cjava.test.config\u201d in <a href=\"https:\/\/code.visualstudio.com\/docs\/getstarted\/settings#_creating-user-and-workspace-settings\">your preference setting<\/a>.<\/li>\n<li>A new command of &#8220;Import Java projects in workspace&#8221; allows you to add a module into an opened project without restarting window.<\/li>\n<\/ol>\n<h3>FAQ: generate getters &amp; setters in bulk<\/h3>\n<p>Many users have asked us how to generate getters &amp; setters in bulk. Actually, you can easily find the option of bulk generation under \u201cSource Action\u201d by right-clicking your .Java file.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-227468\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2020\/05\/getter-setter.gif\" alt=\"Image getter setter\" width=\"1024\" height=\"768\" \/><\/p>\n<h3>Try it out<\/h3>\n<p>Please don\u2019t hesitate to give it a try! Your feedback and suggestions are very important to us and will help shape our product in future.<\/p>\n<ul>\n<li>Learn more about <a href=\"https:\/\/code.visualstudio.com\/docs\/languages\/java\" target=\"_blank\" rel=\"noopener noreferrer\">Java on Visual Studio Code<\/a>.<\/li>\n<li>Explore our step by step <a href=\"https:\/\/code.visualstudio.com\/docs\/java\/java-tutorial\" target=\"_blank\" rel=\"noopener noreferrer\">Java Tutorials on Visual Studio Code<\/a>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Welcome back to the May update of Java on Visual Studio Code. Your satisfaction continuously motivates us delivering the best product for you. Therefore, whatever it is a new feature or an enhancement, we hope you like it. In this update, we will show enhancements on Java side that make the product more friendly and [&hellip;]<\/p>\n","protected":false},"author":26010,"featured_media":227480,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,8,15],"tags":[25,248,27,28,12],"class_list":["post-227459","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-open-source","category-vscode","tag-debugging","tag-java","tag-refactoring","tag-testing","tag-visual-studio-code"],"acf":[],"blog_post_summary":"<p>Welcome back to the May update of Java on Visual Studio Code. Your satisfaction continuously motivates us delivering the best product for you. Therefore, whatever it is a new feature or an enhancement, we hope you like it. In this update, we will show enhancements on Java side that make the product more friendly and [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/227459","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\/26010"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/comments?post=227459"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/227459\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media\/227480"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media?parent=227459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/categories?post=227459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/tags?post=227459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}