File tree 2 files changed +42
-0
lines changed
rplugin/python3/acid/handlers
2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- luacheck: globals unpack vim
2
+ local nvim = vim .api
3
+
4
+ local indirection = {}
5
+ local acid = {}
6
+
7
+ acid .send = function (obj , handler )
8
+ local session = math.random (10000 , 99999 )
9
+
10
+ indirection [session ] = handler
11
+
12
+ nvim .nvim_call_function (" AcidSendNrepl" , {
13
+ obj ,
14
+ " LuaFn" ,
15
+ " require('acid').callback(" .. session .. " , _A)"
16
+ })
17
+ end
18
+
19
+ acid .callback = function (session , ret )
20
+ return indirection [session ](ret )
21
+ end
22
+
23
+ return acid
Original file line number Diff line number Diff line change
1
+ from acid .handlers import BaseHandler
2
+ from acid .nvim .log import error
3
+
4
+
5
+ class Handler (BaseHandler ):
6
+
7
+ name = "LuaFn"
8
+ priority = 0
9
+
10
+ def on_init (self ):
11
+ self .lua_fn = ""
12
+
13
+ def configure (self , lua_fn , * args , ** kwargs ):
14
+ super ().configure (* args , ** kwargs )
15
+ self .lua_fn = lua_fn
16
+ return self
17
+
18
+ def on_handle (self , msg , * _ ):
19
+ self .nvim .funcs .luaeval (self .lua_fn , msg )
You can’t perform that action at this time.
0 commit comments