@@ -94,12 +94,15 @@ local function file()
94
94
end
95
95
_2amodule_2a [" file" ] = file
96
96
local function assoc_context (opts )
97
- opts .context = (nvim .b [" conjure#context" ] or extract .context ())
97
+ if not opts .context then
98
+ opts .context = (nvim .b [" conjure#context" ] or extract .context ())
99
+ else
100
+ end
98
101
return opts
99
102
end
100
103
_2amodule_locals_2a [" assoc-context" ] = assoc_context
101
104
local function client_exec_fn (action , f_name , base_opts )
102
- local function _9_ (opts )
105
+ local function _10_ (opts )
103
106
local opts0 = a .merge (opts , base_opts , {action = action , [" file-path" ] = extract [" file-path" ]()})
104
107
assoc_context (opts0 )
105
108
opts0 .preview = preview (opts0 )
@@ -108,30 +111,30 @@ local function client_exec_fn(action, f_name, base_opts)
108
111
else
109
112
end
110
113
if opts0 [" jumping?" ] then
111
- local function _11_ ()
114
+ local function _12_ ()
112
115
do
113
116
local win = nvim .get_current_win ()
114
117
local buf = nvim .get_current_buf ()
115
118
nvim .fn .settagstack (win , {items = {{tagname = opts0 .code , bufnr = buf , from = a .concat ({buf }, nvim .win_get_cursor (win ), {0 }), matchnr = 0 }}}, " a" )
116
119
end
117
120
return nu .normal (" m'" )
118
121
end
119
- pcall (_11_ )
122
+ pcall (_12_ )
120
123
else
121
124
end
122
125
return client .call (f_name , opts0 )
123
126
end
124
- return _9_
127
+ return _10_
125
128
end
126
129
_2amodule_locals_2a [" client-exec-fn" ] = client_exec_fn
127
130
local function apply_gsubs (code )
128
131
if code then
129
- local function _16_ (code0 , _13_ )
130
- local _arg_14_ = _13_
131
- local name = _arg_14_ [1 ]
132
- local _arg_15_ = _arg_14_ [2 ]
133
- local pat = _arg_15_ [1 ]
134
- local rep = _arg_15_ [2 ]
132
+ local function _17_ (code0 , _14_ )
133
+ local _arg_15_ = _14_
134
+ local name = _arg_15_ [1 ]
135
+ local _arg_16_ = _arg_15_ [2 ]
136
+ local pat = _arg_16_ [1 ]
137
+ local rep = _arg_16_ [2 ]
135
138
local ok_3f , val_or_err = pcall (string.gsub , code0 , pat , rep )
136
139
if ok_3f then
137
140
return val_or_err
@@ -140,7 +143,7 @@ local function apply_gsubs(code)
140
143
return code0
141
144
end
142
145
end
143
- return a .reduce (_16_ , code , a [" kv-pairs" ]((nvim .b [" conjure#eval#gsubs" ] or nvim .g [" conjure#eval#gsubs" ])))
146
+ return a .reduce (_17_ , code , a [" kv-pairs" ]((nvim .b [" conjure#eval#gsubs" ] or nvim .g [" conjure#eval#gsubs" ])))
144
147
else
145
148
return nil
146
149
end
@@ -150,23 +153,23 @@ local function eval_str(opts)
150
153
highlight_range (opts .range )
151
154
event .emit (" eval" , " str" )
152
155
a .update (opts , " code" , apply_gsubs )
153
- local function _19_ ()
156
+ local function _20_ ()
154
157
if opts [" passive?" ] then
155
158
return opts
156
159
else
157
160
return with_last_result_hook (opts )
158
161
end
159
162
end
160
- client_exec_fn (" eval" , " eval-str" )(_19_ ())
163
+ client_exec_fn (" eval" , " eval-str" )(_20_ ())
161
164
return nil
162
165
end
163
166
_2amodule_2a [" eval-str" ] = eval_str
164
167
local function wrap_emit (name , f )
165
- local function _20_ (...)
168
+ local function _21_ (...)
166
169
event .emit (name )
167
170
return f (... )
168
171
end
169
- return _20_
172
+ return _21_
170
173
end
171
174
_2amodule_2a [" wrap-emit" ] = wrap_emit
172
175
local doc_str = wrap_emit (" doc" , client_exec_fn (" doc" , " doc-str" ))
@@ -176,9 +179,9 @@ do end (_2amodule_locals_2a)["def-str"] = def_str
176
179
local function current_form (extra_opts )
177
180
local form = extract .form ({})
178
181
if form then
179
- local _let_21_ = form
180
- local content = _let_21_ [" content" ]
181
- local range = _let_21_ [" range" ]
182
+ local _let_22_ = form
183
+ local content = _let_22_ [" content" ]
184
+ local range = _let_22_ [" range" ]
182
185
eval_str (a .merge ({code = content , range = range , origin = " current-form" }, extra_opts ))
183
186
return form
184
187
else
@@ -191,14 +194,14 @@ local function replace_form()
191
194
local win = nvim .tabpage_get_win (0 )
192
195
local form = extract .form ({})
193
196
if form then
194
- local _let_23_ = form
195
- local content = _let_23_ [" content" ]
196
- local range = _let_23_ [" range" ]
197
- local function _24_ (result )
197
+ local _let_24_ = form
198
+ local content = _let_24_ [" content" ]
199
+ local range = _let_24_ [" range" ]
200
+ local function _25_ (result )
198
201
buffer [" replace-range" ](buf , range , result )
199
202
return editor [" go-to" ](win , a [" get-in" ](range , {" start" , 1 }), a .inc (a [" get-in" ](range , {" start" , 2 })))
200
203
end
201
- eval_str ({code = content , range = range , origin = " replace-form" , [" suppress-hud?" ] = true , [" on-result" ] = _24_ })
204
+ eval_str ({code = content , range = range , origin = " replace-form" , [" suppress-hud?" ] = true , [" on-result" ] = _25_ })
202
205
return form
203
206
else
204
207
return nil
@@ -208,9 +211,9 @@ _2amodule_2a["replace-form"] = replace_form
208
211
local function root_form ()
209
212
local form = extract .form ({[" root?" ] = true })
210
213
if form then
211
- local _let_26_ = form
212
- local content = _let_26_ [" content" ]
213
- local range = _let_26_ [" range" ]
214
+ local _let_27_ = form
215
+ local content = _let_27_ [" content" ]
216
+ local range = _let_27_ [" range" ]
214
217
return eval_str ({code = content , range = range , origin = " root-form" })
215
218
else
216
219
return nil
@@ -221,10 +224,10 @@ local function marked_form(mark)
221
224
local comment_prefix = client .get (" comment-prefix" )
222
225
local mark0 = (mark or extract [" prompt-char" ]())
223
226
local ok_3f , err = nil , nil
224
- local function _28_ ()
227
+ local function _29_ ()
225
228
return editor [" go-to-mark" ](mark0 )
226
229
end
227
- ok_3f , err = pcall (_28_ )
230
+ ok_3f , err = pcall (_29_ )
228
231
if ok_3f then
229
232
current_form ({origin = str .join ({" marked-form [" , mark0 , " ]" })})
230
233
editor [" go-back" ]()
@@ -238,13 +241,13 @@ local function insert_result_comment(tag, input)
238
241
local buf = nvim .win_get_buf (0 )
239
242
local comment_prefix = (config [" get-in" ]({" eval" , " comment_prefix" }) or client .get (" comment-prefix" ))
240
243
if input then
241
- local _let_30_ = input
242
- local content = _let_30_ [" content" ]
243
- local range = _let_30_ [" range" ]
244
- local function _31_ (result )
244
+ local _let_31_ = input
245
+ local content = _let_31_ [" content" ]
246
+ local range = _let_31_ [" range" ]
247
+ local function _32_ (result )
245
248
return buffer [" append-prefixed-line" ](buf , range [" end" ], comment_prefix , result )
246
249
end
247
- eval_str ({code = content , range = range , origin = str .join ({" comment-" , tag }), [" suppress-hud?" ] = true , [" on-result" ] = _31_ })
250
+ eval_str ({code = content , range = range , origin = str .join ({" comment-" , tag }), [" suppress-hud?" ] = true , [" on-result" ] = _32_ })
248
251
return input
249
252
else
250
253
return nil
@@ -264,9 +267,9 @@ local function comment_word()
264
267
end
265
268
_2amodule_2a [" comment-word" ] = comment_word
266
269
local function word ()
267
- local _let_33_ = extract .word ()
268
- local content = _let_33_ [" content" ]
269
- local range = _let_33_ [" range" ]
270
+ local _let_34_ = extract .word ()
271
+ local content = _let_34_ [" content" ]
272
+ local range = _let_34_ [" range" ]
270
273
if not a [" empty?" ](content ) then
271
274
return eval_str ({code = content , range = range , origin = " word" })
272
275
else
@@ -275,9 +278,9 @@ local function word()
275
278
end
276
279
_2amodule_2a [" word" ] = word
277
280
local function doc_word ()
278
- local _let_35_ = extract .word ()
279
- local content = _let_35_ [" content" ]
280
- local range = _let_35_ [" range" ]
281
+ local _let_36_ = extract .word ()
282
+ local content = _let_36_ [" content" ]
283
+ local range = _let_36_ [" range" ]
281
284
if not a [" empty?" ](content ) then
282
285
return doc_str ({code = content , range = range , origin = " word" })
283
286
else
@@ -286,9 +289,9 @@ local function doc_word()
286
289
end
287
290
_2amodule_2a [" doc-word" ] = doc_word
288
291
local function def_word ()
289
- local _let_37_ = extract .word ()
290
- local content = _let_37_ [" content" ]
291
- local range = _let_37_ [" range" ]
292
+ local _let_38_ = extract .word ()
293
+ local content = _let_38_ [" content" ]
294
+ local range = _let_38_ [" range" ]
292
295
if not a [" empty?" ](content ) then
293
296
return def_str ({code = content , range = range , origin = " word" })
294
297
else
@@ -297,9 +300,9 @@ local function def_word()
297
300
end
298
301
_2amodule_2a [" def-word" ] = def_word
299
302
local function buf ()
300
- local _let_39_ = extract .buf ()
301
- local content = _let_39_ [" content" ]
302
- local range = _let_39_ [" range" ]
303
+ local _let_40_ = extract .buf ()
304
+ local content = _let_40_ [" content" ]
305
+ local range = _let_40_ [" range" ]
303
306
return eval_str ({code = content , range = range , origin = " buf" })
304
307
end
305
308
_2amodule_2a [" buf" ] = buf
@@ -308,16 +311,16 @@ local function command(code)
308
311
end
309
312
_2amodule_2a [" command" ] = command
310
313
local function range (start , _end )
311
- local _let_40_ = extract .range (start , _end )
312
- local content = _let_40_ [" content" ]
313
- local range0 = _let_40_ [" range" ]
314
+ local _let_41_ = extract .range (start , _end )
315
+ local content = _let_41_ [" content" ]
316
+ local range0 = _let_41_ [" range" ]
314
317
return eval_str ({code = content , range = range0 , origin = " range" })
315
318
end
316
319
_2amodule_2a [" range" ] = range
317
320
local function selection (kind )
318
- local _let_41_ = extract .selection ({kind = (kind or nvim .fn .visualmode ()), [" visual?" ] = not kind })
319
- local content = _let_41_ [" content" ]
320
- local range0 = _let_41_ [" range" ]
321
+ local _let_42_ = extract .selection ({kind = (kind or nvim .fn .visualmode ()), [" visual?" ] = not kind })
322
+ local content = _let_42_ [" content" ]
323
+ local range0 = _let_42_ [" range" ]
321
324
return eval_str ({code = content , range = range0 , origin = " selection" })
322
325
end
323
326
_2amodule_2a [" selection" ] = selection
@@ -331,15 +334,15 @@ end
331
334
_2amodule_locals_2a [" wrap-completion-result" ] = wrap_completion_result
332
335
local function completions (prefix , cb )
333
336
local function cb_wrap (results )
334
- local function _43_ ()
335
- local _44_ = config [" get-in" ]({" completion" , " fallback" })
336
- if (nil ~= _44_ ) then
337
- return nvim .call_function (_44_ , {0 , prefix })
337
+ local function _44_ ()
338
+ local _45_ = config [" get-in" ]({" completion" , " fallback" })
339
+ if (nil ~= _45_ ) then
340
+ return nvim .call_function (_45_ , {0 , prefix })
338
341
else
339
- return _44_
342
+ return _45_
340
343
end
341
344
end
342
- return cb (a .map (wrap_completion_result , (results or _43_ ())))
345
+ return cb (a .map (wrap_completion_result , (results or _44_ ())))
343
346
end
344
347
if (" function" == type (client .get (" completions" ))) then
345
348
return client .call (" completions" , assoc_context ({[" file-path" ] = extract [" file-path" ](), prefix = prefix , cb = cb_wrap }))
0 commit comments