Skip to content

Commit

Permalink
Handle insufficient neovim-versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
L3MON4D3 committed Sep 16, 2023
1 parent 6f01585 commit 51d9e11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lua/luasnip/extras/treesitter_postfix.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
if vim.version().major == 0 and vim.version().minor < 9 then
-- need LanguageTree:tree_for_range and don't want to go through the hassle
-- of differentiating multiple version of query.get/parse.
error("treesitter_postfix does not support neovim < 0.9")
end

local snip = require("luasnip.nodes.snippet").S
local ts = require("luasnip.extras._treesitter")
local node_util = require("luasnip.nodes.util")
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/treesitter_postfix_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ describe("treesitter-postfix", function()

for _, reparse_mode in ipairs({[["live"]], [["copy"]], [[nil]]}) do
it(("Default-case works [%s]"):format(reparse_mode), function()
-- don't run these tests for earlier nvim-versions.
if exec_lua([[return vim.version().major == 0 and vim.version().minor < 9]]) then
print("Skipping Test due to insufficient version.")
return
end

ls_helpers.session_setup_luasnip({
setup_parsers = true,
})
Expand Down

0 comments on commit 51d9e11

Please sign in to comment.