提交 f8789d3a 编写于 作者: A Alex

Make diff gutter decorators width configurable

上级 7f5c6fff
......@@ -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).")
}
}
});
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册