Skip to content

Commit 7ced8fa

Browse files
committed
Use relative paths for file references in contexts
Makes data smaller and faster Signed-off-by: Tomas Slusny <[email protected]>
1 parent 5236f0e commit 7ced8fa

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lua/CopilotChat/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ return {
141141
vim.ui.select(
142142
vim.tbl_map(
143143
function(buf)
144-
return { id = buf, name = vim.api.nvim_buf_get_name(buf) }
144+
return { id = buf, name = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(buf), ':p:.') }
145145
end,
146146
vim.tbl_filter(function(buf)
147147
return vim.api.nvim_buf_is_loaded(buf) and vim.fn.buflisted(buf) == 1

lua/CopilotChat/context.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function M.file(filename)
116116

117117
return {
118118
content = table.concat(content, '\n'),
119-
filename = filename,
119+
filename = vim.fn.fnamemodify(filename, ':p:.'),
120120
filetype = vim.filetype.match({ filename = filename }),
121121
}
122122
end
@@ -127,6 +127,7 @@ end
127127
---@return CopilotChat.copilot.embed?
128128
function M.outline(bufnr)
129129
local name = vim.api.nvim_buf_get_name(bufnr)
130+
name = vim.fn.fnamemodify(name, ':p:.')
130131
local ft = vim.bo[bufnr].filetype
131132

132133
-- If buffer is not too big, just return the content

0 commit comments

Comments
 (0)