Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e3500ad

Browse files
fix(nightly): Fix compatibility with Neovim nightly
1 parent c6bdb07 commit e3500ad

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lua/orgmode/config/init.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ function Config:setup_ts_predicates()
377377
end
378378

379379
return false
380-
end, { force = true })
380+
end, { force = true, all = false })
381381

382382
vim.treesitter.query.add_predicate('org-is-valid-priority?', function(match, _, source, predicate)
383383
local node = match[predicate[2]]
@@ -412,7 +412,7 @@ function Config:setup_ts_predicates()
412412
local todo_text = vim.treesitter.get_node_text(prev_sibling, source)
413413
local is_prev_sibling_todo_keyword = todo_keywords[todo_text] and true or false
414414
return is_prev_sibling_todo_keyword
415-
end, { force = true })
415+
end, { force = true, all = false })
416416

417417
vim.treesitter.query.add_directive('org-set-block-language!', function(match, _, bufnr, pred, metadata)
418418
local lang_node = match[pred[2]]
@@ -424,7 +424,7 @@ function Config:setup_ts_predicates()
424424
return
425425
end
426426
metadata['injection.language'] = utils.detect_filetype(text, true)
427-
end, { force = true })
427+
end, { force = true, all = false })
428428

429429
vim.treesitter.query.add_predicate('org-is-headline-level?', function(match, _, _, predicate)
430430
---@type TSNode
@@ -435,7 +435,7 @@ function Config:setup_ts_predicates()
435435
end
436436
local _, _, _, node_end_col = node:range()
437437
return ((node_end_col - 1) % 8) + 1 == level
438-
end, { force = true })
438+
end, { force = true, all = false })
439439
end
440440

441441
---@param content table

lua/orgmode/files/file.lua

+6-2
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,14 @@ function OrgFile:get_ts_matches(query, node)
172172
local matches = {}
173173

174174
local from, _, to = node:range()
175-
for _, match, _ in ts_query:iter_matches(node, self:_get_source(), from, to + 1) do
175+
for _, match, _ in ts_query:iter_matches(node, self:_get_source(), from, to + 1, { all = false }) do
176176
local items = {}
177-
for id, matched_node in pairs(match) do
177+
for id, matched_nodes in pairs(match) do
178178
local name = ts_query.captures[id]
179+
local matched_node = matched_nodes
180+
if type(matched_nodes) == 'table' then
181+
matched_node = matched_nodes[#matched_nodes]
182+
end
179183
local node_text = self:get_node_text_list(matched_node)
180184
items[name] = {
181185
node = matched_node,

0 commit comments

Comments
 (0)