Read Anthropic’s case study about Graphite Reviewer

How AI code review works in Visual Studio Code

Sara Verdi
Sara Verdi
Graphite software engineer
Try Graphite

AI code review tools in Visual Studio Code (VS Code) leverage artificial intelligence to accelerate the code review process by providing automated insights and corrections that enhance code quality. This guide takes a look at how AI-powered code analysis and automated code reviews are integrated into VS Code.

Visual Studio Code supports a variety of AI extensions that augment the coding experience by providing intelligent code completions, bug detection, and more. These extensions can be installed directly from the Visual Studio Marketplace. Once installed, they integrate into your development environment, analyzing code in real-time and providing suggestions and corrections.

Here are a few prominent AI extensions available on the Visual Studio Marketplace that significantly enhance coding efficiency and accuracy:

  1. Visual Studio IntelliCode

    • Functionality: IntelliCode leverages machine learning to offer context-aware code completions, recommending the most likely correct API for the current context.
    • Benefits: It speeds up the coding process and reduces bugs by predicting the most relevant code snippets and API usages.
  2. TabNine

    • Functionality: TabNine is an all-language autocompleter that uses GPT-3 to provide code completions across various languages and frameworks.
    • Benefits: This extension improves coding speed by generating whole lines or blocks of code, allowing developers to focus more on problem-solving rather than syntax.
  3. GitHub Copilot

    • Functionality: GitHub Copilot is an AI pair programmer that suggests whole lines or blocks of code as you type, trained on a dataset sourced from public GitHub repositories.
    • Benefits: Copilot improves developer productivity by offering suggestions for coding tasks, including complex algorithms and API calls, based on the context of the code being written. This helps reduce the time spent on routine coding and allows developers to focus more on strategic tasks.

These extensions collectively help in making the development process more efficient, reduce the likelihood of errors, and ensure high-quality code contributions within projects managed in Visual Studio Code.

Graphite Reviewer stands out among AI code review tools by offering a sophisticated, codebase-aware AI system. It is designed to provide immediate, actionable feedback on pull requests, catching bugs and logical errors before they are reviewed by humans. This allows teams to focus on strategic work rather than mundane checks. Graphite Reviewer is activated with just a few clicks, requiring no complex setup, and it does not store or train on your team's code, ensuring privacy and security.

  • Automated bug detection: Graphite Reviewer scans opened pull requests for bugs and errors, significantly reducing the time spent on manual code reviews.
  • Custom rule enforcement: Users can define and enforce custom patterns specific to their codebase, ensuring consistency and adherence to best practices.
  • Codebase-aware feedback: Utilizing Retrieval-Augmented Generation (RAG), Graphite Reviewer tailors its feedback to the specific context of your codebase, increasing the relevancy and accuracy of its suggestions.

Although Graphite Reviewer cannot be integrated directly into VS Code, Graphite does have a VS Code extension. Any pull requests submitted through Graphite's VS Code extension can then be automatically reviewed by Graphite Reviewer for immediate, actionable feedback.

Here’s a simple workflow to illustrate how Graphite Reviewer works within VS Code:

  1. Install Graphite Reviewer: First, ensure that the Graphite VS Code extension is installed and activated in your VS Code.
  2. Open a project and create a pull request: Work on your code and submit a pull request. Graphite Reviewer automatically starts analyzing the pull request.
  3. Review AI feedback: Graphite’s feedback will highlight issues and suggesting improvements.
  4. Adjust code based on feedback: Make necessary changes based on the AI’s suggestions, which might include bug fixes, syntax errors, or best practice violations.
  5. Finalize the review process: After making adjustments, your code is cleaner and adheres more closely to the project’s guidelines, ready for final human review.

Integrating AI into VS Code through extensions can transform the code review process, making it faster, more accurate, and less tedious. By automating routine checks and ensuring code consistency, AI tools allow developers to concentrate on more complex and creative tasks, pushing the boundaries of what can be achieved in software development.

Git inspired
Graphite's CLI and VS Code extension make working with Git effortless.
Learn more

Built for the world's fastest engineering teams, now available for everyone