Skip to content

Commit 29cfaf2

Browse files
CopilotDanRioDev
andcommitted
Update README with enhanced context documentation
Co-authored-by: DanRioDev <1839750+DanRioDev@users.noreply.github.com>
1 parent 0e01ac7 commit 29cfaf2

File tree

1 file changed

+126
-7
lines changed

1 file changed

+126
-7
lines changed

README.md

Lines changed: 126 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,79 @@ require('opencode').setup({
211211
selection = {
212212
enabled = true, -- Include selected text in the context
213213
},
214+
-- Enhanced context options (all disabled by default)
215+
marks = {
216+
enabled = false, -- Include the 10 most recently accessed marks
217+
limit = 10,
218+
},
219+
jumplist = {
220+
enabled = false, -- Include the last 10 jumps
221+
limit = 10,
222+
},
223+
recent_buffers = {
224+
enabled = false, -- Include the 10 most recently accessed buffers
225+
limit = 10,
226+
},
227+
undo_history = {
228+
enabled = false, -- Include the last 10 undo branches/changesets
229+
limit = 10,
230+
},
231+
windows_tabs = {
232+
enabled = false, -- Include active windows and tabs information
233+
},
234+
highlights = {
235+
enabled = false, -- Include buffer line highlights in current viewport
236+
},
237+
session_info = {
238+
enabled = false, -- Include current session name if active
239+
},
240+
registers = {
241+
enabled = false, -- Include contents of specified registers
242+
include = { '"', '/', 'q' }, -- Registers to include
243+
},
244+
command_history = {
245+
enabled = false, -- Include the last 5 executed commands
246+
limit = 5,
247+
},
248+
search_history = {
249+
enabled = false, -- Include the last 5 search patterns
250+
limit = 5,
251+
},
252+
debug_data = {
253+
enabled = false, -- Include active nvim-dap debugging sessions and breakpoints
254+
},
255+
lsp_context = {
256+
enabled = false, -- Include LSP diagnostics and code actions
257+
diagnostics_limit = 10, -- Max diagnostics to include
258+
code_actions = false, -- Include available code actions at cursor
259+
},
260+
git_info = {
261+
enabled = false, -- Include git branch, file diff, and recent changes
262+
diff_limit = 10, -- Max lines of file diff to include
263+
changes_limit = 5, -- Number of recent commits to include
264+
},
265+
fold_info = {
266+
enabled = false, -- Include visible fold information in viewport
267+
},
268+
cursor_surrounding = {
269+
enabled = false, -- Include lines around cursor position
270+
lines_above = 3, -- Lines to include above cursor
271+
lines_below = 3, -- Lines to include below cursor
272+
},
273+
quickfix_loclist = {
274+
enabled = false, -- Include quickfix and location list entries
275+
limit = 5,
276+
},
277+
macros = {
278+
enabled = false, -- Include recorded macro content
279+
register = 'q', -- Macro register to include
280+
},
281+
terminal_buffers = {
282+
enabled = false, -- Include most recently used terminal buffer details
283+
},
284+
session_duration = {
285+
enabled = false, -- Include time spent in current Neovim session
286+
},
214287
},
215288
debug = {
216289
enabled = false, -- Enable debug messages in the output window
@@ -343,13 +416,59 @@ Run a prompt in a new session using the Plan agent and disabling current file co
343416

344417
The following editor context is automatically captured and included in your conversations.
345418

346-
| Context Type | Description |
347-
| --------------- | ---------------------------------------------------- |
348-
| Current file | Path to the focused file before entering opencode |
349-
| Selected text | Text and lines currently selected in visual mode |
350-
| Mentioned files | File info added through [mentions](#file-mentions) |
351-
| Diagnostics | Diagnostics from the current file (if any) |
352-
| Cursor position | Current cursor position and line content in the file |
419+
### Core Context (Enabled by Default)
420+
421+
| Context Type | Description | Configuration Key |
422+
| --------------- | ---------------------------------------------------- | ------------------------ |
423+
| Current file | Path to the focused file before entering opencode | `current_file.enabled` |
424+
| Selected text | Text and lines currently selected in visual mode | `selection.enabled` |
425+
| Mentioned files | File info added through [mentions](#file-mentions) | N/A (always available) |
426+
| Diagnostics | Diagnostics from the current file (if any) | `diagnostics` |
427+
| Cursor position | Current cursor position and line content in the file | `cursor_data.enabled` |
428+
429+
### Enhanced Context (Disabled by Default)
430+
431+
These additional context types can be enabled to provide even more information to the AI:
432+
433+
| Context Type | Description | Configuration Key |
434+
| ------------------ | ---------------------------------------------------------- | -------------------------- |
435+
| Marks | 10 most recently accessed marks | `marks.enabled` |
436+
| Jumplist | Last 10 jumps in the jump list | `jumplist.enabled` |
437+
| Recent Buffers | 10 most recently accessed buffers | `recent_buffers.enabled` |
438+
| Undo History | Last 10 undo branches or changesets | `undo_history.enabled` |
439+
| Windows & Tabs | Information about active windows and tabs | `windows_tabs.enabled` |
440+
| Highlights | Buffer line highlights in current viewport | `highlights.enabled` |
441+
| Session Info | Current Neovim session name if active | `session_info.enabled` |
442+
| Registers | Contents of specified registers (e.g., `"`, `/`, `q`) | `registers.enabled` |
443+
| Command History | Last 5 executed Vim commands | `command_history.enabled` |
444+
| Search History | Last 5 search patterns | `search_history.enabled` |
445+
| Debug Data | Active nvim-dap debugging sessions and breakpoints | `debug_data.enabled` |
446+
| LSP Context | LSP diagnostics and available code actions | `lsp_context.enabled` |
447+
| Git Info | Current branch, file diff, and recent commits | `git_info.enabled` |
448+
| Fold Info | Visible folds in current viewport | `fold_info.enabled` |
449+
| Cursor Surrounding | Lines above and below cursor position | `cursor_surrounding.enabled`|
450+
| Quickfix/Loclist | Quickfix and location list entries | `quickfix_loclist.enabled` |
451+
| Macros | Recorded macro content from specified register | `macros.enabled` |
452+
| Terminal Buffers | Most recently used terminal buffer details | `terminal_buffers.enabled` |
453+
| Session Duration | Time spent in current Neovim session | `session_duration.enabled` |
454+
455+
To enable any of these enhanced context types, add them to your configuration:
456+
457+
```lua
458+
require('opencode').setup({
459+
context = {
460+
-- Enable specific enhanced context types
461+
marks = { enabled = true, limit = 10 },
462+
jumplist = { enabled = true, limit = 10 },
463+
git_info = { enabled = true, diff_limit = 10, changes_limit = 5 },
464+
lsp_context = { enabled = true, diagnostics_limit = 10, code_actions = true },
465+
cursor_surrounding = { enabled = true, lines_above = 3, lines_below = 3 },
466+
-- ... enable others as needed
467+
},
468+
})
469+
```
470+
471+
**Note:** Enhanced context types are disabled by default to minimize token usage and API costs. Enable only the context types that are relevant to your workflow.
353472

354473
<a id="file-mentions"></a>
355474

0 commit comments

Comments
 (0)