mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(scope): make sure to parse the ts tree. Fixes #521
This commit is contained in:
parent
9499b944e7
commit
4c55f1c2da
2 changed files with 7 additions and 2 deletions
|
|
@ -400,6 +400,7 @@ function TSScope:find(opts)
|
|||
if not has_parser or parser == nil then
|
||||
return
|
||||
end
|
||||
parser:parse()
|
||||
|
||||
local line = vim.fn.nextnonblank(opts.pos[1])
|
||||
line = line == 0 and vim.fn.prevnonblank(opts.pos[1]) or line
|
||||
|
|
@ -763,4 +764,7 @@ function M.setup()
|
|||
end
|
||||
end
|
||||
|
||||
M.TSScope = TSScope
|
||||
M.IdentScope = IndentScope
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ function M.set_lines(lines, opts)
|
|||
lines = type(lines) == "string" and vim.split(lines, "\n") or lines
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines --[[ @as string[] ]])
|
||||
vim.bo.filetype = opts.ft or ""
|
||||
vim.treesitter.stop()
|
||||
assert(not vim.b.ts_highlight, "treesitter highlight is still enabled")
|
||||
vim.b.snacks_ts = nil
|
||||
if opts.ts then
|
||||
vim.treesitter.stop()
|
||||
assert(not vim.b.ts_highlight, "treesitter highlight is still enabled")
|
||||
vim.treesitter.start()
|
||||
assert(vim.b.ts_highlight, "treesitter highlight is not enabled")
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue