Skip to content

Commit ced55b0

Browse files
authored
doc: recipe to automatically hide Copilot suggestions for blink.cmp (#358)
1 parent 73d09db commit ced55b0

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ To toggle auto trigger for the current buffer, use `require("copilot.suggestion"
134134

135135
Copilot suggestion is automatically hidden when `popupmenu-completion` is open. In case you use a custom
136136
menu for completion, you can set the `copilot_suggestion_hidden` buffer variable to `true` to have the
137-
same behavior. For example, with `nvim-cmp`:
137+
same behavior.
138+
139+
<details>
140+
<summary>Example using nvim-cmp</summary>
138141

139142
```lua
140143
cmp.event:on("menu_opened", function()
@@ -145,6 +148,29 @@ cmp.event:on("menu_closed", function()
145148
vim.b.copilot_suggestion_hidden = false
146149
end)
147150
```
151+
</details>
152+
153+
<details>
154+
<summary>Example using blink.cmp</summary>
155+
156+
```lua
157+
vim.api.nvim_create_autocmd("User", {
158+
pattern = "BlinkCmpMenuOpen",
159+
callback = function()
160+
vim.b.copilot_suggestion_hidden = true
161+
end,
162+
})
163+
164+
vim.api.nvim_create_autocmd("User", {
165+
pattern = "BlinkCmpMenuClose",
166+
callback = function()
167+
vim.b.copilot_suggestion_hidden = false
168+
end,
169+
})
170+
171+
```
172+
</details>
173+
148174

149175
The `copilot.suggestion` module exposes the following functions:
150176

0 commit comments

Comments
 (0)