Skip to content

Commit 4eab392

Browse files
committed
chore: remove dead code
1 parent 42490ec commit 4eab392

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

lua/opencode/config_file.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ local M = {
44
providers_promise = nil,
55
}
66

7-
function M.setup()
8-
-- No-op: Config is now loaded lazily when needed to avoid spawning server on plugin load
9-
end
10-
117
---@return OpencodeConfigFile|nil
128
function M.get_opencode_config()
139
if not M.config_promise then

lua/opencode/init.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ local config_file = require('opencode.config_file')
77
function M.setup(opts)
88
vim.schedule(function()
99
require('opencode.core').setup()
10-
config_file.setup()
1110
config.setup(opts)
1211
api.setup()
1312
keymap.setup(config.get('keymap'))

tests/unit/config_file_spec.lua

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ describe('config_file.setup', function()
88

99
before_each(function()
1010
original_schedule = vim.schedule
11-
vim.schedule = function(fn) fn() end
11+
vim.schedule = function(fn)
12+
fn()
13+
end
1214
original_api_client = state.api_client
1315
config_file.config_promise = nil
1416
config_file.project_promise = nil
@@ -33,16 +35,15 @@ describe('config_file.setup', function()
3335
end,
3436
}
3537

36-
config_file.setup()
3738
-- Promises should not be set up during setup (lazy loading)
3839
assert.falsy(config_file.config_promise)
3940
assert.falsy(config_file.project_promise)
40-
41+
4142
-- Accessing config should trigger lazy loading
4243
local resolved_cfg = config_file.get_opencode_config()
4344
assert.same(cfg, resolved_cfg)
4445
assert.True(get_config_called)
45-
46+
4647
-- Project should be loaded when accessed
4748
local project = config_file.get_opencode_project()
4849
assert.True(get_project_called)
@@ -57,7 +58,6 @@ describe('config_file.setup', function()
5758
return Promise.new():resolve({ id = 'p1' })
5859
end,
5960
}
60-
-- No need to call setup() since config is loaded lazily
6161
local agents = config_file.get_opencode_agents()
6262
assert.True(vim.tbl_contains(agents, 'custom'))
6363
assert.True(vim.tbl_contains(agents, 'build'))
@@ -74,7 +74,6 @@ describe('config_file.setup', function()
7474
return Promise.new():resolve(project)
7575
end,
7676
}
77-
-- No need to call setup() since project is loaded lazily
7877
local proj = config_file.get_opencode_project()
7978
assert.same(project, proj)
8079
end)

0 commit comments

Comments
 (0)