diff options
| author | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2025-10-04 03:28:37 +0000 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2025-10-04 03:28:37 +0000 |
| commit | e688b486fe9291f151eae7e5c0b5a5c4ef980847 (patch) | |
| tree | 07b712feeda21e2abb020c13dae1863eb481ce96 | |
| parent | docs(copilot): add instructions to enable lsp inline completion (#4111) (diff) | |
| download | nvim-lspconfig-e688b486fe9291f151eae7e5c0b5a5c4ef980847.tar nvim-lspconfig-e688b486fe9291f151eae7e5c0b5a5c4ef980847.tar.gz nvim-lspconfig-e688b486fe9291f151eae7e5c0b5a5c4ef980847.tar.bz2 nvim-lspconfig-e688b486fe9291f151eae7e5c0b5a5c4ef980847.tar.lz nvim-lspconfig-e688b486fe9291f151eae7e5c0b5a5c4ef980847.tar.xz nvim-lspconfig-e688b486fe9291f151eae7e5c0b5a5c4ef980847.tar.zst nvim-lspconfig-e688b486fe9291f151eae7e5c0b5a5c4ef980847.zip | |
docs: update configs.md
skip-checks: true
| -rw-r--r-- | doc/configs.md | 34 | ||||
| -rw-r--r-- | doc/configs.txt | 32 |
2 files changed, 60 insertions, 6 deletions
diff --git a/doc/configs.md b/doc/configs.md index 0693efeb..f9dbbb7a 100644 --- a/doc/configs.md +++ b/doc/configs.md @@ -2393,6 +2393,34 @@ is an AI pair programmer tool that helps you write code faster and smarter. 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 +}) +``` + Snippet to enable the language server: ```lua vim.lsp.enable('copilot') @@ -2408,15 +2436,15 @@ Default config: { editorInfo = { name = "Neovim", - version = "0.12.0-dev+g28ccebd138" + version = "0.12.0-dev+g2abea5dc37" }, editorPluginInfo = { name = "Neovim", - version = "0.12.0-dev+g28ccebd138" + version = "0.12.0-dev+g2abea5dc37" } } ``` -- `on_attach`: [../lsp/copilot.lua:79](../lsp/copilot.lua#L79) +- `on_attach`: [../lsp/copilot.lua:106](../lsp/copilot.lua#L106) - `root_markers` : ```lua { ".git" } diff --git a/doc/configs.txt b/doc/configs.txt index eba462ac..fa9d25b2 100644 --- a/doc/configs.txt +++ b/doc/configs.txt @@ -1558,6 +1558,32 @@ is an AI pair programmer tool that helps you write code faster and smarter. 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 + }) + Snippet to enable the language server: >lua vim.lsp.enable('copilot') @@ -1569,14 +1595,14 @@ Default config: { editorInfo = { name = "Neovim", - version = "0.12.0-dev+g28ccebd138" + version = "0.12.0-dev+g2abea5dc37" }, editorPluginInfo = { name = "Neovim", - version = "0.12.0-dev+g28ccebd138" + version = "0.12.0-dev+g2abea5dc37" } } -- on_attach (use "gF" to view): ../lsp/copilot.lua:79 +- on_attach (use "gF" to view): ../lsp/copilot.lua:106 - root_markers: >lua { ".git" } - settings: >lua |
