Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Install the plugin with your favorite package manager. See the [Configuration](#
```lua
-- Default configuration with all available options
require('opencode').setup({
preferred_picker = nil, -- 'telescope', 'fzf', 'mini.pick', 'snacks', if nil, it will use the best available picker. Note mini.pick does not support multiple selections
preferred_picker = nil, -- 'telescope', 'fzf', 'mini.pick', 'snacks', 'select', if nil, it will use the best available picker. Note mini.pick does not support multiple selections
preferred_completion = nil, -- 'blink', 'nvim-cmp','vim_complete' if nil, it will use the best available completion
default_global_keymaps = true, -- If false, disables all default global keymaps
default_mode = 'build', -- 'build' or 'plan' or any custom configured. @see [OpenCode Agents](https://opencode.ai/docs/modes/)
Expand Down
2 changes: 1 addition & 1 deletion lua/opencode/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
---@field get_key_for_function fun(scope: 'editor'|'input_window'|'output_window', function_name: string): string|nil

---@class OpencodeConfig
---@field preferred_picker 'telescope' | 'fzf' | 'mini.pick' | 'snacks' | nil
---@field preferred_picker 'telescope' | 'fzf' | 'mini.pick' | 'snacks' | 'select' | nil
---@field preferred_completion 'blink' | 'nvim-cmp' | 'vim_complete' | nil -- Preferred completion strategy for mentons and commands
---@field default_global_keymaps boolean
---@field default_mode 'build' | 'plan' | string -- Default mode
Expand Down
6 changes: 5 additions & 1 deletion lua/opencode/ui/picker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ function M.get_best_picker()
local config = require('opencode.config')

local preferred_picker = config.preferred_picker
if preferred_picker and preferred_picker ~= '' then
if preferred_picker and type(preferred_picker) == 'string' and preferred_picker ~= '' then
if preferred_picker == 'select' then
return nil
end

return preferred_picker
end

Expand Down
12 changes: 5 additions & 7 deletions lua/opencode/ui/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,12 @@ function M.select_session(sessions, cb)
vim.ui.select(sessions, {
prompt = '',
format_item = function(session)
local parts = { { session.id } }
local parts = {}

if session.description then
table.insert(parts, session.description)
end

if session.message_count then
table.insert(parts, session.message_count .. ' messages')
if session.title then
table.insert(parts, session.title)
else
table.insert(parts, session.id)
end

local modified = util.format_time(session.modified)
Expand Down