From 240cec9192802db4f166c092428087180e4d3214 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 30 Mar 2021 16:40:29 -0400 Subject: ts: Add language version to vim.treesitter (#14255) --- runtime/doc/treesitter.txt | 6 ++++++ runtime/lua/vim/treesitter.lua | 2 ++ 2 files changed, 8 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 1696d3b9ba..343f4a62c2 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -32,6 +32,12 @@ retained for the lifetime of a buffer but this is subject to change. A plugin should keep a reference to the parser object as long as it wants incremental updates. + *vim.treesitter.language_version* +To check which language version is compiled with neovim, the number is stored +within `vim.treesitter.language_version`. This number is not too helpful +unless you are wondering about compatibility between different versions of +compiled grammars. + Parser files *treesitter-parsers* Parsers are the heart of tree-sitter. They are libraries that tree-sitter will diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua index 64a5ba1fd8..cac0ab864b 100644 --- a/runtime/lua/vim/treesitter.lua +++ b/runtime/lua/vim/treesitter.lua @@ -10,6 +10,8 @@ local parsers = {} local M = vim.tbl_extend("error", query, language) +M.language_version = vim._ts_get_language_version() + setmetatable(M, { __index = function (t, k) if k == "highlighter" then -- cgit