Skip to content

Commit

Permalink
Use relative paths for file references in contexts
Browse files Browse the repository at this point in the history
Makes data smaller and faster

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
  • Loading branch information
deathbeam committed Nov 18, 2024
1 parent 5236f0e commit 7ced8fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/CopilotChat/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ return {
vim.ui.select(
vim.tbl_map(
function(buf)
return { id = buf, name = vim.api.nvim_buf_get_name(buf) }
return { id = buf, name = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(buf), ':p:.') }
end,
vim.tbl_filter(function(buf)
return vim.api.nvim_buf_is_loaded(buf) and vim.fn.buflisted(buf) == 1
Expand Down
3 changes: 2 additions & 1 deletion lua/CopilotChat/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function M.file(filename)

return {
content = table.concat(content, '\n'),
filename = filename,
filename = vim.fn.fnamemodify(filename, ':p:.'),
filetype = vim.filetype.match({ filename = filename }),
}
end
Expand All @@ -127,6 +127,7 @@ end
---@return CopilotChat.copilot.embed?
function M.outline(bufnr)
local name = vim.api.nvim_buf_get_name(bufnr)
name = vim.fn.fnamemodify(name, ':p:.')
local ft = vim.bo[bufnr].filetype

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

0 comments on commit 7ced8fa

Please sign in to comment.