Closed chipsenkbeil closed 3 months ago
The problem seems to be this line: https://github.com/nvim-orgmode/orgmode/blob/e365b85b4a5bfea507d77a16a7b66d8c6860e9b7/lua/orgmode/utils/treesitter/init.lua#L21:
function M.get_node_at_cursor(cursor)
M.parse_current_file()
if not cursor then
return vim.treesitter.get_node()
end
return vim.treesitter.get_node({
bufnr = 0,
pos = { cursor[1] - 1, cursor[2] },
})
end
where orgmode calls vim.treesitter.get_node()
twice without specifying the language. The behavior of get_node()
in that case is to deduce the language from the filetype. For that it checks the table filled via vim.treesitter.language.register()
.
The way I see it, there are two ways to fix this:
get_node({lang = 'org'})
vim.treesitter.language.register('org', {'org-roam-node-buffer'})
Personally, I think the first option makes more sense. I've submitted https://github.com/nvim-orgmode/orgmode/pull/795 so if and when that PR is accepted, this should work without updates to org-roam itself.
The fix just got merged, so the error should no longer appear after an update!
Can confirm that as of https://github.com/nvim-orgmode/orgmode/commit/56c8246c633bcde845cefc2090979ec23bd9034e, this has been fixed. Thanks @troiganto for getting this resolved upstream!
Encountered in neovim 0.10 when attempting to expand a backlink. Must be something I missed when adding support for neovim 0.10. I'm assuming they changed how creating a parser works. I'm assuming that I'm setting the filetype to this somewhere, and neovim is trying to do virtual identation, a feature new to neovim 0.10 that I have enabled. Not sure why it's happening for a non-org buffer, though.