mirror of
https://github.com/harivansh-afk/forge.nvim.git
synced 2026-04-15 12:03:51 +00:00
refactor(picker): canonicalize backend names into single table
Problem: picker backend names were hard-coded as string literals in `picker/init.lua`, `health.lua`, and `init.lua` validation, making them easy to get out of sync. Solution: export `backends` and `detect_order` from `forge.picker` and reference them in health check and config validation instead of duplicating the name strings.
This commit is contained in:
parent
97698c2af1
commit
ac8db6851f
3 changed files with 13 additions and 17 deletions
|
|
@ -24,11 +24,9 @@ function M.check()
|
|||
|
||||
local picker_mod = require('forge.picker')
|
||||
local backend = picker_mod.backend()
|
||||
local picker_backends = { 'fzf-lua', 'telescope', 'snacks' }
|
||||
local found_any = false
|
||||
for _, name in ipairs(picker_backends) do
|
||||
local mod = name == 'fzf-lua' and 'fzf-lua' or name
|
||||
if pcall(require, mod) then
|
||||
for _, name in ipairs(picker_mod.detect_order) do
|
||||
if pcall(require, name) then
|
||||
local suffix = backend == name and ' (active)' or ''
|
||||
vim.health.ok(name .. ' found' .. suffix)
|
||||
found_any = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue