Skip to content

Commit 86ec47e

Browse files
committed
fix: remove extra use_git_status_colors override, fixes #421
also clear up some type hint related errors
1 parent 542a3b1 commit 86ec47e

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

lua/neo-tree.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ local check_source = function(source_name)
2828
end
2929

3030
local get_position = function(source_name)
31-
local pos = utils.get_value(M, "config." .. source_name .. ".window.position", "left")
31+
local pos = utils.get_value(M, "config." .. source_name .. ".window.position", "left", false)
3232
return pos
3333
end
3434

@@ -45,7 +45,7 @@ M.close_all_except = function(source_name)
4545
local target_pos = get_position(source_name)
4646
for _, name in ipairs(sources) do
4747
if name ~= source_name then
48-
local pos = utils.get_value(M, "config." .. name .. ".window.position", "left")
48+
local pos = utils.get_value(M, "config." .. name .. ".window.position", "left", false)
4949
if pos == target_pos then
5050
manager.close(name)
5151
end

lua/neo-tree/defaults.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ local config = {
164164
content = {
165165
{
166166
"name",
167-
use_git_status_colors = true,
168167
zindex = 10
169168
},
170169
-- {

lua/neo-tree/sources/common/components.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ M.name = function(config, node, state)
295295
else
296296
local filtered_by = M.filtered_by(config, node, state)
297297
highlight = filtered_by.highlight or highlight
298-
if config.use_git_status_colors == nil or config.use_git_status_colors then
298+
if config.use_git_status_colors then
299299
local git_status = state.components.git_status({}, node, state)
300300
if git_status and git_status.highlight then
301301
highlight = git_status.highlight

lua/neo-tree/sources/manager.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,9 @@ M.float = function(source_name)
376376
end
377377

378378
---Focus the window, opening it if it is not already open.
379-
---@param path_to_reveal string Node to focus after the items are loaded.
380-
---@param callback function Callback to call after the items are loaded.
379+
---@param source_name string Source name.
380+
---@param path_to_reveal string|nil Node to focus after the items are loaded.
381+
---@param callback function|nil Callback to call after the items are loaded.
381382
M.focus = function(source_name, path_to_reveal, callback)
382383
local state = M.get_state(source_name)
383384
state.current_position = nil

lua/neo-tree/ui/inputs.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local M = {}
77

88
local should_use_popup_input = function()
99
local nt = require("neo-tree")
10-
return utils.get_value(nt.config, "use_popups_for_input", true)
10+
return utils.get_value(nt.config, "use_popups_for_input", true, false)
1111
end
1212

1313
M.show_input = function(input, callback)

lua/neo-tree/ui/renderer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ end
316316
M.focus_node = function(state, id, do_not_focus_window, relative_movement, bottom_scroll_padding)
317317
if not id and not relative_movement then
318318
log.debug("focus_node called with no id and no relative movement")
319-
return nil
319+
return false
320320
end
321321
relative_movement = relative_movement or 0
322322
bottom_scroll_padding = bottom_scroll_padding or 0

lua/neo-tree/utils.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ end
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.
252252
M.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
@@ -518,6 +518,7 @@ end
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.
521522
M.remove_trailing_slash = function(path)
522523
if M.is_windows then
523524
return path:gsub("\\$", "")
@@ -612,7 +613,8 @@ end
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
616618
M.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

Comments
 (0)