fix: nightly(0.11) (#104)
* chore: fix minimal_init, load default plugins correctly * refactor(ts): make it work on nightly * chore: get nightly back in ci * fix(tests): some how i now i need to run vim.treesitter.start() to make it work * feat(ts): check if parser is found * chore: use --clean instead --noplugin * refactor(tests): use auto commands instead of putting it in each test * chore: show the diff of the doc
This commit is contained in:
parent
c0b2834652
commit
77754fe362
7 changed files with 39 additions and 26 deletions
|
|
@ -50,16 +50,13 @@ end
|
|||
---@return {name:string, is_varstruct:boolean}
|
||||
local function get_captures(query, node, bufnr)
|
||||
local res = {}
|
||||
for _, match, _ in query:iter_matches(node, bufnr) do
|
||||
for capture_id, captured_node in pairs(match) do
|
||||
local capture_name = query.captures[capture_id]
|
||||
if capture_name == "_name" then
|
||||
res["name"] = vim.treesitter.get_node_text(captured_node, bufnr)
|
||||
end
|
||||
for id, _node in query:iter_captures(node, bufnr) do
|
||||
if query.captures[id] == "_name" then
|
||||
res["name"] = vim.treesitter.get_node_text(_node, bufnr)
|
||||
end
|
||||
|
||||
if capture_name == "_var" then
|
||||
res["is_varstruct"] = true
|
||||
end
|
||||
if query.captures[id] == "_var" then
|
||||
res["is_varstruct"] = true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -77,6 +74,10 @@ end
|
|||
---@param query string
|
||||
---@return gopher.TsResult
|
||||
local function do_stuff(bufnr, parent_type, query)
|
||||
if not vim.treesitter.get_parser(bufnr, "go") then
|
||||
error "No treesitter parser found for go"
|
||||
end
|
||||
|
||||
local node = vim.treesitter.get_node {
|
||||
bufnr = bufnr,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue