LGTM is a Visual Studio Code extension that uses GitHub Copilot Chat to review source code changes in Git. It can help you catch bugs, areas for improvement, and other issues before merging.
Getting Started
Open the Chat Sidebar
Switch to the Chat sidebar and ensure you are in Ask mode.
Start a Review
Type /review to review uncommitted changes or changes between two branches, commits, or tags.
You can specify git refs explicitly, e.g. /review develop main, or omit arguments to select refs interactively.
Use /branch to review changes between two branches.
Use /commit to review a single commit.
View Results
LGTM will respond with review comments grouped by file and sorted by severity.
Features
Only Copilot Required: Uses Copilot Chat for reviewing changes.
Model Selection: Choose any language model available to VS Code via the LGTM: Select Chat Model command available in the Command Palette (press Cmd+Shift+P or Ctrl+Shift+P).
Custom Instructions: Add custom instructions via the Lgtm: Custom Prompt setting (e.g., change the language of review comments by adding - In the final JSON output, use Spanish for the comment field.).
Agent Support: Adds tools to enable automatic reviews in agent mode:
#review: Reviews changes between two git references (branches, tags, or commits)
#reviewStaged: Reviews only staged changes in your working directory
#reviewUnstaged: Reviews only unstaged changes in your working directory
Example usage: After your changes, run all tests and run #reviewUnstaged to check your work.
Chat Integration: Review content remains in chat history for follow-up questions by omitting @lgtm.
Limitations
This project is a work in progress; comment quality may vary.
Large change sets may trigger chat model rate limits. Please wait before retrying.
Some non-Copilot models require setting a system prompt which is not possible just yet.
Data Usage
Source code changes and commit messages selected for review are sent to the chat model configured in the extension settings (default: GitHub Copilot GPT-4o).
Contributing
Contributions are welcome! If you have ideas, bug reports, or want to help improve LGTM, please open an issue or submit a pull request on GitHub.