copilotlsp-nvim/copilot-lsp
소개
Copilot LSP: Language Server Protocol(LSP)을 통해 GitHub Copilot의 AI 코드 제안을 통합하는 가볍고 확장 가능한 Neovim 플러그인입니다.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- -1
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalCopilot LSP Configuration for Neovim
Features
Done
- TextDocument Focusing
In Progress
- Inline Completion
- Next Edit Suggestion
- Uses native LSP Binary
To Do
- Sign In Flow
- Status Notification
Usage
To use the plugin, add the following to your Neovim configuration:
return {
"copilotlsp-nvim/copilot-lsp",
init = function()
vim.g.copilot_nes_debounce = 500
vim.lsp.enable("copilot_ls")
vim.keymap.set("n", "<tab>", function()
local bufnr = vim.api.nvim_get_current_buf()
local state = vim.b[bufnr].nes_state
if state then
-- Try to jump to the start of the suggestion edit.
-- If already at the start, then apply the pending suggestion and jump to the end of the edit.
local _ = require("copilot-lsp.nes").walk_cursor_start_edit()
or (
require("copilot-lsp.nes").apply_pending_nes()
and require("copilot-lsp.nes").walk_cursor_end_edit()
)
return nil
else
-- Resolving the terminal's inability to distinguish between `TAB` and `<C-i>` in normal mode
return "<C-i>"
end
end, { desc = "Accept Copilot NES suggestion", expr = true })
end,
}
Clearing suggestions with Escape
You can map the <Esc> key to clear suggestions while preserving its other functionality:
-- Clear copilot suggestion with Esc if visible, otherwise preserve default Esc behavior
vim.keymap.set("n", "<esc>", function()
if not require("copilot-lsp.nes").clear() then
-- fallback to other functionality
end
end, { desc = "Clear Copilot suggestion or fallback" })
Default Configuration
NES (Next Edit Suggestion) Smart Clearing
You don’t need to configure anything, but you can customize the defaults:
move_count_threshold is the most important. It controls how many cursor moves happen before suggestions are cleared. Higher = slower to clear.
require('copilot-lsp').setup({
nes = {
move_count_threshold = 3, -- Clear after 3 cursor movements
}
})
Blink Integration
return {
keymap = {
preset = "super-tab",
["<Tab>"] = {
function(cmp)
if vim.b[vim.api.nvim_get_current_buf()].nes_state then
cmp.hide()
return (
require("copilot-lsp.nes").apply_pending_nes()
and require("copilot-lsp.nes").walk_cursor_end_edit()
)
end
if cmp.snippet_active() then
return cmp.accept()
else
return cmp.select_and_accept()
end
end,
"snippet_forward",
"fallback",
},
},
}
It can also be combined with fang2hou/blink-copilot to get inline completions. Just add the completion source to your Blink configuration and it will integrate
Requirements
- Copilot LSP installed via Mason or system and on PATH
Screenshots
NES
https://github.com/user-attachments/assets/1d5bed4a-fd0a-491f-91f3-a3335cc28682
관련 프로젝트 살펴보기
불러오는 중…