-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhealth.lua
More file actions
74 lines (65 loc) · 2.05 KB
/
Copy pathhealth.lua
File metadata and controls
74 lines (65 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
local M = {}
---@type table<string, string>
local PICKER_MODULES = {
telescope = "telescope",
["fzf-lua"] = "fzf-lua",
snacks = "snacks",
}
function M.check()
vim.health.start("peekstack")
if vim.fn.has("nvim-0.12") == 1 then
vim.health.ok("nvim >= 0.12")
else
vim.health.error("nvim >= 0.12 is required")
end
if vim.fn.executable("rg") == 1 then
vim.health.ok("rg available")
else
vim.health.warn("rg not found (grep.search will be unavailable)")
end
local ok, cfg_mod = pcall(require, "peekstack.config")
if not ok then
return
end
local cfg = cfg_mod.get()
-- Picker backend
local backend = cfg.picker and cfg.picker.backend
if backend and backend ~= "builtin" then
local plugin_name = PICKER_MODULES[backend]
if plugin_name then
local has = pcall(require, plugin_name)
if has then
vim.health.ok("picker backend '" .. backend .. "' available")
else
vim.health.warn("picker backend '" .. backend .. "' is configured but the plugin is not installed")
end
else
vim.health.warn("unknown picker backend '" .. backend .. "'")
end
end
-- Persist
local persist = cfg.persist
if persist and persist.enabled then
local fs = require("peekstack.util.fs")
local repo = fs.repo_root()
if repo then
vim.health.ok("persist enabled (repo: " .. repo .. ")")
else
vim.health.warn("persist enabled but not inside a git repository; sessions will use cwd-based storage")
end
if persist.auto and persist.auto.enabled then
vim.health.ok("auto persist enabled (session: " .. (persist.auto.session_name or "auto") .. ")")
end
end
-- Tree-sitter context
local title = cfg.ui and cfg.ui.title
if title and title.context and title.context.enabled then
local parser = vim.treesitter.get_parser(0)
if parser then
vim.health.ok("tree-sitter context enabled (parser available for current buffer)")
else
vim.health.info("tree-sitter context enabled but no parser for the current buffer filetype")
end
end
end
return M