fix(overseer): Crash when .vscode folder isn't present

This commit is contained in:
Jiří Štefka 2024-10-01 13:40:05 +02:00
parent 9e58b1629d
commit 6ea0b944ab

View file

@ -3,6 +3,8 @@ if vim.g.did_load_overseer_plugin then
end
vim.g.did_load_overseer_plugin = true
local file_exists = require("user.file_exists").file_exists
require("which-key").add({
{ "<leader>o", group = "[o]verseer", icon = "" },
{ "<leader>ot", "<Cmd>OverseerToggle<CR>", desc = "[o]verseer: [t]oggle " },
@ -18,11 +20,15 @@ local root_files = {
'.git',
}
if require('user.file_exists').file_exists(vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]) .. "/.vscode/tasks.json") then
require('overseer').setup({
strategy = {
"toggleterm",
quit_on_exit = "success",
},
})
local root = vim.fs.find(root_files, { upward = true })[1]
if root then
if file_exists(root .. ".vscode/tasks.json") then
require('overseer').setup({
strategy = {
"toggleterm",
quit_on_exit = "success",
},
})
end
end