Skip to content

Commit ea1ba29

Browse files
committed
chore: emmylua diagnostic cleanup
1 parent f9289b6 commit ea1ba29

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

lua/opencode/api.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ function M.set_review_breakpoint()
210210
end
211211

212212
function M.prev_history()
213+
if not state.windows then
214+
return
215+
end
213216
local prev_prompt = history.prev()
214217
if prev_prompt then
215218
input_window.set_content(prev_prompt)
@@ -218,6 +221,9 @@ function M.prev_history()
218221
end
219222

220223
function M.next_history()
224+
if not state.windows then
225+
return
226+
end
221227
local next_prompt = history.next()
222228
if next_prompt then
223229
input_window.set_content(next_prompt)
@@ -428,7 +434,11 @@ function M.help()
428434
'|-----------|---------------------|',
429435
}, false)
430436

431-
local max_desc_length = (vim.api.nvim_win_get_width(state.windows.output_win) / 2) - 5
437+
if not state.windows or not state.windows.output_win then
438+
return
439+
end
440+
441+
local max_desc_length = math.floor((vim.api.nvim_win_get_width(state.windows.output_win) / 2) - 5)
432442

433443
for _, def in pairs(M.commands) do
434444
local desc = def.desc or ''

lua/opencode/session.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function M.get_messages(session)
168168
end
169169

170170
---Get snapshot IDs from a message's parts
171-
---@param message OpencodeMessage
171+
---@param message OpencodeMessage?
172172
---@return string[]|nil
173173
function M.get_message_snapshot_ids(message)
174174
if not message then

lua/opencode/types.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
---@field snapshot string
3636
---@field diff string
3737

38+
---@class SessionShareInfo
39+
---@field url string
40+
3841
---@class Session
3942
---@field workspace string
4043
---@field description string
@@ -47,6 +50,7 @@
4750
---@field snapshot_path string
4851
---@field cache_path string
4952
---@field revert? SessionRevertInfo
53+
---@field share? SessionShareInfo
5054

5155
---@class OpencodeKeymapEntry
5256
---@field [1] string # Function name

lua/opencode/ui/ui.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local input_window = require('opencode.ui.input_window')
77
local footer = require('opencode.ui.footer')
88
local topbar = require('opencode.ui.topbar')
99

10-
---@param windows OpencodeWindowState
10+
---@param windows OpencodeWindowState?
1111
function M.close_windows(windows)
1212
if not windows then
1313
return

0 commit comments

Comments
 (0)