Skip to content

Commit 1612d8f

Browse files
committed
fix(ui): enhance reference formatting in picker
- improve reference location display by including line and column info - handle cases where end position is available for better accuracy - simplify display logic to ensure consistent output for references
1 parent e40731a commit 1612d8f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lua/opencode/ui/reference_picker.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,17 @@ end
184184
---@return PickerItem
185185
local function format_reference_item(ref, width)
186186
local icon = icons.get('file')
187-
local location = ref.line and (ref.file_path .. ':' .. ref.line) or ref.file_path
187+
local location = ref.file_path
188+
189+
if ref.line then
190+
location = location .. ':' .. ref.line
191+
if ref.end_pos and ref.end_pos[1] then
192+
location = location .. '-' .. ref.end_pos[1]
193+
elseif ref.column then
194+
location = location .. ':' .. ref.column
195+
end
196+
end
197+
188198
local display_text = icon .. ' ' .. location
189199

190200
return base_picker.create_picker_item(display_text, nil, nil, width)

0 commit comments

Comments
 (0)