mirror of
https://github.com/neovim/nvim-lspconfig.git
synced 2026-05-05 16:46:11 +02:00
docs(copilot): add instructions to enable lsp inline completion (#4111)
This commit is contained in:
parent
b8c3630ce3
commit
5b1a75b57e
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user