Skip to content

Commit 9b5d671

Browse files
authored
fix(manager): ensure setup before creating state (#1729)
1 parent 8c6349b commit 9b5d671

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lua/neo-tree/sources/manager.lua

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--This file should have all functions that are in the public api and either set
22
--or read the state of this source.
33

4+
local nt = require("neo-tree")
45
local utils = require("neo-tree.utils")
56
local compat = require("neo-tree.utils._compat")
67
local fs_scan = require("neo-tree.sources.filesystem.lib.fs_scan")
@@ -34,6 +35,7 @@ local get_source_data = function(source_name)
3435
end
3536

3637
local function create_state(tabid, sd, winid)
38+
nt.ensure_config()
3739
local default_config = default_configs[sd.name]
3840
local state = vim.deepcopy(default_config, compat.noref())
3941
state.tabid = tabid

tests/neo-tree/manager/state_spec.lua

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
describe("manager state", function()
2+
it("can be retrieved at startup", function()
3+
local fs_state = require("neo-tree.sources.manager").get_state("filesystem")
4+
local buffers_state = require("neo-tree.sources.manager").get_state("buffers")
5+
assert.are_equal(type(fs_state), "table")
6+
assert.are_equal(type(buffers_state), "table")
7+
end)
8+
end)

0 commit comments

Comments
 (0)