@@ -79,15 +79,6 @@ local build_cmd = function(obj)
79
79
table.insert (opts , obj .bind )
80
80
end
81
81
82
- if obj .host ~= nil or obj .connect ~= nil then
83
- table.insert (opts ," -c" )
84
- end
85
-
86
- if obj .host ~= nil then
87
- table.insert (opts ," -h" )
88
- table.insert (opts , obj .host )
89
- end
90
-
91
82
return opts
92
83
end
93
84
@@ -102,17 +93,13 @@ nrepl.default_middlewares = {'nrepl/nrepl', 'cider/cider-nrepl', 'refactor-nrepl
102
93
-- @tparam [opt] string obj.pwd Path where the nrepl process will be started
103
94
-- @tparam [opt] table obj.middlewares List of middlewares.
104
95
-- @tparam [opt] string obj.alias aliases on the local deps.edn
105
- -- @tparam [opt] string obj.connect -c parameter for the nrepl process
96
+ -- @tparam [opt] int obj.port -p parameter for the nrepl process
106
97
-- @tparam [opt] string obj.bind -b parameter for the nrepl process
107
98
-- @tparam [opt] boolean obj.skip_autocmd don't fire an autocmd after starting this repl
108
99
-- @tparam [opt] boolean obj.disable_output_capture disables output capturing.
109
100
-- @treturn boolean Whether it was possible to spawn a nrepl process
110
101
nrepl .start = function (obj )
111
- local pwd = obj .pwd or vim .api .nvim_call_function (" getcwd" , {})
112
-
113
- if not utils .ends_with (pwd , " /" ) then
114
- pwd = pwd .. " /"
115
- end
102
+ local pwd = utils .ensure_path (obj .pwd or vim .api .nvim_call_function (" getcwd" , {}))
116
103
117
104
local selected = obj .middlewares or nrepl .default_middlewares
118
105
local bind = obj .bind
@@ -121,8 +108,6 @@ nrepl.start = function(obj)
121
108
port = obj .port ,
122
109
alias = obj .alias ,
123
110
bind = obj .bind ,
124
- host = obj .host ,
125
- connect = obj .connect ,
126
111
deps_file = obj .deps_file
127
112
}
128
113
@@ -139,7 +124,7 @@ nrepl.start = function(obj)
139
124
140
125
if ret <= 0 then
141
126
-- TODO log, inform..
142
- return
127
+ return false
143
128
end
144
129
145
130
local conn = {bind , obj .port }
@@ -155,12 +140,49 @@ nrepl.start = function(obj)
155
140
nrepl .cache [pwd ].id = conn_id
156
141
157
142
job_mapping [ret ] = {pwd = pwd , conn = conn_id , init = false }
158
- if obj .disable_output_capture == false then
143
+
144
+ if not obj .disable_output_capture then
159
145
output .buffer (conn_id )
160
146
end
161
147
return true
162
148
end
163
149
150
+ nrepl .bbnrepl = function (obj )
151
+ local pwd = utils .ensure_path (obj .pwd or vim .api .nvim_call_function (" getcwd" , {}))
152
+
153
+ obj .port = obj .port or " 1667"
154
+
155
+ local cmd = {
156
+ " bb" , " --nrepl-server" , obj .port
157
+ }
158
+
159
+ local ret = nvim .nvim_call_function (' jobstart' , {
160
+ cmd , {
161
+ on_exit = " AcidJobCleanup" ,
162
+ cwd = pwd
163
+ }
164
+ })
165
+
166
+ if ret <= 0 then
167
+ -- TODO log, inform..
168
+ return false
169
+ end
170
+
171
+ local conn = {" 127.0.0.1" , obj .port }
172
+
173
+ nrepl .cache [pwd ] = {
174
+ skip_autocmd = true ,
175
+ job = ret ,
176
+ addr = conn
177
+ }
178
+
179
+ local conn_id = connections .add (conn )
180
+ connections .select (obj .pwd , conn_id )
181
+
182
+ nrepl .cache [pwd ].id = conn_id
183
+
184
+ end
185
+
164
186
--- Stops a nrepl process managed by acid
165
187
-- @tparam table obj Configuration for the nrepl process to be stopped
166
188
-- @tparam string obj.pwd Path where the nrepl process was started
0 commit comments