{"id":228206,"date":"2021-06-15T19:03:07","date_gmt":"2021-06-16T02:03:07","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/java\/?p=228206"},"modified":"2021-06-15T20:21:54","modified_gmt":"2021-06-16T03:21:54","slug":"java-on-visual-studio-code-update-may-2021","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/java\/java-on-visual-studio-code-update-may-2021\/","title":{"rendered":"Java on Visual Studio Code Update \u2013 May 2021"},"content":{"rendered":"<p>Welcome to May\u2019s updates on VS Code for Java. In this edition, we will share with you Java Formatter Settings editor and other cool features. Let\u2019s start.<\/p>\n<h3><strong>Java Formatter Settings<\/strong><\/h3>\n<p>Today, changing a Java formatter setting on VS Code requires you going through an XML file with hundreds of options, manipulating the file, and applying change without being able to preview. This process is cumbersome and error prone. To fix the problem, we are introducing the Java Formatter Settings editor where options are categorized, and changes can be previewed.<\/p>\n<p>To launch the editor, click <strong>Ctrl+Shift+P<\/strong> to open command palette, and then type \u201c<strong>java: open java formatter settings with preview<\/strong>\u201d on the palette and run the command. After change, right click on editor to select \u201c<strong>Format Document<\/strong>\u201d, or type \u201c<strong>format document<\/strong>\u201d on the palette and run the command to apply the change to your project.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/formatterEditorGif.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228207\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/formatterEditorGif.gif\" alt=\"Image formatterEditorGif\" width=\"2480\" height=\"1534\" \/><\/a><\/p>\n<h3><strong>Generating Tests from Source File<\/strong><\/h3>\n<p>In April\u2019s update, we introduced automatically generating testing method templates from a test file. In May, we have further developed the feature to allow generating test file and testing method templates directly from a source file. You can right-click on source file editor to invoke context menu, select \u201c<strong>Source Action\u2026<\/strong>\u201d and then \u201c<strong>Generate Test\u2026<\/strong>\u201d to generate.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/generateTestFromSource.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228208\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/generateTestFromSource.gif\" alt=\"Image generateTestFromSource\" width=\"2037\" height=\"1532\" \/><\/a><\/p>\n<h3><strong>Others<\/strong><\/h3>\n<ul>\n<li>Customizing &#8220;classPaths&#8221; and &#8220;modulePaths&#8221; configurations via launch.json. The enhancement supports for predefined variables:\n<ul>\n<li>$Auto &#8211; Automatically resolve the classpaths or modulepaths of current project. This is default value.<\/li>\n<li>$Runtime \u2013 Add classpaths or modulepaths within &#8216;runtime&#8217; scope of current project.<\/li>\n<li>$Test &#8211; Add classpaths or modulepaths within &#8216;test&#8217; scope of current project.<\/li>\n<li>!&lt;path&gt; &#8211; Exclude the specified path from classpaths.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/classpath.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-228209\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/classpath.png\" alt=\"Image classpath\" width=\"1833\" height=\"1099\" srcset=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/classpath.png 1833w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/classpath-300x180.png 300w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/classpath-1024x614.png 1024w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/classpath-768x460.png 768w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2021\/06\/classpath-1536x921.png 1536w\" sizes=\"(max-width: 1833px) 100vw, 1833px\" \/><\/a><\/p>\n<ul>\n<li>Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. It is very popular for learning program languages, data analysis and machine learning, etc. If you are interested in using it for Java on VS Code, please follow <a href=\"https:\/\/github.com\/microsoft\/vscode-java-pack\/wiki\/Quick-Start:-Jupyter-Notebook-for-Java\">the instructions<\/a>.<\/li>\n<\/ul>\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<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to May\u2019s updates on VS Code for Java. In this edition, we will share with you Java Formatter Settings Editor, generating tests from source file, debugging enhancement and Jupyter Notebook for Java.<\/p>\n","protected":false},"author":26010,"featured_media":228214,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,8,15],"tags":[25,783,248,784,28,12],"class_list":["post-228206","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-open-source","category-vscode","tag-debugging","tag-formatter","tag-java","tag-jupyter","tag-testing","tag-visual-studio-code"],"acf":[],"blog_post_summary":"<p>Welcome to May\u2019s updates on VS Code for Java. In this edition, we will share with you Java Formatter Settings Editor, generating tests from source file, debugging enhancement and Jupyter Notebook for Java.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/228206","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=228206"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/228206\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media\/228214"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media?parent=228206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/categories?post=228206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/tags?post=228206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}