File tree Expand file tree Collapse file tree 3 files changed +22
-13
lines changed Expand file tree Collapse file tree 3 files changed +22
-13
lines changed Original file line number Diff line number Diff line change 77
77
(:code-channel plugin))
78
78
79
79
(defn start
80
- [{:keys [debug nvim repl-log socket-repl code-channel] :as plugin}]
80
+ [{:keys [nvim repl-log socket-repl code-channel] :as plugin}]
81
81
82
82
; ; Wire sub-component io.
83
83
(log-start
191
191
plugin))
192
192
193
193
(defn new
194
- [debug nvim repl-log socket-repl]
194
+ [nvim repl-log socket-repl]
195
195
{:nvim nvim
196
196
:repl-log repl-log
197
197
:socket-repl socket-repl
198
- :debug debug
199
198
:code-channel (async/chan 1024 )})
Original file line number Diff line number Diff line change 2
2
" The system created by wiring various components together."
3
3
(:require
4
4
[clojure.core.async :as async]
5
+ [clojure.tools.logging :as log]
5
6
[neovim-client.nvim :as nvim]
6
7
[socket-repl.socket-repl-plugin :as plugin]
7
8
[socket-repl.repl-log :as repl-log]
8
9
[socket-repl.socket-repl :as socket-repl])
9
10
(:gen-class ))
10
11
11
- (defn new-system
12
- [debug]
13
- ; ; TODO - separate new & start in nvim
14
- (let [nvim (if debug
15
- (nvim/new " localhost" 7777 )
16
- (nvim/new ))
17
- socket-repl (socket-repl/start (socket-repl/new ))
12
+ (defn new-system*
13
+ [nvim]
14
+ (let [socket-repl (socket-repl/start (socket-repl/new ))
18
15
repl-log (repl-log/start (repl-log/new socket-repl))
19
- plugin (plugin/start (plugin/new debug nvim repl-log socket-repl))]
16
+ plugin (plugin/start (plugin/new nvim repl-log socket-repl))]
20
17
{:nvim nvim
21
18
:repl-log repl-log
22
19
:socket-repl socket-repl
23
20
:plugin plugin}))
24
21
22
+ (defn new-system
23
+ ([]
24
+ (log/info " starting plugin using STDIO" )
25
+ (new-system* (nvim/new )))
26
+ ([uds-filepath]
27
+ (log/info " starting plugin using UDS" uds-filepath)
28
+ (new-system* (nvim/new uds-filepath)))
29
+ ([host port]
30
+ (log/info (format " starting plugin using TCP socket %s:%s" host port))
31
+ (new-system* (nvim/new host port))))
32
+
25
33
(defn stop
26
34
[{:keys [nvim plugin repl-log socket-repl] :as system}]
27
35
(plugin/stop plugin)
31
39
32
40
(defn -main
33
41
[& args]
34
- (new-system false ))
42
+ (if (= 1 (count args))
43
+ (new-system (first args))
44
+ (new-system )))
Original file line number Diff line number Diff line change 15
15
(defn go
16
16
" Start the plugin."
17
17
[]
18
- (reset! system-atom (system/new-system true )))
18
+ (reset! system-atom (system/new-system " localhost " 7777 )))
19
19
20
20
(defn stop
21
21
[]
You can’t perform that action at this time.
0 commit comments