File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,24 @@ local M = {}
66
77local PENDING = (coroutine.wrap (jupyter_api_nvim .PENDING ))()
88
9+ local denull
10+ denull = function (input )
11+ if type (input ) == " table" then
12+ local denulled = {}
13+ for key , value in pairs (denulled ) do
14+ denulled [key ] = denull (value )
15+ end
16+ elseif type (input ) == " userdata" then
17+ if tostring (input ) == " userdata (NULL)" then
18+ return nil
19+ else
20+ return input
21+ end
22+ else
23+ return input
24+ end
25+ end
26+
927--- Wrap an async rust function in a coroutine that neovim will poll. Return a function that takes
1028--- function args and a callback function
1129--- @param async_fn any
@@ -23,7 +41,7 @@ local wrap = function(async_fn)
2341 if res == PENDING then
2442 vim .defer_fn (exec , 10 )
2543 else
26- cb (res )
44+ cb (denull ( res ) )
2745 end
2846 end
2947 vim .schedule (exec )
You can’t perform that action at this time.
0 commit comments