refactor(treesitter)!: rename help parser to vimdoc

This commit is contained in:
Christian Clason 2023-03-31 17:09:00 +02:00
parent 2a298f2e48
commit d7f7450017
7 changed files with 15 additions and 9 deletions

View File

@ -194,8 +194,8 @@ set(TREESITTER_LUA_SHA256 930d0370dc15b66389869355c8e14305b9ba7aafd36edbfdb468c8
set(TREESITTER_VIM_URL https://github.com/vigoux/tree-sitter-viml/archive/e39a7bbcfdcfc7900629962b785c7e14503ae590.tar.gz)
set(TREESITTER_VIM_SHA256 7ca85fa1a5a9e4d057ff3b7ae53d13d31371973e734ada87a83f3f6cbe9c0e32)
set(TREESITTER_HELP_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v1.3.0.tar.gz)
set(TREESITTER_HELP_SHA256 f33f6d49c7d71feb2fd68ef2b2684da150f9f8e486ad9726213631d673942331)
set(TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/b2ec4ec5f7be24cb6f7ccffafd7204477fe5784a.tar.gz)
set(TREESITTER_VIMDOC_SHA256 0689a57d455243de6c6a6c8737a8ce137e225eb8f32676a7037f7dd13dfaec5d)
set(TREESITTER_QUERY_URL https://github.com/nvim-treesitter/tree-sitter-query/archive/v0.1.0.tar.gz)
set(TREESITTER_QUERY_SHA256 e2b806f80e8bf1c4f4e5a96248393fe6622fc1fc6189d6896d269658f67f914c)

View File

@ -38,9 +38,9 @@ BuildTSParser(
CMAKE_FILE TreesitterParserCMakeLists.txt)
BuildTSParser(
LANG help
URL ${TREESITTER_HELP_URL}
SHA256 ${TREESITTER_HELP_SHA256}
LANG vimdoc
URL ${TREESITTER_VIMDOC_URL}
SHA256 ${TREESITTER_VIMDOC_SHA256}
CMAKE_FILE TreesitterParserCMakeLists.txt)
BuildTSParser(

View File

@ -62,6 +62,10 @@ The following changes may require adaptations in user config or plugins.
• |nvim_exec()| is now deprecated in favor of |nvim_exec2()|.
• `help` treesitter parser was renamed to `vimdoc`. The only user-visible
change is that language-specific highlight groups need to be renamed from
`@foo.help` to `@foo.vimdoc`.
==============================================================================
NEW FEATURES *news-features*

View File

@ -4,7 +4,9 @@ local a = vim.api
local M = {}
---@type table<string,string>
local ft_to_lang = {}
local ft_to_lang = {
help = 'vimdoc',
}
--- Get the filetypes associated with the parser named {lang}.
--- @param lang string Name of parser

View File

@ -624,7 +624,7 @@ local function get_helptags(help_dir)
return m
end
-- Use the help.so parser defined in the build, not whatever happens to be installed on the system.
-- Use the vimdoc parser defined in the build, not whatever happens to be installed on the system.
local function ensure_runtimepath()
if not vim.o.runtimepath:find('build/lib/nvim/') then
vim.cmd[[set runtimepath^=./build/lib/nvim/]]
@ -643,8 +643,8 @@ local function parse_buf(fname)
buf = fname
vim.cmd('sbuffer '..tostring(fname)) -- Buffer number.
end
-- vim.treesitter.require_language('help', './build/lib/nvim/parser/help.so')
local lang_tree = vim.treesitter.get_parser(buf, 'help')
-- vim.treesitter.require_language('help', './build/lib/nvim/parser/vimdoc.so')
local lang_tree = vim.treesitter.get_parser(buf)
return lang_tree, buf
end