docs(copilot): add instructions to enable lsp inline completion (#4111)

This commit is contained in:
Alexandre Teoi 2025-10-04 00:28:27 -03:00 committed by GitHub
parent b8c3630ce3
commit 5b1a75b57e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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