From bd9cdf53b0210f85b397fb30796b9805d815b5a4 Mon Sep 17 00:00:00 2001 From: "Matthieu C." <886074+teto@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:33:23 +0200 Subject: [PATCH 1/5] feat: warn about wrong 'dir' values Warn about non-existing directories to help the user debug its config --- lua/rocks-dev/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/rocks-dev/init.lua b/lua/rocks-dev/init.lua index 6a252eb..b83a494 100644 --- a/lua/rocks-dev/init.lua +++ b/lua/rocks-dev/init.lua @@ -1,4 +1,5 @@ local rocks = require("rocks.api") +local log = require("rocks.log") local rocks_dev = {} @@ -37,6 +38,9 @@ function rocks_dev.setup(user_configuration) end if path then vim.opt.runtimepath:append(path) + if vim.fn.isdirectory(path) == 0 then + log.warn(rock_spec.name.. " dir value '"..path.."' is not a directory") + end config_hook(rock_spec.name) -- NOTE: We can't support `opt` for dev plugins, From c530bc024d7b7a3a7ec0b65dd5817dbe025d177b Mon Sep 17 00:00:00 2001 From: "Matthieu C." <886074+teto@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:34:05 +0200 Subject: [PATCH 2/5] chore: trace rocks-dev setup --- lua/rocks-dev/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/rocks-dev/init.lua b/lua/rocks-dev/init.lua index b83a494..f5a8169 100644 --- a/lua/rocks-dev/init.lua +++ b/lua/rocks-dev/init.lua @@ -22,6 +22,8 @@ function rocks_dev.setup(user_configuration) return end + log.trace("rocks-dev setup") + local has_rocks_config, rocks_config = pcall(require, "rocks-config") local config_hook = has_rocks_config and type(rocks_config.configure) == "function" and rocks_config.configure or function(_) end From 96e6e12a97dd8f8cda4af87071a053e16853b626 Mon Sep 17 00:00:00 2001 From: "Matthieu C." <886074+teto@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:35:47 +0200 Subject: [PATCH 3/5] feat: add a notification upon inexisting directory --- lua/rocks-dev/init.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/rocks-dev/init.lua b/lua/rocks-dev/init.lua index f5a8169..c8f09a9 100644 --- a/lua/rocks-dev/init.lua +++ b/lua/rocks-dev/init.lua @@ -29,6 +29,7 @@ function rocks_dev.setup(user_configuration) or function(_) end local dev_path = user_configuration.dev and user_configuration.dev.path + local errors_found = false for _, rock_spec in pairs(user_configuration.plugins or {}) do ---@cast rock_spec rocks-dev.RockSpec @@ -41,7 +42,8 @@ function rocks_dev.setup(user_configuration) if path then vim.opt.runtimepath:append(path) if vim.fn.isdirectory(path) == 0 then - log.warn(rock_spec.name.. " dir value '"..path.."' is not a directory") + log.warn(rock_spec.name .. " dir value '" .. path .. "' is not a directory") + errors_found = true end config_hook(rock_spec.name) @@ -50,6 +52,10 @@ function rocks_dev.setup(user_configuration) require("rtp_nvim").source_rtp_dir(path) end end + + if errors_found then + vim.notify("Issues while loading rocks-dev configs. Run :Rocks log for more info.", vim.log.levels.WARN) + end end rocks.register_rock_handler(require("rocks-dev.local-rock-handler")) From d48acebd36950603692f2a1c9f14044214a6f8ef Mon Sep 17 00:00:00 2001 From: "Matthieu C." <886074+teto@users.noreply.github.com> Date: Mon, 19 Aug 2024 11:05:53 +0200 Subject: [PATCH 4/5] fix(Makefile): fix paths --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d6e202b..6956848 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ format: - stylua -v --verify lua/rocks-config/ plugin/ + stylua -v --verify lua/rocks-dev/ plugin/ check: - luacheck lua/rocks-config plugin/ + luacheck lua/rocks-dev plugin/ From f174c7509f1aa2bcafaf5fdf0dfb8c724e5e5fa1 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Mon, 19 Aug 2024 17:41:09 +0200 Subject: [PATCH 5/5] chore: quotes --- lua/rocks-dev/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/rocks-dev/init.lua b/lua/rocks-dev/init.lua index c8f09a9..f2a116e 100644 --- a/lua/rocks-dev/init.lua +++ b/lua/rocks-dev/init.lua @@ -54,7 +54,7 @@ function rocks_dev.setup(user_configuration) end if errors_found then - vim.notify("Issues while loading rocks-dev configs. Run :Rocks log for more info.", vim.log.levels.WARN) + vim.notify("Issues while loading rocks-dev configs. Run ':Rocks log' for more info.", vim.log.levels.WARN) end end