An advanced VS Code extension that provides powerful, privacy-focused code completion by running entirely on your local machine. Powered by a flexible, modular architecture, it's a fast and secure alternative to cloud-based solutions.
- Set up your LLM server. We recommend Ollama:
- Install Ollama from ollama.ai.
- Pull a code-focused model:
ollama pull codellama:7b.
- Install the extension. Install it from the VS Code Marketplace or load it in development mode.
- Start Coding! The extension will automatically connect to Ollama and provide intelligent code completions.
- AI-Powered Code Completion: Generate high-quality code suggestions with your own local Large Language Models (LLMs).
- Complete Privacy: Your code never leaves your machine. All processing is done locally, ensuring maximum security and confidentiality.
- Multi-Backend Support: Seamlessly switch between popular backends like Ollama, LM Studio, and any OpenAI-compatible API.
- Context-Aware Suggestions: The extension intelligently analyzes your surrounding code to provide highly relevant and accurate completions.
- Real-time Performance: Optimized with smart debouncing and cancellation to provide a smooth, responsive user experience.
- Broad Language Support: Works with over 20 programming languages, from TypeScript and Python to Rust and C#.
- Modular Design: A clean, scalable architecture with dedicated modules for configuration (
Config), completion logic (CompletionProvider), and a custom user interface (WebviewViewProvider). - Robust Lifecycle Management: The extension's state and resource cleanup are centrally managed by the
ExtensionManager, ensuring a stable and efficient runtime.
Open your VS Code settings and search for "Local LLM Copilot".
- Enabled: Toggle the completion provider on or off.
- API URL: The address of your local LLM server (e.g.,
http://localhost:11434). - Model: The name of the model you wish to use (e.g.,
codellama:7b). - Max Tokens: The maximum length of the generated completion.
- Temperature: Control the creativity of the suggestions. A lower value (e.g.,
0.2) produces more deterministic output. - Context Lines: The number of lines before the cursor to send as context.
- Debounce: The delay in milliseconds before a completion request is sent.
- Open a supported code file.
- Start typing. The extension will automatically display inline suggestions.
- Press
Tabto accept a suggestion orEscto dismiss it. - Use the
Local LLM Copilotview in the side panel to easily configure your connection and interact with the LLM via chat.
Access these commands via the VS Code Command Palette (Ctrl+Shift+P):
Local LLM Copilot: EnableLocal LLM Copilot: DisableLocal LLM Copilot: Test Connection
- No completions appearing?
- Confirm your LLM server is running and accessible.
- Run the "Test Connection" command to diagnose connectivity issues.
- Slow completions?
- Consider using a smaller model (e.g.,
7Binstead of13B). - Reduce the context lines setting.
- Consider using a smaller model (e.g.,
- High resource usage?
- Use a smaller model.
- Increase the debounce delay to reduce request frequency.
- Clone the repository.
- Install dependencies:
npm install. - Run in development mode: Press
F5in VS Code. - Run tests: The project uses Jest. Execute
npm testin the terminal to run the test suite.