From 052590ae55b118ceb52d25996aeeb871e3996ec2 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Thu, 1 Apr 2021 12:01:10 +0200 Subject: healthcheck: raise error when ABI is too old --- lua/nvim-treesitter/health.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 33021e36d..a97bb359d 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -11,6 +11,8 @@ local health_warn = vim.fn['health#report_warn'] local M = {} +local NVIM_TREESITTER_MINIMUM_ABI = 13 + local function install_health() health_start('Installation') @@ -53,7 +55,15 @@ local function install_health() health_ok('`cc` executable found.') end if vim.treesitter.language_version then - print('\nNeovim was compiled with tree-sitter runtime ABI version '..vim.treesitter.language_version..'.') + if vim.treesitter.language_version >= NVIM_TREESITTER_MINIMUM_ABI then + health_ok('Neovim was compiled with tree-sitter runtime ABI version '..vim.treesitter.language_version + ..' (required >='..NVIM_TREESITTER_MINIMUM_ABI..'). Parsers must be compatible with runtime ABI.') + else + health_error('Neovim was compiled with tree-sitter runtime ABI version '..vim.treesitter.language_version..'.\n' + ..'nvim-treesitter expects at least ABI version '..NVIM_TREESITTER_MINIMUM_ABI..'\n' + ..'Please make sure that Neovim is linked against are recent tree-sitter runtime when building' + ..' or raise an issue at your Neovim packager. Parsers must be compatible with runtime ABI.') + end end end -- cgit v1.2.3-70-g09d2