@@ -273,10 +273,41 @@ local function open_or_expand_or_dir_up(mode, toggle_group)
273273 end
274274end
275275
276+ local function unsupported_opts_message (opts , action_name )
277+ if opts .quit_on_open or opts .focus then
278+ notify .error (string.format (" `quit_on_open` and `focus` options are not supported for `Api.node.open.%s` action" , action_name ))
279+
280+ return true
281+ end
282+
283+ return false
284+ end
285+
276286Api .node .open .edit = wrap_node (open_or_expand_or_dir_up (" edit" ))
277- Api .node .open .drop = wrap_node (open_or_expand_or_dir_up (" drop" ))
278- Api .node .open .tab_drop = wrap_node (open_or_expand_or_dir_up (" tab_drop" ))
279- Api .node .open .replace_tree_buffer = wrap_node (open_or_expand_or_dir_up (" edit_in_place" ))
287+ Api .node .open .drop = function (node , opts )
288+ if unsupported_opts_message (opts , " drop" ) then
289+ return
290+ end
291+
292+ return wrap_node (open_or_expand_or_dir_up (" drop" ))(node )
293+ end
294+
295+ Api .node .open .tab_drop = function (node , opts )
296+ if unsupported_opts_message (opts , " tab_drop" ) then
297+ return
298+ end
299+
300+ return wrap_node (open_or_expand_or_dir_up (" tab_drop" ))(node )
301+ end
302+
303+ Api .node .open .replace_tree_buffer = function (node , opts )
304+ if unsupported_opts_message (opts , " replace_tree_buffer" ) then
305+ return
306+ end
307+
308+ return wrap_node (open_or_expand_or_dir_up (" edit_in_place" ))(node )
309+ end
310+
280311Api .node .open .no_window_picker = wrap_node (open_or_expand_or_dir_up (" edit_no_picker" ))
281312Api .node .open .vertical = wrap_node (open_or_expand_or_dir_up (" vsplit" ))
282313Api .node .open .vertical_no_picker = wrap_node (open_or_expand_or_dir_up (" vsplit_no_picker" ))
0 commit comments