Change:
Testing I ran the following command which is a powershell command that spans 8 lines. In this case sticky scroll can fill the entire terminal. One thing we do for sticky scroll in the tree is we allow sticky scroll to take a maximum of 40% of the view height. If the widget takes more than 40% of the height, we start dropping some of the sticky lines. In that case you could possibly have a at the end of the last line to indicate to the user that there is more to the command than can be shown. powershell command: (is new line) used setting !
I was a little torn on this, I was thinking if a user says they want 10 lines then maybe we should respect that (up a maximum of rows - 1 which isn't the case now). I see there is some logic here in the editor: ! Though it only updates on scroll, not resize: ! Do you also use a max of 40% there?
Your case might be a bit different to the tree. Trees appear in many different locations. One tree might fill the entire height of the editor in one view and another tree view might be much smaller. This would lead the user to have a large max sticky item value to be able to see many nodes in the large tree but he would probably not want it to fill the entire view in the smaller tree view cases. This is maybe a bit different to the terminal where a users usually only has one terminal. I think you should at least guarantee that one line of the terminal is visible.
Hey we do not have such a logic in the editor sticky scroll although it is a very interesting idea and it may be worthwhile to look into it.

Discussion:
// scope: ConfigurationScope.APPLICATION }, [TerminalSettingId.StickyScrollMaxLineCount]: { <del> markdownDescription: localize('terminal.integrated.stickyScroll.maxLineCount', "Defines the maximum number of sticky lines to show."), </del> <ins> markdownDescription: localize('terminal.integrated.stickyScroll.maxLineCount', "Defines the maximum number of sticky lines to show. Sticky scroll lines will never exceed 40% of the viewport regardless of this setting."), </ins> type: 'number', default: 5, minimum: 1,

Visible = 'visible' } <ins> const enum Constants { StickyScrollPercentageCap = 0.4 } </ins> export class TerminalStickyScrollOverlay extends Disposable { private _stickyScrollOverlay?: RawXtermTerminal; private _serializeAddon?: SerializeAddonType;

private _refreshListeners = this._register(new MutableDisposable()); private _state: OverlayState = OverlayState.Off; <del> private _maxLineCount: number = 5; </del> <ins> private _rawMaxLineCount: number = 5; </ins> constructor( private readonly _instance: ITerminalInstance,

// React to configuration changes this._register(Event.runAndSubscribe(configurationService.onDidChangeConfiguration, e => { if (!e || e.affectsConfiguration(TerminalSettingId.StickyScrollMaxLineCount)) { <del> this._maxLineCount = configurationService.getValue(TerminalSettingId.StickyScrollMaxLineCount); </del> <ins> this._rawMaxLineCount = configurationService.getValue(TerminalSettingId.StickyScrollMaxLineCount); </ins> } }));

// partial line can be drawn on the top. const isPartialCommand = !('getOutput' in command); const rowOffset = !isPartialCommand && command.endMarker ? Math.max(buffer.viewportY - command.endMarker.line + 1, 0) : 0; <del> const stickyScrollLineCount = Math.min(promptRowCount + commandRowCount - 1, this._maxLineCount) - rowOffset; </del> <ins> const maxLineCount = Math.min(this._rawMaxLineCount, Math.floor(xterm.rows * Constants.StickyScrollPercentageCap)); const stickyScrollLineCount = Math.min(promptRowCount + commandRowCount - 1, maxLineCount) - rowOffset; </ins> // Hide sticky scroll if it's currently on a line that contains it if (buffer.viewportY === stickyScrollLineStart) {