248248--- @param defaultValue any The default value to return if the value is nil.
249249--- @param strict_type_check boolean Whether to require the type of the value is
250250--- the same as the default value.
251- --- @return table table The value at the path or the default value.
251+ --- @return table | nil table The value at the path or the default value.
252252M .get_value = function (sourceObject , valuePath , defaultValue , strict_type_check )
253253 if sourceObject == nil then
254254 return defaultValue
@@ -435,7 +435,7 @@ M.open_file = function(state, path, open_cmd)
435435 if vim .bo .filetype == " neo-tree" then
436436 -- Neo-tree must be the only window, restore it's status as a sidebar
437437 local winid = vim .api .nvim_get_current_win ()
438- local width = M .get_value (state , " window.width" , 40 )
438+ local width = M .get_value (state , " window.width" , 40 , false )
439439 result , err = pcall (vim .cmd , " vsplit " .. escaped_path )
440440 vim .api .nvim_win_set_width (winid , width )
441441 else
518518--- Remove the path separator from the end of a path in a cross-platform way.
519519--- @param path string The path to remove the separator from.
520520--- @return string string The path without any trailing separator.
521+ --- @return number count The number of separators removed.
521522M .remove_trailing_slash = function (path )
522523 if M .is_windows then
523524 return path :gsub (" \\ $" , " " )
612613
613614--- Split a path into a parentPath and a name.
614615--- @param path string The path to split.
615- --- @return table table parentPath , name
616+ --- @return string | nil parentPath
617+ --- @return string | nil name
616618M .split_path = function (path )
617619 if not path then
618620 return nil , nil
@@ -627,7 +629,7 @@ M.split_path = function(path)
627629 if # parts == 1 then
628630 parentPath = parentPath .. M .path_separator
629631 elseif parentPath == " " then
630- parentPath = nil
632+ return nil , name
631633 end
632634 else
633635 parentPath = M .path_separator .. parentPath
0 commit comments