From 2865c8e23ef2469e07fd16cd0e697feaeeb84202 Mon Sep 17 00:00:00 2001 From: L3MON4D3 Date: Wed, 14 Feb 2024 16:21:31 +0100 Subject: [PATCH] fix(tests): only use packaged parser for nvim 0.7 and 0.9. There's some incompatibility with nvim-master now, but since master has a parsers built-in, we don't have to package another version and can just rely on that. --- tests/helpers.lua | 12 +++++++++--- tests/parsers/{lua.so => lua_07_09.so} | Bin 2 files changed, 9 insertions(+), 3 deletions(-) rename tests/parsers/{lua.so => lua_07_09.so} (100%) diff --git a/tests/helpers.lua b/tests/helpers.lua index e1f169692..b22497c73 100644 --- a/tests/helpers.lua +++ b/tests/helpers.lua @@ -106,12 +106,18 @@ function M.session_setup_luasnip(opts) end or vim.treesitter.require_language - -- this is a nop on new versions of neovim, where the lua-parser is shipped by default. - ts_lang_add("lua", os.getenv("LUASNIP_SOURCE") .. "/tests/parsers/lua.so") - ts_lang_add("json", os.getenv("LUASNIP_SOURCE") .. "/tests/parsers/json.so") ts_lang_add("jsonc", os.getenv("LUASNIP_SOURCE") .. "/tests/parsers/jsonc.so") ]]) + + local version = exec_lua([[ return vim.version() ]]) + local nvim_07_or_09 = (version.minor == 7 or version.minor == 9) and version.major == 0 + if nvim_07_or_09 then + -- 0.7 and 0.9 need a different parser than master :/ + -- (actually, master has a lua-parser built-in, so we don't need to + -- load one at all in that case :) ) + exec_lua([[ts_lang_add("lua", os.getenv("LUASNIP_SOURCE") .. "/tests/parsers/lua_07_09.so")]]) + end end helpers.exec_lua( diff --git a/tests/parsers/lua.so b/tests/parsers/lua_07_09.so similarity index 100% rename from tests/parsers/lua.so rename to tests/parsers/lua_07_09.so