Skip to content

Repository files navigation

Local LLM Copilot

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.


🚀 Quick Start

  1. Set up your LLM server. We recommend Ollama:
    • Install Ollama from ollama.ai.
    • Pull a code-focused model: ollama pull codellama:7b.
  2. Install the extension. Install it from the VS Code Marketplace or load it in development mode.
  3. Start Coding! The extension will automatically connect to Ollama and provide intelligent code completions.

✨ Features

Core Functionality

  • 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#.

Architectural Highlights

  • 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.

⚙️ Configuration

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.

📖 Usage

  1. Open a supported code file.
  2. Start typing. The extension will automatically display inline suggestions.
  3. Press Tab to accept a suggestion or Esc to dismiss it.
  4. Use the Local LLM Copilot view in the side panel to easily configure your connection and interact with the LLM via chat.

Commands

Access these commands via the VS Code Command Palette (Ctrl+Shift+P):

  • Local LLM Copilot: Enable
  • Local LLM Copilot: Disable
  • Local LLM Copilot: Test Connection

🐛 Troubleshooting

  • 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., 7B instead of 13B).
    • Reduce the context lines setting.
  • High resource usage?
    • Use a smaller model.
    • Increase the debounce delay to reduce request frequency.

💻 Development

  • Clone the repository.
  • Install dependencies: npm install.
  • Run in development mode: Press F5 in VS Code.
  • Run tests: The project uses Jest. Execute npm test in the terminal to run the test suite.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages