Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lua/neo-tree/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ log_maker.new = function(config)
return config.use_file
end
log.outfile = type(file) == "string" and file or initial_filepath
log.outfile = vim.fn.expand(log.outfile)
log.outfile = vim.fn.fnamemodify(log.outfile, ":p")
local fp, err = io.open(log.outfile, "a+")

if not fp then
Expand Down
20 changes: 11 additions & 9 deletions lua/neo-tree/sources/common/file-items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ local advanced_sort = function(tbl, state)
deep_sort(tbl, sort_func, field_provider, direction)
end

local create_item, set_parents
local set_parents

---@alias neotree.Filetype
---|"file"
Expand Down Expand Up @@ -159,8 +159,9 @@ local create_item, set_parents
---@param _type neotree.Filetype?
---@param bufnr integer?
---@return neotree.FileItem
function create_item(context, path, _type, bufnr)
local parent_path, name = utils.split_path(utils.normalize_path(path))
local function create_item(context, path, _type, bufnr)
path = utils.normalize_path(path)
local parent_path, name = utils.split_path(path)
name = name or ""
local id = path
if path == "[No Name]" and bufnr then
Expand All @@ -169,8 +170,9 @@ function create_item(context, path, _type, bufnr)
id = tostring(bufnr)
else
-- avoid creating duplicate items
if context.folders[path] or context.nesting[path] or context.item_exists[path] then
return context.folders[path] or context.nesting[path] or context.item_exists[path]
local cached_item = context.folders[id] or context.nesting[id] or context.item_exists[id]
if cached_item then
return cached_item
end
end

Expand Down Expand Up @@ -298,7 +300,7 @@ function set_parents(context, item)
end
if parent == nil then
local success
success, parent = pcall(create_item, context, item.parent_path, "directory")
success, parent = pcall(create_item, context, item.parent_path)
if not success then
log.error("Error creating item for ", item.parent_path, ":", parent)
end
Expand All @@ -307,7 +309,7 @@ function set_parents(context, item)
set_parents(context, parent)
end
table.insert(parent.children, item)
context.item_exists[item.id] = true
context.item_exists[item.id] = item

if not item.filtered_by and parent.filtered_by then
item.filtered_by = {
Expand All @@ -319,8 +321,8 @@ end
---@class (exact) neotree.FileItemContext
---@field state neotree.State?
---@field folders table<string, neotree.FileItem.Directory|neotree.FileItem.Link?>
---@field nesting neotree.FileItem[]
---@field item_exists table<string, boolean?>
---@field nesting table<string, neotree.FileItem?>
---@field item_exists table<string, neotree.FileItem?>
---@field all_items neotree.FileItem[]?
---@field path_to_reveal string?

Expand Down
Loading