Skip to content

Commit

Permalink
fix: help parser has been renamed to vimdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Apr 1, 2023
1 parent 4b725dc commit bc2bc8b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 6 deletions.
1 change: 1 addition & 0 deletions lua/aerial/backends/treesitter/extensions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ M.help = {
end
end,
}
M.vimdoc = M.help

M.rust = {
postprocess = function(bufnr, item, match)
Expand Down
2 changes: 2 additions & 0 deletions queries/help/aerial.scm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; This is for backwards-compatibility with old versions of nvim-treesitter
; The new versions have renamed this parser to "vimdoc"
(h1
(word)+ @name @start
(tag)
Expand Down
16 changes: 16 additions & 0 deletions queries/vimdoc/aerial.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(h1
(word)+ @name @start
(tag)
(#set! "kind" "Interface")
) @type

(h2
(word)+ @name @start
(tag)
(#set! "kind" "Interface")
) @type

(tag
text: (word) @name
(#set! "kind" "Interface")
) @type
5 changes: 4 additions & 1 deletion tests/minimal_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ vim.filetype.add({

local langs = {}
for lang, _ in vim.fs.dir("queries") do
table.insert(langs, lang)
-- "help" has been renamed to "vimdoc"
if lang ~= "help" then
table.insert(langs, lang)
end
end
require("nvim-treesitter.configs").setup({
ensure_installed = langs,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
local util = require("tests.test_util")

describe("treesitter help", function()
describe("treesitter vimdoc", function()
it("parses all symbols correctly", function()
util.test_file_symbols("treesitter", "./tests/treesitter/help_test.txt", {
util.test_file_symbols("treesitter", "./tests/treesitter/vimdoc_test.txt", {
{
kind = "Interface",
name = "help_test.txt",
name = "vimdoc_test.txt",
level = 0,
lnum = 1,
col = 0,
end_lnum = 1,
end_col = 15,
end_col = 17,
},
{
kind = "Interface",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*help_test.txt* *help_test*
*vimdoc_test.txt* *vimdoc_test*
--------------------------------------------------------------------------------
TEST INTRO *test-intro*

Expand Down

0 comments on commit bc2bc8b

Please sign in to comment.