Skip to content

Commit

Permalink
SCM - enable editor option overrides for the scminput language (#201134)
Browse files Browse the repository at this point in the history
  • Loading branch information
lszomoru authored Dec 18, 2023
1 parent d9b9968 commit 811fa13
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/vs/workbench/contrib/scm/browser/scmViewPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -2142,7 +2142,8 @@ class SCMInputWidget {
overflowWidgetsDomNode,
formatOnType: true,
renderWhitespace: 'none',
dropIntoEditor: { enabled: true }
dropIntoEditor: { enabled: true },
...this.getInputEditorLanguageConfiguration(),
};

const codeEditorWidgetOptions: ICodeEditorWidgetOptions = {
Expand Down Expand Up @@ -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(
Expand All @@ -2235,7 +2238,8 @@ class SCMInputWidget {
fontSize: fontSize,
lineHeight: lineHeight,
accessibilitySupport,
cursorBlinking
cursorBlinking,
...this.getInputEditorLanguageConfiguration()
});

this.setPlaceholderFontStyles(fontFamily, fontSize, lineHeight);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 811fa13

Please sign in to comment.