RepoLens for VS Code
Instant AI code reviews and refactoring in your IDE.
Features
- Code Reviews — Review uncommitted changes or entire branches
- Refactoring Suggestions — Inline refactoring with diff preview and one-click apply
- Line Suggestions — Passive, line-by-line advice for quality, readability, and maintainability
- Coding Assistant — Chat-based AI assistant with recipes (docstrings, tests, diagrams, etc.)
- Custom Rules — Pattern-based search/replace across your workspace
- Clone Detection — Find duplicate code across your project
- Code Metrics — Hover for quality insights on function definitions
- GitHub Integration — Auto-review PRs by installing the GitHub App
Getting Started
- Install the extension from the VS Code Marketplace
- Open any Python or JavaScript/TypeScript file
- Click the RepoLens logo in the activity bar to login
- Open
scripts/repolens.py from the RepoLens sidebar to run through the tutorial
Project Structure
src/
├── extension.ts Extension entry point (activation, commands, notifications)
├── ask-repolens.ts "Ask RepoLens" quick-pick command
├── uninstall.ts Cleanup on extension uninstall
├── lsp/
│ └── client.ts LSP language client creation and configuration
├── providers/
│ ├── chat.ts Chat webview provider (sidebar + analytics panel)
│ ├── rule-search.ts Rule input webview provider
│ └── rule-search-results.ts Scan results tree data provider
├── utils/
│ ├── editor.ts Active editor helpers (getSelectedText)
│ ├── executable.ts Binary path resolution and platform checks
│ ├── ide-state.ts IDE state capture for coding assistant
│ └── markdown.ts Markdown rendering with syntax highlighting
└── webview/
└── search.js Rule search frontend script
Development
Prerequisites
Setup
yarn install
Build
yarn compile # TypeScript compilation (one-shot)
yarn watch # TypeScript compilation (watch mode)
yarn esbuild # Bundle with esbuild + sourcemaps
yarn esbuild-watch # Bundle in watch mode
yarn format # Prettier --write
yarn lint:format # Prettier --check
Run
yarn vscode # Launch VS Code extension host
Test
yarn test-compile # TypeScript compilation for tests
Developer notes
- The extension now applies rule-based edits in a safer batch mode and shows success/failure feedback.
- The
Ask RepoLens quick pick flow is hardened to handle empty or cancelled input gracefully.
- Rule search webview markup and DOM handling were fixed to prevent broken element selection.
- Language server configuration sync is centralized through
getRepoLensConfig() and updates on config changes.
- Added a new walkthrough step for line suggestions and passive code-quality guidance.
Packaging
yarn vscode:prepublish # Minified esbuild bundle
Use vsce to produce a .vsix:
npx vsce package
Configuration
Settings available under repolens.*:
| Key |
Default |
Description |
repolens.token |
"" |
Auth token from https://repolens.ai/dashboard |
repolens.codeLens |
true |
Show code lens for coding assistant |
repolens.suggestFixes |
true |
Suggest AI fixes for problems |
repolens.ruleType.refactorings |
true |
Show refactoring suggestions |
repolens.ruleType.suggestions |
true |
Show suggestion hints |
repolens.ruleType.comments |
true |
Show inline comments |
Environment Variables
| Variable |
Purpose |
REPOLENSY_EXECUTABLE |
Override path to the RepoLens language server binary |
REPOLENSY_CODING_ASSISTANT_ASSETS_PATH |
Override path to coding assistant web assets |
License
MIT