@statiolake/coc-github-copilot
v2.3.0
Published
GitHub Copilot extension for coc.nvim with inline completion support
Maintainers
Readme
@statiolake/coc-github-copilot
GitHub Copilot integration for coc.nvim with inline completions and Language Model API support.
Features
- 🤖 GitHub Copilot Integration: Official GitHub Copilot Language Server integration
- 🔐 Device Authentication: Secure GitHub device authentication flow
- ⚡ Inline Completions: Automatic code suggestions via Language Server
- 🗨️ Language Model API: Provides chat models for other extensions
- 📊 Status Monitoring: Real-time authentication and service status
- 🛠️ Simple Configuration: Works out of the box with minimal setup
Installation
Prerequisites
- coc.nvim 0.0.82+
- Node.js 16+
- GitHub Copilot subscription
- @statiolake/coc-lm-api: Required dependency
Install via coc.nvim
:CocInstall @statiolake/coc-lm-api @statiolake/coc-github-copilotInstall via npm
npm install -g @statiolake/coc-lm-api @statiolake/coc-github-copilotSetup
- Install both required extensions
- Run
:CocCommand copilot.signInto authenticate with GitHub - Follow the device authentication flow in your browser
- Start coding with Copilot suggestions!
Commands
| Command | Description |
|---------|-------------|
| :CocCommand copilot.signIn | Sign in to GitHub Copilot |
| :CocCommand copilot.signOut | Sign out from GitHub Copilot |
| :CocCommand copilot.status | Show current authentication status |
| :CocCommand copilot.enable | Enable Copilot suggestions |
| :CocCommand copilot.disable | Disable Copilot suggestions |
Configuration
Add to your coc-settings.json:
{
\"copilot.enable\": true,
\"copilot.trace.server\": \"off\"
}Available Settings
copilot.enable(boolean): Enable/disable GitHub Copilot (default: true)copilot.trace.server(string): Language server communication tracing level\"off\": No tracing (default)\"messages\": Log messages\"trace\": Verbose tracing
Status Bar
The extension displays the current Copilot status in the coc.nvim status bar:
Copilot: N/A- Not authenticated or service unavailableCopilot: Ready (username)- Authenticated and ready
Language Model API Integration
This extension automatically registers GitHub Copilot chat models with the LM API, making them available to other extensions like @statiolake/coc-lm-chat.
Available Models
The extension provides access to GitHub Copilot's chat models:
gpt-4.1- Latest GPT-4 varianto1-preview- Reasoning model previewo1-mini- Lightweight reasoning model
Usage
Inline Completions
Once authenticated, Copilot will automatically provide suggestions in the coc.nvim completion popup as you type.
Language Model Access
Other extensions can access Copilot models through the LM API:
import type { LmApi } from '@statiolake/coc-lm-api';
const lmApi: LmApi = extensions.getExtensionById('@statiolake/coc-lm-api').exports;
const models = lmApi.selectChatModels({ vendor: 'GitHub' });Troubleshooting
Authentication Issues
- Make sure you have a valid GitHub Copilot subscription
- Try signing out and signing in again:
:CocCommand copilot.signOutthen:CocCommand copilot.signIn - Check the status:
:CocCommand copilot.status
No Completions
- Verify Copilot is enabled:
:CocCommand copilot.enable - Check your internet connection
- Ensure the file type is supported by Copilot
Extension Dependencies
If you see errors about missing LM API:
- Install the required dependency:
:CocInstall @statiolake/coc-lm-api - Restart coc.nvim:
:CocRestart
Development
# Clone the repository
git clone https://github.com/statiolake/coc-github-copilot.git
cd coc-github-copilot
# Install dependencies
npm install
# Build
npm run build
# Watch mode for development
npm run watch
# Run linting
npm run lintRelated Extensions
- @statiolake/coc-lm-api: Required Language Model API interface
- @statiolake/coc-lm-chat: Interactive chat interface using Copilot models
License
MIT
Repository
Acknowledgments
- GitHub Copilot for AI assistance
- coc.nvim for the extension framework
- @github/copilot-language-server for the language server
