This reverts commit 7eee3e0.
Middle-out truncation is a really great feature and it should still be
implemented, however it unnecessarily interferes with #1365 because it
hooked into the low-level chunk management that comes directly from VSCE
shell integration.
The best place to hook OutputBuilder is as follows depending on the
state of terminal interaction:
1. Foreground terminals:
Cline.ts:
executeCommandTool(...) {
process.on("line", (line) => {
lines.push(line)
...
}
}
2. For background terminals: hook in at the point that getUnretrievedOutput is consumed for active or
inactive terminals in Cline.ts:getEnvironmentDetails()
Please note:
The Terminal classes are very sensitive to change, partially because of
the complicated way that shell integration works with VSCE, and
partially because of the way that Cline interacts with the Terminal*
class abstractions that make VSCE shell integration easier to work with.
At the point that PR#1365 is merged, it is unlikely that any Terminal*
classes will need to be modified substantially. Generally speaking, we
should think of this is a stable interface and minimize changes.
Reverts: #1390
Context
If the terminal output from a command exceeds 100KB then remove the middle of the output and just return the first 50KB and last 50KB. The 100KB limit is configurable:
Before:
3-million-hello-worlds-before.mp4
After:
3-million-hello-worlds-after.mp4
Implementation
We now have an
OutputBuilderobject that you can append text to and it will maintain two buffers if themaxSizeis exceeded. It also supports cursor-based reads from the buffer so we can properly implementgetUnretrievedOutput.How to Test
Get in Touch
Important
Adds
OutputBuilderfor smart truncation of terminal output, updates settings for output limit, and includes comprehensive tests.OutputBuilderclass inOutputBuilder.tsfor smart truncation of terminal output, preserving start and end.truncateOutputwithOutputBuilderinCline.tsandTerminalManager.ts.TERMINAL_OUTPUT_LIMITconstant interminal.ts.terminalOutputLimitsetting inExtensionStateContext.tsx,AdvancedSettings.tsx, andSettingsView.tsx.WebviewMessage.tsandExtensionMessage.tsto handleterminalOutputLimit.OutputBuilderinOutputBuilder.test.ts.TerminalProcess.test.tsandmergePromise.test.tsto reflect new behavior.truncateOutputfromextract-text.tsand related tests.This description was created by
for 7eee3e0. It will automatically update as commits are pushed.