Microsoft Previews VS Code Copilot Advancements, Promises More
Microsoft previewed new advancements for the GitHub Copilot tool for Visual Studio Code.
The GitHub Copilot "AI pair programmer" already provides such advanced code-completion functionality that developers using VS Code can slip into a "Tab-Tab-Tab" development workflow, simply hitting the Tab key repeatedly to accept AI suggestions to code out a project, Microsoft said.
Hitting Tab repeatedly signals the acceptance of real-time hints in the form of suggestions, called "ghost text," based on the context of surrounding code. It's basically the pinnacle of the now-rudimentary IntelliSense functionality and slightly more advanced IntelliCode.
"If you write your intentions as comments or use descriptive function names, Copilot can use these hints to automatically generate code, word by word, line by line, or even block by block," Microsoft said in a "Visual Studio Code and GitHub Copilot" blog post published yesterday, March 30.
The post provides background on AI in VS Code, details some new experiences powered by GitHub Copilot and gives a peek into where and how the dev team sees things going forward.
Released on June 29, 2021, and updated a couple weeks ago, the GitHub Copilot extension in the VS Code Marketplace has now been installed more than 4.6 million times. In addition to offering code suggestions, the tool can help developers by converting comments into code, creating unit tests and creating SQL queries. The tool's marketplace entry points to 2022 research that found GitHub Copilot helps developers code faster, focus on solving bigger problems, stay in the flow longer, and feel more fulfilled with their work, providing these statistics.
- 74 percent of developers are able to focus on more satisfying work
- 88 percent feel more productive
- 96 percent of developers are faster with repetitive tasks
Microsoft calls the current rendition of Copilot in VS Code "GitHub Copilot 'V1'." It maintains that code-completion functionality and resulting Tab-Tab-Tab workflow was just the beginning. That's because new capabilities are in the works, inspired by the November 2022 release of the sentient-sounding chat bot from Microsoft partner OpenAI called ChatGPT, reportedly the fastest-growing consumer app of all time.
The VS Code dev team held an internal hackathon to explore how to more deeply integrate AI into the code editor. After batting around ideas like improved renaming and refactorings, code transformations based on examples, and ways to create file glob patterns or regex expressions using natural language, it kept returning to chat functionality.
"We had a healthy dose of skepticism. Did we really need yet another Chat experience in our lives?" yesterday's post said. "VS Code is an editor, our job is to get you into the 'zone' and help you stay there by removing distractions while you crank out the next unicorn."
The team decided coders did need another chat experience in their lives, and subsequently developed in-editor chat, in which just pressing Ctrl+I (Windows) brings up a chat interface right in the editor, letting developers instruct their copilot to "update username to be lastName and firstName," for example.
"No need to express your intentions to Copilot using a comment or an overly descriptive function name, just press Cmd+I [Mac] and describe what you want to do," the team said. "Stay in the zone while Copilot does the work."
Not anyone can use in-editor chat to stay in the zone at this time, however, as the feature is only available in a technical preview, for which developers must sign up on a waitlist in order to be granted access.
Waitlist acceptance is also needed to use a related new offering, a Chat view, which was also finally embraced by the team after initial hesitancy and deliberation.
"The most obvious value of an integrated experience over a browser-based chat is that we can provide context to the model, helping to ground the conversation and provide better answers," the post said. "For example, you can't easily ask the browser-based ChatGPT to optimize code that spans multiple files. VS Code already knows a lot about the workspace; this is how you can do refactorings across files, Find All References, Go to Definition, and more. Key information can be responsibly embedded in the prompt so that the model can give more relevant answers, ultimately letting you ask Copilot to optimize or refactor code that has dependencies across multiple files."
One use case example is simplifying the multi-step process of configuring the
tasks.json files for debugging.
"Instead of us writing more documentation or adding dialogs and wizardry to the editor, it turns out you can simply ask 'Please add debugging support' that in turn tells you how to open the Debug view, create a
launch.json, and so on, until you are hitting break points and inspecting variables," the team said. That's depicted thusly:
Note that to use the new features after being accepted from the waitlist, developers must use the early-access VS Code Insiders program and then install the GitHub Copilot Nightly extension, after which they will be prompted to authenticate with a GitHub ID.
"Integrating Chat into VS Code, powered by GitHub Copilot, is just one step on a journey," the team said. "We will continue to explore additional 'inner loop' scenarios such as using natural language to describe search patterns or code generation, automatic generation of commit messages and pull request descriptions, smarter code renaming, refactoring, transformations, and more."
About the Author
David Ramel is an editor and writer for Converge360.