diff options
| author | Alexandre Teoi <ateoi@users.noreply.github.com> | 2025-10-04 00:28:27 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-03 20:28:27 -0700 |
| commit | 5b1a75b57e62656b8a3370f516df108ebea4a70c (patch) | |
| tree | a5c0d8c8008165623dd302983f51abf46ed10f9b /lsp/copilot.lua | |
| parent | docs: update configs.md (diff) | |
| download | nvim-lspconfig-5b1a75b57e62656b8a3370f516df108ebea4a70c.tar nvim-lspconfig-5b1a75b57e62656b8a3370f516df108ebea4a70c.tar.gz nvim-lspconfig-5b1a75b57e62656b8a3370f516df108ebea4a70c.tar.bz2 nvim-lspconfig-5b1a75b57e62656b8a3370f516df108ebea4a70c.tar.lz nvim-lspconfig-5b1a75b57e62656b8a3370f516df108ebea4a70c.tar.xz nvim-lspconfig-5b1a75b57e62656b8a3370f516df108ebea4a70c.tar.zst nvim-lspconfig-5b1a75b57e62656b8a3370f516df108ebea4a70c.zip | |
docs(copilot): add instructions to enable lsp inline completion (#4111)
Diffstat (limited to 'lsp/copilot.lua')
| -rw-r--r-- | lsp/copilot.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lsp/copilot.lua b/lsp/copilot.lua index 5f216d53..66c2dd54 100644 --- a/lsp/copilot.lua +++ b/lsp/copilot.lua @@ -13,6 +13,33 @@ --- --- Please see [terms of use for GitHub Copilot](https://docs.github.com/en/site-policy/github-terms/github-terms-for-additional-products-and-features#github-copilot) --- +--- You need to enable `:help lsp-inline-completion` to receive suggestions. For example, you can enable it in the LspAttach event: +--- +--- ```lua +--- vim.api.nvim_create_autocmd('LspAttach', { +--- callback = function(args) +--- local bufnr = args.buf +--- local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) +--- +--- if client:supports_method(vim.lsp.protocol.Methods.textDocument_inlineCompletion, bufnr) then +--- vim.lsp.inline_completion.enable(true, { bufnr = bufnr }) +--- +--- vim.keymap.set( +--- 'i', +--- '<C-F>', +--- vim.lsp.inline_completion.get, +--- { desc = 'LSP: accept inline completion', buffer = bufnr } +--- ) +--- vim.keymap.set( +--- 'i', +--- '<C-G>', +--- vim.lsp.inline_completion.select, +--- { desc = 'LSP: switch inline completion', buffer = bufnr } +--- ) +--- end +--- end +--- }) +--- ``` ---@param bufnr integer, ---@param client vim.lsp.Client |
