Skip to content

Commit 9462e89

Browse files
chore(doc): auto generate docs
1 parent 74e486c commit 9462e89

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

doc/CopilotChat.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,49 @@ You can define custom contexts like this:
293293
<
294294

295295

296+
SELECTIONS ~
297+
298+
Selections are used to determine the source of the chat (so basically what to
299+
chat about). Selections are configurable either by default or by prompt.
300+
Default selection is `visual` or `buffer` (if no visual selection). Default
301+
supported selections that live in `local select =
302+
require("CopilotChat.select")` are:
303+
304+
- `select.visual` - Current visual selection. Works well with diffs.
305+
- `select.buffer` - Current buffer content. Works well with diffs.
306+
- `select.line` - Current line content. Works decently with diffs.
307+
- `select.unnamed` - Content from the unnamed register.
308+
- `select.clipboard` - Content from system clipboard.
309+
310+
You can define custom selection functions like this:
311+
312+
>lua
313+
{
314+
selection = function()
315+
-- Get content from * register
316+
local lines = vim.fn.getreg('*')
317+
if not lines or lines == '' then
318+
return nil
319+
end
320+
321+
return {
322+
lines = lines,
323+
}
324+
end
325+
}
326+
<
327+
328+
Or chain multiple selections like this:
329+
330+
>lua
331+
{
332+
selection = function(source)
333+
return select.visual(source) or select.buffer(source)
334+
end
335+
}
336+
<
337+
338+
296339
API ~
297340

298341
>lua

0 commit comments

Comments
 (0)