Skip to content

make maximum number of lines in debug console configurable #245915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/debug/browser/debug.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,11 @@ configurationRegistry.registerConfiguration({
description: nls.localize('debug.console.acceptSuggestionOnEnter', "Controls whether suggestions should be accepted on Enter in the Debug Console. Enter is also used to evaluate whatever is typed in the Debug Console."),
default: 'off'
},
'debug.console.maximumLines': {
type: 'number',
description: nls.localize('debug.console.maximumLines', "Controls the maximum number of lines in the Debug Console."),
default: 10000
},
'launch': {
type: 'object',
description: nls.localize({ comment: ['This is the description for a setting'], key: 'launch' }, "Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces."),
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ export interface IDebugConfiguration {
collapseIdenticalLines: boolean;
historySuggestions: boolean;
acceptSuggestionOnEnter: 'off' | 'on';
maximumLines: number;
};
focusWindowOnBreak: boolean;
focusEditorOnBreak: boolean;
Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/contrib/debug/common/replModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { IConfigurationService } from '../../../../platform/configuration/common
import { IDebugConfiguration, IDebugSession, IExpression, INestingReplElement, IReplElement, IReplElementSource, IStackFrame } from './debug.js';
import { ExpressionContainer } from './debugModel.js';

const MAX_REPL_LENGTH = 10000;
let topReplElementCounter = 0;
const getUniqueId = () => `topReplElement:${topReplElementCounter++}`;

Expand Down Expand Up @@ -343,8 +342,9 @@ export class ReplModel {
lastElement.addChild(newElement);
} else {
this.replElements.push(newElement);
if (this.replElements.length > MAX_REPL_LENGTH) {
this.replElements.splice(0, this.replElements.length - MAX_REPL_LENGTH);
const config = this.configurationService.getValue<IDebugConfiguration>('debug');
if (this.replElements.length > config.console.maximumLines) {
this.replElements.splice(0, this.replElements.length - config.console.maximumLines);
}
}
this._onDidChangeElements.fire(newElement);
Expand Down