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:
@@ -437,11 +437,17 @@ function M.open(opts)
|
||||
vim.api.nvim_win_set_option(state.win, "cursorline", false)
|
||||
|
||||
-- Build graph data
|
||||
vim.notify("Building graph...", vim.log.levels.INFO)
|
||||
local config = require("ideaDrop.core.config")
|
||||
local idea_dir = vim.fn.expand(config.options.idea_dir or "")
|
||||
vim.notify(string.format("Building graph from: %s", idea_dir), vim.log.levels.INFO)
|
||||
|
||||
state.graph = data.build_graph()
|
||||
|
||||
if #state.graph.node_list == 0 then
|
||||
vim.notify("No notes found to visualize", vim.log.levels.WARN)
|
||||
vim.notify(
|
||||
string.format("No notes found to visualize in: %s", idea_dir),
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
M.close()
|
||||
return
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user