Skip to content

Commit 5801bfe

Browse files
authored
fix(mappings): use resource name if available in preview header (#1459)
When displaying resource previews, prefer showing the resource name instead of the URI if the name is available. This improves readability in the preview header, especially for resources with user-friendly names. Signed-off-by: Tomas Slusny <[email protected]>
1 parent 92f2699 commit 5801bfe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/CopilotChat/config/mappings.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ return {
385385
for _, resource in ipairs(resolved_resources) do
386386
local resource_lines = vim.split(resource.data, '\n')
387387
local preview = vim.list_slice(resource_lines, 1, math.min(10, #resource_lines))
388-
local header = string.format('**%s** (%s lines)', resource.uri, #resource_lines)
388+
local header = string.format('**%s** (%s lines)', resource.name or resource.uri, #resource_lines)
389389
if #resource_lines > 10 then
390390
header = header .. ' (truncated)'
391391
end

0 commit comments

Comments
 (0)