Skip to content

Commit 478b39f

Browse files
committed
Revert "feat(output): add fold support for tool output (sudo-tee#367)"
This reverts commit 5e45018.
1 parent 2076f52 commit 478b39f

22 files changed

Lines changed: 55 additions & 367 deletions

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ jobs:
1414
name: lint
1515
steps:
1616
- uses: actions/checkout@v4
17+
1718
- uses: JohnnyMorganz/stylua-action@v4
1819
with:
19-
version: latest
2020
token: ${{ secrets.GITHUB_TOKEN }}
21+
version: latest
2122
args: --check . -g '*.lua' -g '!deps/'
2223

2324
test:

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,6 @@ require('opencode').setup({
240240
tools = {
241241
show_output = true, -- Show tools output [diffs, cmd output, etc.] (default: true)
242242
show_reasoning_output = true, -- Show reasoning/thinking steps output (default: true)
243-
use_folds = true, -- Use folds for tool output (default: true)
244-
folding_threshold = 5, -- Number of lines to show before folding when show_output is true (default: 5)
245243
},
246244
rendering = {
247245
markdown_debounce_ms = 250, -- Debounce time for markdown rendering on new data (default: 250ms)

lua/opencode/config.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@ M.defaults = {
163163
tools = {
164164
show_output = true,
165165
show_reasoning_output = true,
166-
use_folds = true,
167-
folding_threshold = 20,
168166
},
169-
170167
max_messages = nil,
171168
always_scroll_to_bottom = false,
172169
},

lua/opencode/types.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242
---@field event_collapsing boolean
243243

244244
---@class OpencodeUIOutputConfig
245-
---@field tools { show_output: boolean, show_reasoning_output: boolean, use_folds: boolean, folding_threshold: number }
245+
---@field tools { show_output: boolean, show_reasoning_output: boolean }
246246
---@field rendering OpencodeUIOutputRenderingConfig
247247
---@field max_messages integer|nil
248248
---@field always_scroll_to_bottom boolean

lua/opencode/ui/formatter.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,10 @@ function M._format_reasoning(output, part)
3535

3636
format_utils.format_action(output, icons.get('reasoning'), title, '')
3737

38-
local show = config.ui.output.tools.show_reasoning_output
39-
local use_folds = config.ui.output.tools.use_folds
40-
if (show or use_folds) and text ~= '' then
38+
if config.ui.output.tools.show_reasoning_output and text ~= '' then
4139
output:add_empty_line()
4240
output:add_lines(vim.split(text, '\n'))
4341
output:add_empty_line()
44-
output:add_fold_with_threshold(start_line, show, use_folds)
4542
end
4643

4744
local end_line = output:get_line_count()

lua/opencode/ui/formatter/tools/apply_patch.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ function M.format(output, part)
3838
)
3939

4040
local patch = file.diff or file.patch
41-
if (config.ui.output.tools.show_output or config.ui.output.tools.use_folds) and patch then
42-
local start_line = output:get_line_count() + 1
41+
if config.ui.output.tools.show_output and patch then
4342
local file_type = file and util.get_markdown_filetype(file.filePath) or ''
4443
formatter_utils.format_diff(output, patch, file_type)
45-
output:add_fold_with_threshold(start_line, config.ui.output.tools.show_output, config.ui.output.tools.use_folds)
4644
end
4745
end
4846
end

lua/opencode/ui/formatter/tools/bash.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ function M.format(output, part)
2020
local icons = require('opencode.ui.icons')
2121
utils.format_action(output, icons.get('run'), 'run', input.description, utils.get_duration_text(part))
2222

23-
local start_line = output:get_line_count() + 1
24-
if not (config.ui.output.tools.show_output or config.ui.output.tools.use_folds) then
23+
if not config.ui.output.tools.show_output then
2524
return
2625
end
2726

@@ -30,8 +29,6 @@ function M.format(output, part)
3029
local command_output = metadata.output and metadata.output ~= '' and ('\n' .. metadata.output) or ''
3130
utils.format_code(output, vim.split('> ' .. command .. '\n' .. command_output, '\n'), 'bash')
3231
end
33-
34-
output:add_fold_with_threshold(start_line, config.ui.output.tools.show_output, config.ui.output.tools.use_folds)
3532
end
3633

3734
---@param _ OpencodeMessagePart

lua/opencode/ui/formatter/tools/file.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ function M.format(output, part)
6565
local icons = require('opencode.ui.icons')
6666
utils.format_action(output, icons.get(tool_type), tool_type, file_name, utils.get_duration_text(part))
6767

68-
local start_line = output:get_line_count() + 1
69-
if not (config.ui.output.tools.show_output or config.ui.output.tools.use_folds) then
68+
if not config.ui.output.tools.show_output then
7069
return
7170
end
7271

@@ -75,8 +74,6 @@ function M.format(output, part)
7574
elseif tool_type == 'write' and input.content then
7675
utils.format_code(output, vim.split(input.content, '\n'), file_type)
7776
end
78-
79-
output:add_fold_with_threshold(start_line, config.ui.output.tools.show_output, config.ui.output.tools.use_folds)
8077
end
8178

8279
---@param part OpencodeMessagePart

lua/opencode/ui/formatter/tools/glob.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@ function M.format(output, part)
1616

1717
local icons = require('opencode.ui.icons')
1818
utils.format_action(output, icons.get('search'), 'glob', input.pattern, utils.get_duration_text(part))
19-
20-
local start_line = output:get_line_count() + 1
21-
if not (config.ui.output.tools.show_output or config.ui.output.tools.use_folds) then
19+
if not config.ui.output.tools.show_output then
2220
return
2321
end
2422

2523
local prefix = metadata.truncated and ' more than' or ''
2624
output:add_line(string.format('Found%s `%d` file(s):', prefix, metadata.count or 0))
27-
28-
output:add_fold_with_threshold(start_line, config.ui.output.tools.show_output, config.ui.output.tools.use_folds)
2925
end
3026

3127
---@param _ OpencodeMessagePart

lua/opencode/ui/formatter/tools/grep.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,14 @@ function M.format(output, part)
5353

5454
local icons = require('opencode.ui.icons')
5555
utils.format_action(output, icons.get('search'), 'grep', resolve_grep_string(input), utils.get_duration_text(part))
56-
57-
local start_line = output:get_line_count() + 1
58-
if not (config.ui.output.tools.show_output or config.ui.output.tools.use_folds) then
56+
if not config.ui.output.tools.show_output then
5957
return
6058
end
6159

6260
local prefix = metadata.truncated and ' more than' or ''
6361
output:add_line(
6462
string.format('Found%s `%d` match' .. (metadata.matches ~= 1 and 'es' or ''), prefix, metadata.matches or 0)
6563
)
66-
67-
output:add_fold_with_threshold(start_line, config.ui.output.tools.show_output, config.ui.output.tools.use_folds)
6864
end
6965

7066
---@param _ OpencodeMessagePart

0 commit comments

Comments
 (0)