fix: improve graph path handling and error messages
- Handle nil idea_dir in config (don't override default with nil) - Expand environment variables and ~ in paths during setup - Add get_idea_dir() helper function for consistent path access - Remove trailing slashes from paths - Add fallback to non-recursive glob if recursive finds no files - Show actual path being used in error messages for debugging - Better error messages when directory doesn't exist or has no .md files
This commit is contained in:
@@ -31,7 +31,25 @@ M.options = {
|
||||
---@param user_opts IdeaDropOptions|nil User configuration options
|
||||
---@return nil
|
||||
function M.setup(user_opts)
|
||||
M.options = vim.tbl_deep_extend("force", M.options, user_opts or {})
|
||||
user_opts = user_opts or {}
|
||||
|
||||
-- Handle nil idea_dir (don't override default with nil)
|
||||
if user_opts.idea_dir == nil then
|
||||
user_opts.idea_dir = M.options.idea_dir
|
||||
end
|
||||
|
||||
-- Expand environment variables and ~ in idea_dir
|
||||
if user_opts.idea_dir then
|
||||
user_opts.idea_dir = vim.fn.expand(user_opts.idea_dir)
|
||||
end
|
||||
|
||||
M.options = vim.tbl_deep_extend("force", M.options, user_opts)
|
||||
end
|
||||
|
||||
---Gets the idea directory path (expanded)
|
||||
---@return string
|
||||
function M.get_idea_dir()
|
||||
return vim.fn.expand(M.options.idea_dir or "")
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user