Skip to content

Commit

Permalink
chore(doc): auto generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 18, 2024
1 parent 74e486c commit 9462e89
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions doc/CopilotChat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,49 @@ You can define custom contexts like this:
<


SELECTIONS ~

Selections are used to determine the source of the chat (so basically what to
chat about). Selections are configurable either by default or by prompt.
Default selection is `visual` or `buffer` (if no visual selection). Default
supported selections that live in `local select =
require("CopilotChat.select")` are:

- `select.visual` - Current visual selection. Works well with diffs.
- `select.buffer` - Current buffer content. Works well with diffs.
- `select.line` - Current line content. Works decently with diffs.
- `select.unnamed` - Content from the unnamed register.
- `select.clipboard` - Content from system clipboard.

You can define custom selection functions like this:

>lua
{
selection = function()
-- Get content from * register
local lines = vim.fn.getreg('*')
if not lines or lines == '' then
return nil
end

return {
lines = lines,
}
end
}
<

Or chain multiple selections like this:

>lua
{
selection = function(source)
return select.visual(source) or select.buffer(source)
end
}
<


API ~

>lua
Expand Down

0 comments on commit 9462e89

Please sign in to comment.