mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-07 05:50:04 -04:00
feat: specify abi version for generate on newer ts cli
Check tree-sitter CLI version and if > 0.20.3 and generating a parser from grammar, use `--abi=vim.treesitter.language_version`. Besides being able to opt-in to newer ABI benefits, this is a necessary workaround for an upstream bug with 0.20.3, where `parser.h` is not generated if the (optional) `--abi` flag is omitted.
This commit is contained in:
parent
020905ff26
commit
bb319daf5f
3 changed files with 22 additions and 6 deletions
|
|
@ -5,6 +5,7 @@ local queries = require "nvim-treesitter.query"
|
|||
local info = require "nvim-treesitter.info"
|
||||
local shell = require "nvim-treesitter.shell_command_selectors"
|
||||
local install = require "nvim-treesitter.install"
|
||||
local utils = require "nvim-treesitter.utils"
|
||||
|
||||
local health_start = vim.fn["health#report_start"]
|
||||
local health_ok = vim.fn["health#report_ok"]
|
||||
|
|
@ -24,13 +25,9 @@ local function install_health()
|
|||
.. " not required for :TSInstall)"
|
||||
)
|
||||
else
|
||||
local handle = io.popen "tree-sitter -V"
|
||||
local result = handle:read "*a"
|
||||
handle:close()
|
||||
local version = vim.split(result, "\n")[1]:match "[^tree%psitter].*"
|
||||
health_ok(
|
||||
"`tree-sitter` found "
|
||||
.. (version or "(unknown version)")
|
||||
.. (utils.ts_cli_version() or "(unknown version)")
|
||||
.. " (parser generator, only needed for :TSInstallFromGrammar)"
|
||||
)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue