News

GitHub Copilot Labs Brews 'Code Brushes' for ML-Powered Code Modification (Like Photoshop Painting)

Coming from the groundbreaking GitHub Copilot "AI pair programmer" team is a new machine language-powered tool called Code Brushes that aims to make code modification a more tactile process, similar to brush painting in image editing apps.

Code Brushes appeared on Wednesday (Jan. 11) on the GitHub Next site, which "investigates the future of software development." It can be tried out in the GitHub Copilot Labs preview extension in the Visual Studio Code Marketplace, which provides experimental features for GitHub Copilot.

GitHub Copilot, of course, is the AI-powered coding assistant that has been making waves of many different kinds in the software development space since its introduction in 2021.

Code Brushes is headed by Amelia Wattenberger of the R&D group at GitHub Next. Yesterday she took to the Twitter and Mastodon (an alternative to Twitter sans Elon Musk) social media services to announce the project.

"We wondered how we could make editing your code feel as tactile and easy as paint with a brush in Photoshop," she said.

According to the project description on the GitHub Next site, Code Brushes is for updating code with machine learning, now in the "usable prototype" stage.

"Painting is a very visceral activity -- you dip your paintbrush in a color and dab it onto your image," it says. "We wondered if we could make editing code feel just as tactile. To explore this idea, we added a toolbox of brushes to our Copilot Labs Visual Studio Code extension that can modify your code. Just select a few lines, choose your brush, and see your code update."

It can perform many different kinds of actions with different brushes, including:

  • Make code more readable: Let's say you were working on code with a function that's hard to digest. What would it look like to “paint” that code with a brush that makes it easier to understand?
  • Add types: Could adding types be as easy as clicking a button?
  • Fix simple bugs: What if it were easy to fix simple bugs, like typos?
  • Add debugging statements: Or if those bugs are more complex, could a brush add debugging statements for you?
  • Make your code more robust: It works in my browser, what about yours? Make any code more robust with a click.

But beyond those, developers can also define their own custom brushes on the fly.

All of the above brushes and a few others have been added to the Copilot Labs brushes toolbox, which is available for anyone with a GitHub Copilot license, costing $10 per month or $100 per year.

Current Code Brushes
[Click on image for larger view.] Current Code Brushes (source: GitHub).

"This was a quick exploration, really just the tip of the iceberg!" the project site states. "In the future, we're interested in adding more useful brushes, as well as letting developers store their own custom brushes."

How Code Brushes perform their ML-powered magic isn't really explained, but each of the brushes mentioned above comes with screenshot examples showing their effect. The bug-fixing brush, for example can fix a simple typo, changing a variable name from the incorrect "low" to the correct "lo":

Original buggy code:

Original Code with 'low'
[Click on image for larger view.] Original Code with 'low' (source: GitHub).

Brushed code:

Original Code with 'low'
[Click on image for larger view.] Fixed Code with 'lo' (source: GitHub).

Other brushes make much more substantive changes. For example, here's how some code is make more readable:

Original hard-to-read code:

Original Code
[Click on image for larger view.] Original Code (source: GitHub).

Brushed more-readable code:

Brushed Code
[Click on image for larger view.] Brushed Code (source: GitHub).

And here's an animated GIF showing the brushes in action, coming from Christian Heilmann, who wrote about the early-stage tech a full month ago.

Add Types Brush in Animated Action
[Click on image for larger, animated GIF view.] Add Types Brush in Animated Action (source: Christian Heilmann).

"Github Next now showed a new feature in GitHub Copilot labs that allows you to change code you write to make it cleaner, more robust and document it automatically," Heilmann said. "GitHub Copilot is incredible, and if you check what's happening in the preview released as the Copilot Labs extension it will only get more amazing."

The GitHub Copilot Labs tool installs a VS Code sidebar that now has four features: code explanation, code translation, IDE Brushes and test generation.

At the time of this writing, the extension has been installed 131,369 times, earning a perfect 5.0 rating from six reviewers.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube