Java Gets AI-Assisted IntelliCode in Visual Studio Code Editor
Java developers using the Visual Studio Code editor can now enjoy the same AI-assisted IntelliCode functionality previously available only to Python coders.
Microsoft's Visual Studio IntelliCode in the Visual Studio Code Marketplace improves upon the legacy IntelliSense functionality through the use of machine learning that allows for understanding coding context.
Through the more thorough understanding of a project's existing code, the tool displays recommended completion items for an application's code context at the top of IntelliSense code completions lists.
By using an advanced inference capability, IntelliCode predicts what a programmer is aiming for as a line of code is typed in, presenting the most likely code completion options at the top of its suggestion list, marked by stars. Previously, with IntelliSense, a wide range of options would be presented, requiring manual winnowing down to find the desired choice.
After being introduced earlier this year, IntelliCode -- still in preview -- was made available to Python developers in July.
In addition to providing the most likely code completion items based on code context, Microsoft in July also announced IntelliCode had gotten even smarter, gaining the ability to infer coding conventions by scanning existing code and letting developers know when new code violates those conventions.
Going even further, Microsoft's Amanda Silver said IntelliCode can detect new issues and even improve the code review process in a September Visual Studio Live! keynote address.
"We also have the ability to detect new issues, new classes of issues in your code that were previously undetectable by static analysis, based on machine learning algorithms that we've come up with," Silver explained. The service examines both large Microsoft code repositories and public repositories to find new classes of errors that compilers and static analyzers can't detect.
It was the code-completion functionality, however, that was highlighted by Microsoft in a blog post announcing the Java support.
"IntelliCode saves you time by putting the most relevant suggestions at the top of your completion list. IntelliCode recommendations are based on thousands of open source projects on GitHub, each with over 100 stars, so it's trained on most popular usage patterns and practices. When combined with the context of your code, the completion list is tailored to promote those practices," Microsoft said.
"You may have noticed that IntelliCode provides most relevant IntelliSense recommendations based on your current code context, especially within conditional blocks. IntelliCode works well with popular Java libraries and frameworks like Java SE platform and Spring framework. It will help you whether you are doing monolithic or modern microservices architecture."
Yesterday's post also details several other improvements to Java programming in VS Code, including:
- Easier exploration and management of Java projects through a Java Dependencies extension.
- The availability of Spring Tools 4 from Pivotal, which leverages the Language Server Protocol created by Visual Studio Code team. When used with other existing tools, it can help developers:
- Easily create new Spring Boot applications.
- Navigate source code.
- Enjoy "smart code editing."
- See runtime live information in the editor.
- Manage running applications.
- More VS Code Java improvements via extensions affecting:
In yesterday's post, Xiaokai He, program manager, details how to try out all the enhancements using the Java Extension Pack, which includes Language Support for Java by Red Hat, Debugger for Java, Maven and Java Test Runner.
The Visual Studio IntelliCode preview extension has been downloaded more than 362,000 times.
David Ramel is the editor of Visual Studio Magazine.