Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lua/tabout/node.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ M.get_node_at_cursor = function(dir)
local filetype = vim.bo[0].filetype
local ok, parser = pcall(vim.treesitter.get_parser, 0)
if ok and parser then
parser:parse()
parser:parse(true)
else
if skip_notify[filetype] == nil then
vim.notify("tabout.nvim: No parser found for filetype " .. filetype)
skip_notify[filetype] = true
end
return
end
local tree = parser:tree_for_range(cursor_range)
-- Descend into injected languages (e.g. <script> in vue/html, markdown code
-- fences) so the node is the embedded language's node rather than the opaque
-- host `raw_text` node. Requires parse(true) above.
local lang_tree = parser:language_for_range(cursor_range)
local tree = lang_tree and lang_tree:tree_for_range(cursor_range)
local root = tree and tree:root()

if not root then
Expand Down