We’re excited to announce an exciting update for Java developers on Visual Studio Code. In the Insider (Pre-release) version of our Extension Pack for Java, we’ve introduced a new feature: “Rewrite with new Java syntax” with Copilot! This feature integrates seamlessly with GitHub Copilot, so developers will need a GitHub Copilot license to access it.
Here’s how the feature works, on your Java class, a new CodeLens text will appear above the name of the class: “Rewrite with new Java syntax“. Once the user clicks on this, it will trigger an inspection on the current Java class. Once the inspection is complete, Visual Studio Code will show several improvement suggestions and point users to the location.
For each suggestion, additional CodeLens will appear and shows what the solution is (and what needs to be improved). The user can directly click on the CodeLens and this will bring up the GitHub Copilot inline chat dialog. The user can then see the code diff, and will be offered the choice of “Accept or “Discard”. If the user accepts the suggestion, then the workflow is over. Let’s see the first example where the for-loop can be refactored using IntStream.
This feature aims to leverage AI to offer helpful suggestions and seamless refactoring for Java developers for their code. We hope this can greatly boost developer’s productivity. If you have any feedback about this feature, please fill out our survey:
To use this feature, developer needs to install both Insider (Pre-release) version Extension Pack for Java and GitHub Copilot extensions. (with a GitHub Copilot license).
Get started now with our sample:
Watch video Rewriting your Java code with Copilot-based suggestions in VS Code online without registration, duration 06 minute 34 second in high hd quality. This video was added by user Microsoft for Java Developers 28 June 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 397 once and liked it 8 people.