File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed
Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ Dissociates the connection for the given path
2222pwd ** (string)** : path (usually project root).
2323
2424
25+ ## ` acid.connections.peek([pwd]) `
26+ Return active connection for the given path
27+
28+ * pwd* ** (string)** : path (usually project root).
29+
30+
31+ ** ({string,string})** Connection tuple with ip and port or nil.
32+
33+
2534## ` acid.connections.get(pwd) `
2635Return active connection for the given path
2736
Original file line number Diff line number Diff line change @@ -63,6 +63,14 @@ connections.unselect = function(pwd)
6363 connections .current [pwd ] = nil
6464end
6565
66+ --- Return active connection for the given path
67+ -- @tparam [opt] string pwd path (usually project root).
68+ -- @treturn {string,string} Connection tuple with ip and port or nil.
69+ connections .peek = function (pwd )
70+ pwd = pwd_to_key (pwd or vim .api .nvim_call_function (" getcwd" , {}))
71+ return connections .current [pwd ]
72+ end
73+
6674--- Return active connection for the given path
6775-- @tparam string pwd path (usually project root).
6876-- @treturn {string,string} Connection tuple with ip and port or nil.
Original file line number Diff line number Diff line change 66local core = require (" acid.core" )
77local connections = require (" acid.connections" )
88local utils = require (" acid.utils" )
9+ local sessions = require (" acid.sessions" )
910
1011local acid = {}
1112
2728-- @param cmd A command (op + payload + handler) to be executed.
2829-- @param conn A connection where this command will be run.
2930acid .run = function (cmd , conn )
30- return core .send (conn , cmd :build ())
31+ local filtered = cmd :update_payload (sessions .filter )
32+ return core .send (conn , filtered :build ())
3133end
3234
3335
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ augroup acid
9090 autocmd !
9191 autocmd BufWritePost *.clj call s: require ()
9292
93+ autocmd User AcidConnected lua require (" acid.sessions" ).new_session ()
9394 autocmd User AcidConnected lua require (" acid.features" ).preload ()
9495 autocmd User AcidConnected lua require (" acid.features" ).load_all_nss ()
9596
You can’t perform that action at this time.
0 commit comments