Skip to content

Commit 3fdb0d4

Browse files
authored
Added scm.inputMinLines configuration (microsoft#200551)
* added scm.inputMinLines * Update scm.contribution.ts Changed default to 1 per PR reject
1 parent 6115f6c commit 3fdb0d4

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/vs/workbench/contrib/scm/browser/scm.contribution.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,13 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
262262
maximum: 50,
263263
default: 10
264264
},
265+
'scm.inputMinLines': {
266+
type: 'number',
267+
markdownDescription: localize('inputMinLines', "Controls the minimum number of lines that the input will auto-grow from."),
268+
minimum: 1,
269+
maximum: 50,
270+
default: 1
271+
},
265272
'scm.alwaysShowRepositories': {
266273
type: 'boolean',
267274
markdownDescription: localize('alwaysShowRepository', "Controls whether repositories should always be visible in the Source Control view."),

src/vs/workbench/contrib/scm/browser/scmViewPane.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,8 @@ class SCMInputWidget {
22632263
}
22642264

22652265
getContentHeight(): number {
2266-
const editorContentHeight = this.inputEditor.getContentHeight();
2266+
const inputEditorMinHeight = this.getInputEditorMinHeight();
2267+
const editorContentHeight = Math.max(this.inputEditor.getContentHeight(), inputEditorMinHeight);
22672268
const editorContextHeightMax = this.getInputEditorMaxHeight();
22682269

22692270
return Math.min(editorContentHeight, editorContextHeightMax);
@@ -2408,6 +2409,11 @@ class SCMInputWidget {
24082409
return typeof inputMaxLines === 'number' ? clamp(inputMaxLines, 1, 50) : 10;
24092410
}
24102411

2412+
private getInputEditorMinLines(): number {
2413+
const inputMinLines = this.configurationService.getValue('scm.inputMinLines');
2414+
return typeof inputMinLines === 'number' ? clamp(inputMinLines, 1, 50) : 1;
2415+
}
2416+
24112417
private getInputEditorMaxHeight(): number {
24122418
const maxLines = this.getInputEditorMaxLines();
24132419
const fontSize = this.getInputEditorFontSize();
@@ -2417,6 +2423,15 @@ class SCMInputWidget {
24172423
return maxLines * lineHeight + top + bottom;
24182424
}
24192425

2426+
private getInputEditorMinHeight(): number {
2427+
const minLines = this.getInputEditorMinLines();
2428+
const fontSize = this.getInputEditorFontSize();
2429+
const lineHeight = this.computeLineHeight(fontSize);
2430+
const { top, bottom } = this.inputEditor.getOption(EditorOption.padding);
2431+
2432+
return minLines * lineHeight + top + bottom;
2433+
}
2434+
24202435
private getToolbarWidth(): number {
24212436
const showInputActionButton = this.configurationService.getValue<boolean>('scm.showInputActionButton');
24222437
if (!this.toolbar || !showInputActionButton || this.toolbar?.isEmpty() === true) {

0 commit comments

Comments
 (0)