fix(overseer): Crash when .vscode
folder isn't present
This commit is contained in:
parent
9e58b1629d
commit
6ea0b944ab
1 changed files with 13 additions and 7 deletions
|
@ -3,6 +3,8 @@ if vim.g.did_load_overseer_plugin then
|
||||||
end
|
end
|
||||||
vim.g.did_load_overseer_plugin = true
|
vim.g.did_load_overseer_plugin = true
|
||||||
|
|
||||||
|
local file_exists = require("user.file_exists").file_exists
|
||||||
|
|
||||||
require("which-key").add({
|
require("which-key").add({
|
||||||
{ "<leader>o", group = "[o]verseer", icon = "" },
|
{ "<leader>o", group = "[o]verseer", icon = "" },
|
||||||
{ "<leader>ot", "<Cmd>OverseerToggle<CR>", desc = "[o]verseer: [t]oggle " },
|
{ "<leader>ot", "<Cmd>OverseerToggle<CR>", desc = "[o]verseer: [t]oggle " },
|
||||||
|
@ -18,7 +20,10 @@ local root_files = {
|
||||||
'.git',
|
'.git',
|
||||||
}
|
}
|
||||||
|
|
||||||
if require('user.file_exists').file_exists(vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]) .. "/.vscode/tasks.json") then
|
local root = vim.fs.find(root_files, { upward = true })[1]
|
||||||
|
|
||||||
|
if root then
|
||||||
|
if file_exists(root .. ".vscode/tasks.json") then
|
||||||
require('overseer').setup({
|
require('overseer').setup({
|
||||||
strategy = {
|
strategy = {
|
||||||
"toggleterm",
|
"toggleterm",
|
||||||
|
@ -26,3 +31,4 @@ if require('user.file_exists').file_exists(vim.fs.dirname(vim.fs.find(root_files
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue