Skip to content

Commit 9add2e7

Browse files
committed
refactor(#2875): deal with some cyclic require
1 parent fe1974c commit 9add2e7

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

lua/nvim-tree/core.lua

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
local events = require "nvim-tree.events"
2-
local explorer = require "nvim-tree.explorer"
32
local view = require "nvim-tree.view"
43
local log = require "nvim-tree.log"
54

@@ -16,7 +15,7 @@ function M.init(foldername)
1615
if TreeExplorer then
1716
TreeExplorer:destroy()
1817
end
19-
TreeExplorer = explorer:new(foldername)
18+
TreeExplorer = require("nvim-tree.explorer"):new(foldername)
2019
if not first_init_done then
2120
events._dispatch_ready()
2221
first_init_done = true

lua/nvim-tree/explorer/init.lua

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ local NodeIterator = require "nvim-tree.iterators.node-iterator"
1313
local Watcher = require "nvim-tree.watcher"
1414

1515
local Filters = require "nvim-tree.explorer.filters"
16-
---@type Marks
17-
local Marks -- circular dependencies
16+
local Marks = require "nvim-tree.marks"
1817
local LiveFilter = require "nvim-tree.explorer.live-filter"
1918
local Sorters = require "nvim-tree.explorer.sorters"
20-
---@type Clipboard
21-
local Clipboard -- circular dependencies
22-
---@type Renderer
23-
local Renderer -- circular dependencies
19+
local Clipboard = require "nvim-tree.actions.fs.clipboard"
20+
local Renderer = require "nvim-tree.renderer"
2421

2522
local FILTER_REASON = require("nvim-tree.enum").FILTER_REASON
2623

lua/nvim-tree/renderer/init.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ local log = require "nvim-tree.log"
22
local view = require "nvim-tree.view"
33
local events = require "nvim-tree.events"
44

5-
local _padding = require "nvim-tree.renderer.components.padding"
65
local icon_component = require "nvim-tree.renderer.components.icons"
7-
local full_name = require "nvim-tree.renderer.components.full-name"
6+
87
local Builder = require "nvim-tree.renderer.builder"
98

109
local SIGN_GROUP = "NvimTreeRendererSigns"
@@ -122,9 +121,10 @@ function Renderer:draw()
122121
end
123122

124123
function Renderer.setup(opts)
125-
_padding.setup(opts)
126-
full_name.setup(opts)
127124
icon_component.setup(opts)
125+
126+
require "nvim-tree.renderer.components.padding".setup(opts)
127+
require "nvim-tree.renderer.components.full-name".setup(opts)
128128
end
129129

130130
return Renderer

0 commit comments

Comments
 (0)