Skip to content

Commit e688b48

Browse files
docs: update configs.md
skip-checks: true
1 parent 5b1a75b commit e688b48

File tree

2 files changed

+60
-6
lines changed

2 files changed

+60
-6
lines changed

doc/configs.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2393,6 +2393,34 @@ is an AI pair programmer tool that helps you write code faster and smarter.
23932393

23942394
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)
23952395

2396+
You need to enable `:help lsp-inline-completion` to receive suggestions. For example, you can enable it in the LspAttach event:
2397+
2398+
```lua
2399+
vim.api.nvim_create_autocmd('LspAttach', {
2400+
callback = function(args)
2401+
local bufnr = args.buf
2402+
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
2403+
2404+
if client:supports_method(vim.lsp.protocol.Methods.textDocument_inlineCompletion, bufnr) then
2405+
vim.lsp.inline_completion.enable(true, { bufnr = bufnr })
2406+
2407+
vim.keymap.set(
2408+
'i',
2409+
'<C-F>',
2410+
vim.lsp.inline_completion.get,
2411+
{ desc = 'LSP: accept inline completion', buffer = bufnr }
2412+
)
2413+
vim.keymap.set(
2414+
'i',
2415+
'<C-G>',
2416+
vim.lsp.inline_completion.select,
2417+
{ desc = 'LSP: switch inline completion', buffer = bufnr }
2418+
)
2419+
end
2420+
end
2421+
})
2422+
```
2423+
23962424
Snippet to enable the language server:
23972425
```lua
23982426
vim.lsp.enable('copilot')
@@ -2408,15 +2436,15 @@ Default config:
24082436
{
24092437
editorInfo = {
24102438
name = "Neovim",
2411-
version = "0.12.0-dev+g28ccebd138"
2439+
version = "0.12.0-dev+g2abea5dc37"
24122440
},
24132441
editorPluginInfo = {
24142442
name = "Neovim",
2415-
version = "0.12.0-dev+g28ccebd138"
2443+
version = "0.12.0-dev+g2abea5dc37"
24162444
}
24172445
}
24182446
```
2419-
- `on_attach`: [../lsp/copilot.lua:79](../lsp/copilot.lua#L79)
2447+
- `on_attach`: [../lsp/copilot.lua:106](../lsp/copilot.lua#L106)
24202448
- `root_markers` :
24212449
```lua
24222450
{ ".git" }

doc/configs.txt

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,32 @@ is an AI pair programmer tool that helps you write code faster and smarter.
15581558

15591559
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)
15601560

1561+
You need to enable `:help lsp-inline-completion` to receive suggestions. For example, you can enable it in the LspAttach event:
1562+
>lua
1563+
vim.api.nvim_create_autocmd('LspAttach', {
1564+
callback = function(args)
1565+
local bufnr = args.buf
1566+
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
1567+
1568+
if client:supports_method(vim.lsp.protocol.Methods.textDocument_inlineCompletion, bufnr) then
1569+
vim.lsp.inline_completion.enable(true, { bufnr = bufnr })
1570+
1571+
vim.keymap.set(
1572+
'i',
1573+
'<C-F>',
1574+
vim.lsp.inline_completion.get,
1575+
{ desc = 'LSP: accept inline completion', buffer = bufnr }
1576+
)
1577+
vim.keymap.set(
1578+
'i',
1579+
'<C-G>',
1580+
vim.lsp.inline_completion.select,
1581+
{ desc = 'LSP: switch inline completion', buffer = bufnr }
1582+
)
1583+
end
1584+
end
1585+
})
1586+
15611587
Snippet to enable the language server: >lua
15621588
vim.lsp.enable('copilot')
15631589

@@ -1569,14 +1595,14 @@ Default config:
15691595
{
15701596
editorInfo = {
15711597
name = "Neovim",
1572-
version = "0.12.0-dev+g28ccebd138"
1598+
version = "0.12.0-dev+g2abea5dc37"
15731599
},
15741600
editorPluginInfo = {
15751601
name = "Neovim",
1576-
version = "0.12.0-dev+g28ccebd138"
1602+
version = "0.12.0-dev+g2abea5dc37"
15771603
}
15781604
}
1579-
- on_attach (use "gF" to view): ../lsp/copilot.lua:79
1605+
- on_attach (use "gF" to view): ../lsp/copilot.lua:106
15801606
- root_markers: >lua
15811607
{ ".git" }
15821608
- settings: >lua

0 commit comments

Comments
 (0)