SCM - enable editor option overrides for the scminput language (#201134)

This commit is contained in:
Ladislau Szomoru 2023-12-18 17:06:04 +01:00 committed by GitHub
parent d9b9968d01
commit 811fa13bbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,7 +93,7 @@ import { fillEditorsDragData } from 'vs/workbench/browser/dnd';
import { ElementsDragAndDropData } from 'vs/base/browser/ui/list/listView';
import { CodeDataTransfers } from 'vs/platform/dnd/browser/dnd';
import { FormatOnType } from 'vs/editor/contrib/format/browser/formatActions';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { EditorOption, EditorOptions, IRulerOption } from 'vs/editor/common/config/editorOptions';
import { IAsyncDataTreeViewState, ITreeCompressionDelegate } from 'vs/base/browser/ui/tree/asyncDataTree';
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity';
import { EditOperation } from 'vs/editor/common/core/editOperation';
@ -2142,7 +2142,8 @@ class SCMInputWidget {
overflowWidgetsDomNode,
formatOnType: true,
renderWhitespace: 'none',
dropIntoEditor: { enabled: true }
dropIntoEditor: { enabled: true },
...this.getInputEditorLanguageConfiguration(),
};
const codeEditorWidgetOptions: ICodeEditorWidgetOptions = {
@ -2208,7 +2209,9 @@ class SCMInputWidget {
'editor.fontFamily', // When `scm.inputFontFamily` is 'editor', we use it as an effective value
'scm.inputFontSize',
'editor.accessibilitySupport',
'editor.cursorBlinking'
'editor.cursorBlinking',
'editor.rulers',
'editor.wordWrap'
];
const onRelevantSettingChanged = Event.filter(
@ -2235,7 +2238,8 @@ class SCMInputWidget {
fontSize: fontSize,
lineHeight: lineHeight,
accessibilitySupport,
cursorBlinking
cursorBlinking,
...this.getInputEditorLanguageConfiguration()
});
this.setPlaceholderFontStyles(fontFamily, fontSize, lineHeight);
@ -2412,6 +2416,16 @@ class SCMInputWidget {
return this.configurationService.getValue<number>('scm.inputFontSize');
}
private getInputEditorLanguageConfiguration(): { rulers: (number | IRulerOption)[]; wordWrap: 'off' | 'on' | 'wordWrapColumn' | 'bounded' } {
const rulers = this.configurationService.inspect('editor.rulers', { overrideIdentifier: 'scminput' });
const wordWrap = this.configurationService.inspect('editor.wordWrap', { overrideIdentifier: 'scminput' });
return {
rulers: rulers.overrideIdentifiers?.includes('scminput') ? EditorOptions.rulers.validate(rulers.value) : [],
wordWrap: wordWrap.overrideIdentifiers?.includes('scminput') ? EditorOptions.wordWrap.validate(wordWrap) : 'on'
};
}
private getToolbarWidth(): number {
const showInputActionButton = this.configurationService.getValue<boolean>('scm.showInputActionButton');
if (!this.toolbar || !showInputActionButton || this.toolbar?.isEmpty() === true) {