Skip to content

Commit b69255d

Browse files
authored
feat: support multiple file types per ext in file nesting (#392)
1 parent 593d556 commit b69255d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/neo-tree/sources/common/file-nesting.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local iter = require("plenary.iterators").iter
22
local utils = require("neo-tree.utils")
3+
local Path = require("plenary.path")
34

45
-- File nesting a la JetBrains (#117).
56
local M = {}
@@ -17,7 +18,10 @@ function M.get_parent(item)
1718
for base_exts, nesting_exts in pairs(M.config) do
1819
for _, exts in ipairs(nesting_exts) do
1920
if item.exts == exts then
20-
return utils.path_join(item.parent_path, item.base) .. "." .. base_exts
21+
local parent_id = utils.path_join(item.parent_path, item.base) .. "." .. base_exts
22+
if Path:new(parent_id):exists() then
23+
return parent_id
24+
end
2125
end
2226
end
2327
end

0 commit comments

Comments
 (0)