Skip to content

Commit 1f03985

Browse files
committed
chore!: Remove support for NeoVim 0.8
NeoVim 0.10 is out now, so removing support for 0.8 since we are supporting only one stable version back.
1 parent 94d7d98 commit 1f03985

File tree

5 files changed

+114
-166
lines changed

5 files changed

+114
-166
lines changed

.github/workflows/tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232
matrix:
33-
neovim_branch: ["v0.8.3", "v0.9.5", "nightly"]
33+
neovim_branch: ["v0.9.5", "v0.10.0", "nightly"]
3434

3535
steps:
3636
- uses: actions/checkout@v4

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ updated and refreshed for the NeoVim generation. It has these features:
5757

5858
## Installation
5959

60-
**Requires NeoVim 0.8+.**
60+
**Requires NeoVim 0.9+.**
6161

6262
Example for [`lazy.nvim`](https://github.com/folke/lazy.nvim):
6363

@@ -66,8 +66,7 @@ return {
6666
"andrewferrier/debugprint.nvim",
6767
opts = { … },
6868
dependencies = {
69-
"echasnovski/mini.nvim", -- Needed to enable :ToggleCommentDebugPrints for NeoVim <= 0.9
70-
"nvim-treesitter/nvim-treesitter" -- Needed to enable treesitter for NeoVim 0.8
69+
"echasnovski/mini.nvim" -- Needed to enable :ToggleCommentDebugPrints for NeoVim <= 0.9
7170
},
7271
-- Remove the following line to use development versions,
7372
-- not just the formal releases
@@ -87,8 +86,7 @@ packer.startup(function(use)
8786
require("debugprint").setup(opts)
8887
end,
8988
requires = {
90-
"echasnovski/mini.nvim", -- Needed to enable :ToggleCommentDebugPrints for NeoVim <= 0.9
91-
"nvim-treesitter/nvim-treesitter" -- Needed to enable treesitter for NeoVim 0.8
89+
"echasnovski/mini.nvim" -- Needed to enable :ToggleCommentDebugPrints for NeoVim <= 0.9
9290
}
9391
})
9492

lua/debugprint/init.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,9 @@ M.add_custom_filetypes = function(filetypes)
324324
vim.tbl_deep_extend("force", global_opts.filetypes, filetypes)
325325
end
326326

327-
if vim.fn.has("nvim-0.8.0") ~= 1 then
327+
if vim.fn.has("nvim-0.9.0") ~= 1 then
328328
vim.notify_once(
329-
"WARNING: debugprint.nvim is only compatible with NeoVim 0.8+",
329+
"WARNING: debugprint.nvim is only compatible with NeoVim 0.9+",
330330
vim.log.levels.WARN
331331
)
332332

lua/debugprint/utils.lua

+13-42
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,21 @@
11
local M = {}
22

33
local get_node_at_cursor = function()
4-
if vim.fn.has("nvim-0.9.0") == 1 then
5-
local success, is_node = pcall(vim.treesitter.get_node, {
6-
ignore_injections = false,
7-
})
8-
9-
-- This will fail if this language is not supported by Treesitter, e.g.
10-
-- Powershell/ps1
11-
if success and is_node then
12-
return is_node
13-
else
14-
return nil
15-
end
4+
local success, is_node = pcall(vim.treesitter.get_node, {
5+
ignore_injections = false,
6+
})
7+
8+
-- This will fail if this language is not supported by Treesitter, e.g.
9+
-- Powershell/ps1
10+
if success and is_node then
11+
return is_node
1612
else
17-
local function requiref(module)
18-
require(module)
19-
end
20-
21-
local ts_utils_test = pcall(requiref, "nvim-treesitter.ts_utils")
22-
23-
if not ts_utils_test then
24-
return nil
25-
else
26-
local ts_utils = require("nvim-treesitter.ts_utils")
27-
return ts_utils.get_node_at_cursor()
28-
end
13+
return nil
2914
end
3015
end
3116

3217
local get_node_text = function(node)
33-
if vim.treesitter.get_node_text then
34-
-- vim.treesitter.query.get_node_text deprecated as of NeoVim
35-
-- 0.9
36-
return vim.treesitter.get_node_text(node, 0)
37-
else
38-
return vim.treesitter.query.get_node_text(node, 0)
39-
end
18+
return vim.treesitter.get_node_text(node, 0)
4019
end
4120

4221
M.is_modifiable = function()
@@ -155,17 +134,9 @@ M.get_effective_filetypes = function()
155134
})
156135
:lang()
157136

158-
if vim.fn.has("nvim-0.9.0") == 1 then
159-
local filetypes =
160-
vim.treesitter.language.get_filetypes(treesitter_lang)
161-
assert(vim.tbl_count(filetypes) > 0)
162-
return filetypes
163-
else
164-
-- nvim < 0.9 doesn't have get_filetypes; so just return the lang as
165-
-- if it were a filetype. This will work for many languages (e.g.
166-
-- lua), although not for others (e.g. tsx).
167-
return { treesitter_lang }
168-
end
137+
local filetypes = vim.treesitter.language.get_filetypes(treesitter_lang)
138+
assert(vim.tbl_count(filetypes) > 0)
139+
return filetypes
169140
else
170141
return {
171142
vim.api.nvim_get_option_value("filetype", { scope = "local" }),

tests/debugprint.lua

+95-116
Original file line numberDiff line numberDiff line change
@@ -490,19 +490,11 @@ describe("can do various file types", function()
490490

491491
feedkeys("g?p")
492492

493-
if vim.fn.has("nvim-0.9.0") == 1 then
494-
check_lines({
495-
"foo",
496-
"No debugprint configuration for filetype foo; see https://github.com/andrewferrier/debugprint.nvim?tab=readme-ov-file#add-custom-filetypes",
497-
"bar",
498-
})
499-
else
500-
check_lines({
501-
"foo",
502-
"/*No debugprint configuration for filetype foo; see https://github.com/andrewferrier/debugprint.nvim?tab=readme-ov-file#add-custom-filetypes*/",
503-
"bar",
504-
})
505-
end
493+
check_lines({
494+
"foo",
495+
"No debugprint configuration for filetype foo; see https://github.com/andrewferrier/debugprint.nvim?tab=readme-ov-file#add-custom-filetypes",
496+
"bar",
497+
})
506498
end)
507499

508500
it(
@@ -534,19 +526,11 @@ describe("can do various file types", function()
534526
feedkeys("g?v")
535527
feedkeys("<CR>")
536528

537-
if vim.fn.has("nvim-0.9.0") == 1 then
538-
check_lines({
539-
"foo",
540-
"No debugprint configuration for filetype foo; see https://github.com/andrewferrier/debugprint.nvim?tab=readme-ov-file#add-custom-filetypes",
541-
"bar",
542-
})
543-
else
544-
check_lines({
545-
"foo",
546-
"/*No debugprint configuration for filetype foo; see https://github.com/andrewferrier/debugprint.nvim?tab=readme-ov-file#add-custom-filetypes*/",
547-
"bar",
548-
})
549-
end
529+
check_lines({
530+
"foo",
531+
"No debugprint configuration for filetype foo; see https://github.com/andrewferrier/debugprint.nvim?tab=readme-ov-file#add-custom-filetypes",
532+
"bar",
533+
})
550534
end)
551535
end)
552536

@@ -1718,110 +1702,105 @@ describe("check python indenting", function()
17181702
end)
17191703
end)
17201704

1721-
if vim.fn.has("nvim-0.9.0") == 1 then
1722-
-- This test will not work on NeoVim <= 0.8, I think because markdown only
1723-
-- supports a limited range of embedded langs
1724-
1725-
describe("embedded treesitter langs", function()
1726-
before_each(function()
1727-
debugprint.setup({ ignore_treesitter = false })
1728-
end)
1705+
describe("embedded treesitter langs", function()
1706+
before_each(function()
1707+
debugprint.setup({ ignore_treesitter = false })
1708+
end)
17291709

1730-
after_each(teardown)
1710+
after_each(teardown)
17311711

1732-
it("lua in markdown", function()
1733-
local filename = init_file({
1734-
"foo",
1735-
"```lua",
1736-
"x = 1",
1737-
"```",
1738-
"bar",
1739-
}, "markdown", 3, 0)
1712+
it("lua in markdown", function()
1713+
local filename = init_file({
1714+
"foo",
1715+
"```lua",
1716+
"x = 1",
1717+
"```",
1718+
"bar",
1719+
}, "markdown", 3, 0)
17401720

1741-
feedkeys("g?p")
1721+
feedkeys("g?p")
17421722

1743-
check_lines({
1744-
"foo",
1745-
"```lua",
1746-
"x = 1",
1747-
"print('DEBUGPRINT[1]: " .. filename .. ":3 (after x = 1)')",
1748-
"```",
1749-
"bar",
1750-
})
1751-
end)
1723+
check_lines({
1724+
"foo",
1725+
"```lua",
1726+
"x = 1",
1727+
"print('DEBUGPRINT[1]: " .. filename .. ":3 (after x = 1)')",
1728+
"```",
1729+
"bar",
1730+
})
1731+
end)
17521732

1753-
it("lua in markdown above", function()
1754-
local filename = init_file({
1755-
"foo",
1756-
"```lua",
1757-
"x = 1",
1758-
"```",
1759-
"bar",
1760-
}, "markdown", 3, 0)
1733+
it("lua in markdown above", function()
1734+
local filename = init_file({
1735+
"foo",
1736+
"```lua",
1737+
"x = 1",
1738+
"```",
1739+
"bar",
1740+
}, "markdown", 3, 0)
17611741

1762-
feedkeys("g?P")
1742+
feedkeys("g?P")
17631743

1764-
check_lines({
1765-
"foo",
1766-
"```lua",
1767-
"print('DEBUGPRINT[1]: " .. filename .. ":3 (before x = 1)')",
1768-
"x = 1",
1769-
"```",
1770-
"bar",
1771-
})
1772-
end)
1744+
check_lines({
1745+
"foo",
1746+
"```lua",
1747+
"print('DEBUGPRINT[1]: " .. filename .. ":3 (before x = 1)')",
1748+
"x = 1",
1749+
"```",
1750+
"bar",
1751+
})
1752+
end)
17731753

1774-
it("javascript in html", function()
1775-
local filename = init_file({
1776-
"<html>",
1777-
"<body>",
1778-
"<script>",
1779-
" let x = 3;",
1780-
"",
1781-
" console.log(x);",
1782-
"</script>",
1783-
"</body>",
1784-
"</html>",
1785-
}, "html", 6, 0)
1754+
it("javascript in html", function()
1755+
local filename = init_file({
1756+
"<html>",
1757+
"<body>",
1758+
"<script>",
1759+
" let x = 3;",
1760+
"",
1761+
" console.log(x);",
1762+
"</script>",
1763+
"</body>",
1764+
"</html>",
1765+
}, "html", 6, 0)
17861766

1787-
feedkeys("g?p")
1767+
feedkeys("g?p")
17881768

1789-
check_lines({
1790-
"<html>",
1791-
"<body>",
1792-
"<script>",
1793-
" let x = 3;",
1794-
"",
1795-
" console.log(x);",
1796-
' console.warn("DEBUGPRINT[1]: '
1797-
.. filename
1798-
.. ':6 (after console.log(x);)")',
1799-
"</script>",
1800-
"</body>",
1801-
"</html>",
1802-
})
1803-
end)
1769+
check_lines({
1770+
"<html>",
1771+
"<body>",
1772+
"<script>",
1773+
" let x = 3;",
1774+
"",
1775+
" console.log(x);",
1776+
' console.warn("DEBUGPRINT[1]: '
1777+
.. filename
1778+
.. ':6 (after console.log(x);)")',
1779+
"</script>",
1780+
"</body>",
1781+
"</html>",
1782+
})
1783+
end)
18041784

1805-
it("comment in lua", function()
1806-
local filename = init_file({
1807-
"x = 3",
1808-
"-- abc",
1809-
"a = 2",
1810-
}, "lua", 2, 4)
1785+
it("comment in lua", function()
1786+
local filename = init_file({
1787+
"x = 3",
1788+
"-- abc",
1789+
"a = 2",
1790+
}, "lua", 2, 4)
18111791

1812-
feedkeys("g?v<CR>")
1792+
feedkeys("g?v<CR>")
18131793

1814-
check_lines({
1815-
"x = 3",
1816-
"-- abc",
1817-
"print('DEBUGPRINT[1]: "
1818-
.. filename
1819-
.. ":2: abc=' .. vim.inspect(abc))",
1820-
"a = 2",
1821-
})
1822-
end)
1794+
check_lines({
1795+
"x = 3",
1796+
"-- abc",
1797+
"print('DEBUGPRINT[1]: "
1798+
.. filename
1799+
.. ":2: abc=' .. vim.inspect(abc))",
1800+
"a = 2",
1801+
})
18231802
end)
1824-
end
1803+
end)
18251804

18261805
describe("comment toggle", function()
18271806
after_each(teardown)

0 commit comments

Comments
 (0)