Skip to content
2 changes: 1 addition & 1 deletion lua/opencode/commands/handlers/workflow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ function M.actions.clear_files()
end

function M.actions.jump_to_file()
require('opencode.ui.navigation').jump_to_target_at_cursor()
require('opencode.ui.navigation').jump_to_file_at_cursor()
end

function M.actions.jump_to_target_at_cursor()
Expand Down
1 change: 0 additions & 1 deletion lua/opencode/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ function M.setup(opts)
require('opencode.event_manager').setup()
require('opencode.context').setup()
require('opencode.ui.context_bar').setup()
require('opencode.ui.reference_picker').setup()
end

return M
42 changes: 42 additions & 0 deletions lua/opencode/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,48 @@
---@field display_line number Line number to display the action
---@field range? { from: number, to: number } Optional range for the action

---@class CodeReferenceTextRange
---@field start_offset integer Raw part text offset, 1-based inclusive
---@field end_offset integer Raw part text offset, 1-based inclusive

---@class CodeReference
---@field session_id string
---@field message_id string
---@field part_id string
---@field path string
---@field line? integer
---@field col? integer
---@field source_kind 'assistant_text'|'tool_file_path'
---@field raw_range? CodeReferenceTextRange Required for assistant_text references
---@field order integer Smaller values appear earlier in the session message/part/text order.

---@class SymbolSnapshotCycle

---@class FormatterContext
---@field interactive boolean
---@field get_child_parts? fun(session_id: string): OpencodeMessagePart[]?
---@field current_refs? CodeReference[]
---@field current_files? string[]
---@field symbol_cycle? SymbolSnapshotCycle

---@class OutputTargetRange
---@field line integer Output-local line, 1-based
---@field start_col integer Output-local column, 0-based inclusive
---@field end_col integer Output-local column, 0-based exclusive

---@class OutputTarget
---@field kind 'file'|'diff'|'symbol'
---@field range OutputTargetRange
---@field path? string
---@field line? integer
---@field col? integer
---@field token? string
---@field candidate_files? string[]

---@class RenderedTarget: OutputTarget
---@field part_id string
---@field message_id string

---@alias OutputExtmarkType vim.api.keyset.set_extmark & {start_col:0}
---@alias OutputExtmark OutputExtmarkType|fun():OutputExtmarkType

Expand Down
11 changes: 11 additions & 0 deletions lua/opencode/ui/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ function M.setup_autocmds(windows)
end,
})

vim.api.nvim_create_autocmd({ 'BufWritePost', 'BufFilePost', 'BufDelete', 'BufWipeout', 'FileChangedShellPost' }, {
group = group,
pattern = '*',
callback = function(args)
if args.file == '' then
return
end
require('opencode.ui.renderer.events').invalidate_reference_targets_for_file_change()
end,
})

vim.api.nvim_create_autocmd('WinEnter', {
group = group,
pattern = '*',
Expand Down
3 changes: 3 additions & 0 deletions lua/opencode/ui/event_scope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ local policies = {
['file.edited'] = function()
return true
end,
['file.watcher.updated'] = function()
return true
end,
['custom.restore_point.created'] = function()
return true
end,
Expand Down
Loading
Loading