Skip to content

Commit b2ee50e

Browse files
committed
remove unnessary comment
1 parent fad6fe5 commit b2ee50e

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

lua/opencode/commands/handlers/session.lua

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,7 @@ local function compute_target_index(current_idx, total, direction, wrap)
180180
end
181181

182182
function M.actions.navigate_session_tree(direction, interaction, wrap, empty_policy)
183-
-- If direction is not a known navigation direction, treat it as a target session ID.
184-
-- This path runs before the tree lookup so invalid inputs get clear feedback.
185-
if direction
186-
and not tree_directions[direction]
187-
and direction ~= 'forward'
188-
and direction ~= 'backward'
189-
then
183+
if direction and not tree_directions[direction] and direction ~= 'forward' and direction ~= 'backward' then
190184
empty_policy = empty_policy or 'notify'
191185
if not state.active_session then
192186
if empty_policy == 'notify' then
@@ -202,16 +196,22 @@ function M.actions.navigate_session_tree(direction, interaction, wrap, empty_pol
202196

203197
local active = state.active_session
204198
if not active then
205-
if empty_policy == 'notify' then vim.notify('No active session', vim.log.levels.WARN) end
199+
if empty_policy == 'notify' then
200+
vim.notify('No active session', vim.log.levels.WARN)
201+
end
206202
return
207203
end
208204

209205
local dir = tree_directions[direction]
210206
if dir then
211207
local target_id = dir.get_target(active)
212208
if not target_id then
213-
if direction == 'sibling' then return session_runtime.select_session(nil) end
214-
if empty_policy == 'notify' then vim.notify('No ' .. direction, vim.log.levels.INFO) end
209+
if direction == 'sibling' then
210+
return session_runtime.select_session(nil)
211+
end
212+
if empty_policy == 'notify' then
213+
vim.notify('No ' .. direction, vim.log.levels.INFO)
214+
end
215215
return
216216
end
217217
if interaction == 'picker' or not dir.allow_direct then
@@ -224,13 +224,17 @@ function M.actions.navigate_session_tree(direction, interaction, wrap, empty_pol
224224
return Promise.async(function()
225225
local all_sessions = session_store.get_all_workspace_sessions():await()
226226
if not all_sessions or #all_sessions == 0 then
227-
if empty_policy == 'notify' then vim.notify('No sessions', vim.log.levels.INFO) end
227+
if empty_policy == 'notify' then
228+
vim.notify('No sessions', vim.log.levels.INFO)
229+
end
228230
return
229231
end
230232

231233
local current_idx = find_session_index(all_sessions, active.id)
232234
if not current_idx then
233-
if empty_policy == 'notify' then vim.notify('Session not in list', vim.log.levels.INFO) end
235+
if empty_policy == 'notify' then
236+
vim.notify('Session not in list', vim.log.levels.INFO)
237+
end
234238
return
235239
end
236240

@@ -598,7 +602,6 @@ M.command_defs = {
598602
navigate_session_tree = {
599603
desc = 'Navigate session tree (parent/child/sibling/forward/backward) or switch to a session by ID',
600604
execute = function(args)
601-
-- If args[1] is not a known direction, treat it as a session ID
602605
if args[1] and not NAV_DIRECTIONS[args[1]] then
603606
return M.actions.navigate_session_tree(args[1], args[2], args[3], args[4])
604607
end

0 commit comments

Comments
 (0)