News

VS Code Experiments Boost AI Copilot Functionality

Microsoft's regular monthly update to its Visual Studio Code editor includes a host of experiments that enhance the functionality of the AI-powered GitHub Copilot coding assistant.

Leading off the experiments in the August 2024 update that brings the open-source-based, cross-platform code editor to version 1.93 is the ability for a developer to provide code generation instructions when the tool is used for refactoring, generating unit tests, or implementing a feature.

The Setting in Visual Studio Code
[Click on image for larger view.] The Setting in Visual Studio Code (source: Ramel).

In those instances, a developer might want to use specific libraries or follow a particular coding style in the generated code, which is now possible by tweaking the experimental github.copilot.chat.experimental.codeGeneration.instructions setting that defines a set of instructions that are added to every Copilot request that generates code.

This code snippet provides examples of possible instructions to always add certain comments, use specific naming conventions and so on:

"github.copilot.chat.experimental.codeGeneration.instructions": [
    {
      "text": "Always add a comment: 'Generated by Copilot'."
    },
    {
      "text": "In TypeScript always use underscore for private field names."
    },
    {
      "file": "code-style.md" // import instructions from file 'code-style.md'
    }
  ],

As indicated, the instructions can be defined in settings or they can be imported from a file.

More Copilot Experiments
Other Copilot experiments in the works include:

  • Automatic chat participant detection in Chat view: GitHub Copilot has several built-in chat participants, such as @workspace, which also contribute commands to the Chat view. Previously, devs had to explicitly specify the chat participant and command in a chat prompt. Now, to make it easier to use chat participants with natural language, the dev team is experimenting with enabling Copilot Chat to automatically route a question to a suitable participant or chat command.
  • Use recent coding files as Inline Chat context: The tool's Inline Chat feature can now use recently seen or edited code as context to provide more relevant suggestions in instances when devs ask questions related to code recently being worked on or viewed.
  • Use current editor line as inline Chat prompt: "Instead of first opening inline Chat and then entering your chat prompt, you can now start typing in the editor and use the contents of the current line directly as the prompt for inline Chat. And for an even smoother chat experience, Copilot can detect when you're prompting instead of writing code, and then automatically start inline Chat for you."
  • Start debugging from Chat: The new experimental slash command, /startDebugging, is available for the @vscode chat participant, enabling devs to create a launch configuration and start debugging an app.
  • Generate tests based on test coverage: If test coverage information is available, GitHub Copilot can offer a CodeLens Generate tests using Copilot for functions and methods that are not yet covered by tests.

Production-Ready Copilot AI
There were also several non-experimental new Copilot features discussed in the update, including:

  • Improved test generation: "With GitHub Copilot, you can generate tests for your code, either by using the Generate Tests using Copilot action in the editor content menu, or by using the /tests slash command in inline Chat."
  • Renamed Code Actions for generating tests and documentation: "When you place the cursor on an identifier, such as a method name, GitHub Copilot gives you Code Actions to generate tests or documentation. To better reflect their purpose, we renamed these Code Actions to Generate Tests using Copilot and Generate Documentation using Copilot. Previously, these were called Test using Copilot and Document using Copilot."
  • Improved chat history: "You can open previous chat sessions from the chat history with the Show Chats button at the top of the Chat view. These sessions now have a more user-friendly, AI-generated name. You can also rename sessions manually by selecting the pencil icon on each row."
  • Save chat sessions for empty windows: "Previously, VS Code wasn't saving chat sessions for empty windows (that don't have a folder or workspace open). Now, these sessions are saved as expected, and previous chats from an empty window can be loaded via the Show Chats button."
  • Attach context in Quick Chat: "When using Quick Chat, you can now use the Attach Context action to attach context like files and symbol to your Copilot request."
  • Thumbs down feedback details: "Did you get a response from Copilot Chat that wasn't what you expected? Help us out by selecting the Thumbs down button on the toolbar for a chat response. Now, it shows a dropdown with a few detailed options for you to describe the issue. You can also open the issue reporter from this menu."

Other Updates
On the non-AI side of things, updates include:

  • Profiles editor - Switch and manage your profiles from a single place: "The new Profiles editor is now generally available for all in Visual Studio Code. The new Profiles editor enables you to manage profiles from a single place. This experience includes creating new profiles, editing and deleting existing profiles, and importing and exporting profiles to share with others."
  • Django unit test support - Discover and run Django unit tests from the Test Explorer: "We are excited to announce support for one of our most requested features: you can now discover and run Django unit tests through the Test Explorer! For set up instructions on how to enable this functionality, check our documentation."
  • IntelliSense on vscode.dev - Boost your JS & TS coding in vscode.dev with IntelliSense: "Working with JavaScript and TypeScript on VS Code for the Web just got a whole lot better. To start off, we've implemented package IntelliSense, so you can see suggestions and documentation from any imported package, such as react. This works much like it does in the desktop version of VS Code."
  • Notebook diff viewer - Efficiently review changes in notebooks by collapsing unchanged cells: "The notebook diff view now hides unchanged cells, which enables you to focus on the changed cells. At the same time, the input of all unchanged cells is always collapsed."
  • Resize columns via the keyboard - Resizing table columns in VS Code more accessible via keyboard: "A new command, list.resizeColumn, enables you to resize columns by using the keyboard. When you trigger this command, select the column you want to resize and provide a percentage of the width you want to set."
  • Source Control Graph - Easily hide, collapse, or move the Source Control Graph: "Based on user feedback, we have moved the history graph that was enabled last milestone from the Source Control view into a new view called Source Control Graph. This reduces the information overload from the main view and enables you to hide/collapse/move the new view as you see fit. This also lays the foundation for a full-featured history graph. The Source Control Graph view currently shows the remote/base for the current branch. In the next milestone, we are working on adding the capability to filter the graph to any repository reference, and improving the experience for workspaces with multiple repositories."

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • Microsoft Eases Integration with Semantic Kernel AI SDK

    The basic idea is to provide unified API abstractions, especially for idiomatic C# code, to help platform developers and others work with any provider with standard implementations for caching, telemetry, tool calling and other common tasks.

  • Final .NET 9 Preview Ships with Go-Live License

    Visual Studio developers can now download the SDK for .NET 9 Release Candidate 2 with a go-live license, meaning devs get Microsoft support for production applications even before the framework reaches general availability next month.

  • Upcycle Your Old Laptops into a Kubernetes Cluster

    Learn about Windows-to-Linux conversions and how to break and fix cloud containers -- all while helping to save the world from e-waste with some "sheer geeky fun."

  • Visual Studio's Future: Live Help to 'AI-ify Your App'

    Visual Studio guru Mads Kristensen provided a peek into the IDE's AI future, explaining how while in live-coding it will identify opportunities for your own app to use AI to your advantage.

Subscribe on YouTube