mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Merge branch 'gutter_diff_width' of https://github.com/usernamehw/vscode into usernamehw-gutter_diff_width
This commit is contained in:
commit
fcb96310ea
|
@ -1104,8 +1104,18 @@ export class DirtyDiffWorkbenchController implements ext.IWorkbenchContribution,
|
|||
@IConfigurationService private configurationService: IConfigurationService
|
||||
) {
|
||||
const onDidChangeConfiguration = filterEvent(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.diffDecorations'));
|
||||
const onDidChangeDiffWidthConfiguration = filterEvent(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.diffGutterWidth'));
|
||||
|
||||
onDidChangeConfiguration(this.onDidChangeConfiguration, this, this.disposables);
|
||||
this.onDidChangeConfiguration();
|
||||
|
||||
const diffWidthStyle = document.createElement('style');
|
||||
diffWidthStyle.className = 'diff-width-style';
|
||||
diffWidthStyle.type = 'text/css';
|
||||
document.head.appendChild(diffWidthStyle);
|
||||
|
||||
onDidChangeDiffWidthConfiguration(this.onDidChangeDiffWidthConfiguration, this);
|
||||
this.onDidChangeDiffWidthConfiguration();
|
||||
}
|
||||
|
||||
private onDidChangeConfiguration(): void {
|
||||
|
@ -1118,6 +1128,24 @@ export class DirtyDiffWorkbenchController implements ext.IWorkbenchContribution,
|
|||
}
|
||||
}
|
||||
|
||||
private onDidChangeDiffWidthConfiguration(): void {
|
||||
let width = this.configurationService.getValue<number>('scm.diffGutterWidth');
|
||||
|
||||
if (isNaN(width) || width <= 0 || width > 5) {
|
||||
width = 3;
|
||||
}
|
||||
|
||||
const diffWidthStyle = document.head.getElementsByClassName('diff-width-style')[0];
|
||||
|
||||
if (diffWidthStyle) {
|
||||
diffWidthStyle.innerHTML = `
|
||||
.monaco-editor .dirty-diff-modified,
|
||||
.monaco-editor .dirty-diff-added {
|
||||
border-left-width: ${width}px;
|
||||
}`;
|
||||
}
|
||||
}
|
||||
|
||||
private enable(): void {
|
||||
if (this.enabled) {
|
||||
this.disable();
|
||||
|
|
|
@ -79,6 +79,12 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
|
|||
enum: ['all', 'gutter', 'overview', 'none'],
|
||||
default: 'all',
|
||||
description: localize('diffDecorations', "Controls diff decorations in the editor.")
|
||||
},
|
||||
'scm.diffGutterWidth': {
|
||||
type: 'number',
|
||||
enum: [1, 2, 3, 4, 5],
|
||||
default: 3,
|
||||
description: localize('diffGutterWidth', "Controls the width(px) of diff decorations in gutter (added & modified).")
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue