Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ require("copilot.panel").refresh()

When `auto_trigger` is `true`, copilot starts suggesting as soon as you enter insert mode.

When `auto_trigger` is `false`, use the `next` or `prev` keymap to trigger copilot suggestion.
When `auto_trigger` is `false`, use the `next`, `prev` or `accept` keymap to trigger copilot suggestion.

To toggle auto trigger for the current buffer, use `require("copilot.suggestion").toggle_auto_trigger()`.

Expand All @@ -148,6 +148,7 @@ cmp.event:on("menu_closed", function()
vim.b.copilot_suggestion_hidden = false
end)
```

</details>

<details>
Expand All @@ -169,8 +170,8 @@ vim.api.nvim_create_autocmd("User", {
})

```
</details>

</details>

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

Expand Down
6 changes: 6 additions & 0 deletions lua/copilot/suggestion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ end
function mod.accept(modifier)
local ctx = get_ctx()

-- no suggestion request yet
if not ctx.first then
schedule(ctx)
return
end

local suggestion = get_current_suggestion(ctx)
if not suggestion or vim.fn.empty(suggestion.text) == 1 then
return
Expand Down