You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---@genericTResult---@returnTResult[]---@paramiteratorfun(self: any? ): fun(): TResult---@paramsourceany?localfunctioncollect(iterator, source)
localret= {}
forelementiniterator(source) dotable.insert(ret, element)
endreturnretend---collect all children of a node recursively---it's a bad practice, but I just leave it here for now. may be fix it in the future...---@paramnodeTSNode---@returnTSNode[]localfunctioncollect_node_rec(node)
localcurrent_level=collect(node.iter_children, node)
localret= {}
for_, childinipairs(current_level) doifchild:child_count() >0thenret=vim.tbl_extend("error", ret, collect_node_rec(child))
endtable.insert(ret, child)
endreturnretendlocalfoo=vim.treesitter.get_string_parser("var foo = string.Empty;", "c_sharp"):parse(true)[1]:root()
vim.print(#collect_node_rec(foo)) -- <-- error here
select all, then run it with sniprun.
error occurs.
however a simple snip like vim.print('foo') just works.
Screenshots
Environment:
NVIM v0.10.1
ArchWSL
{
machine="x86_64",
release="5.15.153.1-microsoft-standard-WSL2",
sysname="Linux",
version="#1 SMP Fri Mar 29 23:14:13 UTC 2024"
}
The text was updated successfully, but these errors were encountered:
Hmm yeah, the tomfoolery between Lua_original and Lua_nvim was originally intended to prevent unexpected failures for small snippets (trying vim.print, and trying native lua code that could behave differently in nvim).
The cause of the issue here is probably that the snippet produced an error also in the Lua_nvim interpreter, which disqualified it as a fallback, and returned the original error instead.
The solution for you is probably to add "Lua_nvim" to your configuration (the selected_interpreters key), to force the use of Lua_nvim for every lua snippet
The solution for me is to communicate more effectively what happened when such fallbacks occur, especially when they're not successfull.
Describe the bug
Same as title
To Reproduce
vim.print('foo')
just works.Screenshots
Environment:
The text was updated successfully, but these errors were encountered: