Skip to content

Commit d76be3d

Browse files
committed
fix: handle symlinks in chat checks (issue: #104)
1 parent 8d2f1af commit d76be3d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/gp/init.lua

+4-2
Original file line numberDiff line numberDiff line change
@@ -1376,8 +1376,10 @@ end
13761376
---@param file_name string # file name
13771377
---@return string | nil # reason for not being a chat or nil if it is a chat
13781378
M.not_chat = function(buf, file_name)
1379-
if not _H.starts_with(file_name, M.config.chat_dir) then
1380-
return "not in chat directory (" .. M.config.chat_dir .. ")"
1379+
file_name = vim.fn.resolve(file_name)
1380+
local chat_dir = vim.fn.resolve(M.config.chat_dir)
1381+
if not _H.starts_with(file_name, chat_dir) then
1382+
return "resolved file (" .. file_name .. ") not in chat dir (" .. chat_dir .. ")"
13811383
end
13821384

13831385
local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false)

0 commit comments

Comments
 (0)