Skip to content

Commit 0d822eb

Browse files
committed
feat(core): require Neovim 0.12
Raise the minimum supported Neovim version to 0.12 and update the health check and docs to match the new baseline. Also align Tree-sitter parser checks with the Neovim 0.12 get_parser() contract and keep invalid buffers guarded before parser lookup.
1 parent 51a43bb commit 0d822eb

5 files changed

Lines changed: 46 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ peekstack.nvim focuses on preserving the _trail_ of your exploration.
4040

4141
## 📦 Requirements
4242

43-
- Neovim ≥ 0.10
43+
- Neovim ≥ 0.12
4444
- `rg` (only if you use `grep.search`)
4545
- Optional: `telescope.nvim` / `fzf-lua` / `snacks.nvim` (if you switch picker backends)
4646
- Optional: Tree-sitter parsers (for `ui.title.context` and stack view preview syntax highlighting; Neovim bundles the runtime, but parsers are separate)

doc/peekstack.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ peekstack.nvim provides a peek stack UI for LSP, diagnostics, files, marks,
99
and grep results. Pop open floating windows that stack visually, navigate
1010
between them, promote to splits, and optionally persist sessions.
1111

12-
Requires Neovim >= 0.10.
12+
Requires Neovim >= 0.12.
1313

1414
==============================================================================
1515
SETUP *peekstack-setup*
@@ -580,7 +580,7 @@ Other highlights:
580580
HEALTH *peekstack-health*
581581

582582
Run `:checkhealth peekstack` to verify requirements:
583-
- Neovim >= 0.10
583+
- Neovim >= 0.12
584584
- `rg` executable (optional, for grep.search)
585585
- Configured picker backend availability (telescope / fzf-lua / snacks)
586586
- Persist setup and git repository detection

lua/peekstack/health.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ local PICKER_MODULES = {
1010
function M.check()
1111
vim.health.start("peekstack")
1212

13-
if vim.fn.has("nvim-0.10") == 1 then
14-
vim.health.ok("nvim >= 0.10")
13+
if vim.fn.has("nvim-0.12") == 1 then
14+
vim.health.ok("nvim >= 0.12")
1515
else
16-
vim.health.error("nvim >= 0.10 is required (vim.lsp.get_clients, vim.islist, vim.system)")
16+
vim.health.error("nvim >= 0.12 is required")
1717
end
1818

1919
if vim.fn.executable("rg") == 1 then
@@ -62,8 +62,8 @@ function M.check()
6262
-- Tree-sitter context
6363
local title = cfg.ui and cfg.ui.title
6464
if title and title.context and title.context.enabled then
65-
local ts_ok = pcall(vim.treesitter.get_parser, 0)
66-
if ts_ok then
65+
local parser = vim.treesitter.get_parser(0)
66+
if parser then
6767
vim.health.ok("tree-sitter context enabled (parser available for current buffer)")
6868
else
6969
vim.health.info("tree-sitter context enabled but no parser for the current buffer filetype")

lua/peekstack/util/treesitter.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ function M.context_at(bufnr, line, col, opts)
2929
return nil
3030
end
3131

32-
-- Check if parser is available
33-
local ok, parser = pcall(vim.treesitter.get_parser, bufnr)
34-
if not ok or not parser then
32+
if bufnr ~= 0 and not vim.api.nvim_buf_is_valid(bufnr) then
33+
return nil
34+
end
35+
36+
-- Nvim 0.12+ returns nil when a parser cannot be created.
37+
local parser = vim.treesitter.get_parser(bufnr)
38+
if not parser then
3539
return nil
3640
end
3741

tests/health_spec.lua

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe("peekstack.health", function()
99
local original_health_info
1010
local original_executable
1111
local original_has
12+
local original_get_parser
1213

1314
---@type string[]
1415
local messages
@@ -22,6 +23,7 @@ describe("peekstack.health", function()
2223
original_health_info = vim.health.info
2324
original_executable = vim.fn.executable
2425
original_has = vim.fn.has
26+
original_get_parser = vim.treesitter.get_parser
2527

2628
vim.health.start = function() end
2729
vim.health.ok = function(msg)
@@ -46,6 +48,7 @@ describe("peekstack.health", function()
4648
vim.health.info = original_health_info
4749
vim.fn.executable = original_executable
4850
vim.fn.has = original_has
51+
vim.treesitter.get_parser = original_get_parser
4952
config.setup({})
5053
end)
5154

@@ -60,7 +63,7 @@ describe("peekstack.health", function()
6063

6164
health.check()
6265

63-
assert.is_true(vim.list_contains(messages, "ok:nvim >= 0.10"))
66+
assert.is_true(vim.list_contains(messages, "ok:nvim >= 0.12"))
6467
assert.is_true(vim.list_contains(messages, "ok:rg available"))
6568
end)
6669

@@ -123,4 +126,31 @@ describe("peekstack.health", function()
123126
end
124127
assert.is_true(found_persist)
125128
end)
129+
130+
it("reports tree-sitter info when context is enabled without a parser", function()
131+
vim.fn.has = function()
132+
return 1
133+
end
134+
vim.fn.executable = function()
135+
return 1
136+
end
137+
vim.treesitter.get_parser = function()
138+
return nil
139+
end
140+
config.setup({
141+
ui = {
142+
title = {
143+
context = {
144+
enabled = true,
145+
},
146+
},
147+
},
148+
})
149+
150+
health.check()
151+
152+
assert.is_true(
153+
vim.list_contains(messages, "info:tree-sitter context enabled but no parser for the current buffer filetype")
154+
)
155+
end)
126156
end)

0 commit comments

Comments
 (0)