mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
Add new colors diffEditor.insertedTextGutterBackground
and diffEditor.removedTextGutterBackground
(#66223)
This commit is contained in:
parent
71882d3c30
commit
4044ccd3df
|
@ -36,7 +36,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
import { defaultInsertColor, defaultRemoveColor, diffBorder, diffInserted, diffInsertedOutline, diffRemoved, diffRemovedOutline, scrollbarShadow, scrollbarSliderBackground, scrollbarSliderHoverBackground, scrollbarSliderActiveBackground, diffDiagonalFill } from 'vs/platform/theme/common/colorRegistry';
|
import { defaultInsertColor, defaultRemoveColor, diffBorder, diffInserted, diffInsertedOutline, diffRemoved, diffRemovedOutline, scrollbarShadow, scrollbarSliderBackground, scrollbarSliderHoverBackground, scrollbarSliderActiveBackground, diffDiagonalFill, diffInsertedGutter, diffRemovedGutter } from 'vs/platform/theme/common/colorRegistry';
|
||||||
import { IColorTheme, IThemeService, getThemeTypeSelector, registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService';
|
import { IColorTheme, IThemeService, getThemeTypeSelector, registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||||
import { IDiffLinesChange, InlineDiffMargin } from 'vs/editor/browser/widget/inlineDiffMargin';
|
import { IDiffLinesChange, InlineDiffMargin } from 'vs/editor/browser/widget/inlineDiffMargin';
|
||||||
|
@ -1746,34 +1746,34 @@ const DECORATIONS = {
|
||||||
lineInsert: ModelDecorationOptions.register({
|
lineInsert: ModelDecorationOptions.register({
|
||||||
description: 'diff-editor-line-insert',
|
description: 'diff-editor-line-insert',
|
||||||
className: 'line-insert',
|
className: 'line-insert',
|
||||||
marginClassName: 'line-insert',
|
marginClassName: 'gutter-insert',
|
||||||
isWholeLine: true
|
isWholeLine: true
|
||||||
}),
|
}),
|
||||||
lineInsertWithSign: ModelDecorationOptions.register({
|
lineInsertWithSign: ModelDecorationOptions.register({
|
||||||
description: 'diff-editor-line-insert-with-sign',
|
description: 'diff-editor-line-insert-with-sign',
|
||||||
className: 'line-insert',
|
className: 'line-insert',
|
||||||
linesDecorationsClassName: 'insert-sign ' + ThemeIcon.asClassName(diffInsertIcon),
|
linesDecorationsClassName: 'insert-sign ' + ThemeIcon.asClassName(diffInsertIcon),
|
||||||
marginClassName: 'line-insert',
|
marginClassName: 'gutter-insert',
|
||||||
isWholeLine: true
|
isWholeLine: true
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lineDelete: ModelDecorationOptions.register({
|
lineDelete: ModelDecorationOptions.register({
|
||||||
description: 'diff-editor-line-delete',
|
description: 'diff-editor-line-delete',
|
||||||
className: 'line-delete',
|
className: 'line-delete',
|
||||||
marginClassName: 'line-delete',
|
marginClassName: 'gutter-delete',
|
||||||
isWholeLine: true
|
isWholeLine: true
|
||||||
}),
|
}),
|
||||||
lineDeleteWithSign: ModelDecorationOptions.register({
|
lineDeleteWithSign: ModelDecorationOptions.register({
|
||||||
description: 'diff-editor-line-delete-with-sign',
|
description: 'diff-editor-line-delete-with-sign',
|
||||||
className: 'line-delete',
|
className: 'line-delete',
|
||||||
linesDecorationsClassName: 'delete-sign ' + ThemeIcon.asClassName(diffRemoveIcon),
|
linesDecorationsClassName: 'delete-sign ' + ThemeIcon.asClassName(diffRemoveIcon),
|
||||||
marginClassName: 'line-delete',
|
marginClassName: 'gutter-delete',
|
||||||
isWholeLine: true
|
isWholeLine: true
|
||||||
|
|
||||||
}),
|
}),
|
||||||
lineDeleteMargin: ModelDecorationOptions.register({
|
lineDeleteMargin: ModelDecorationOptions.register({
|
||||||
description: 'diff-editor-line-delete-margin',
|
description: 'diff-editor-line-delete-margin',
|
||||||
marginClassName: 'line-delete',
|
marginClassName: 'gutter-delete',
|
||||||
})
|
})
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -2369,7 +2369,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
||||||
viewLineCounts[lineIndex] = lineBreakData.breakOffsets.length;
|
viewLineCounts[lineIndex] = lineBreakData.breakOffsets.length;
|
||||||
viewZone.heightInLines += (lineBreakData.breakOffsets.length - 1);
|
viewZone.heightInLines += (lineBreakData.breakOffsets.length - 1);
|
||||||
const marginDomNode2 = document.createElement('div');
|
const marginDomNode2 = document.createElement('div');
|
||||||
marginDomNode2.className = 'line-delete';
|
marginDomNode2.className = 'gutter-delete';
|
||||||
result.original.push({
|
result.original.push({
|
||||||
afterLineNumber: lineNumber,
|
afterLineNumber: lineNumber,
|
||||||
afterColumn: 0,
|
afterColumn: 0,
|
||||||
|
@ -2549,17 +2549,25 @@ function changedDiffEditorOptions(a: ValidDiffEditorBaseOptions, b: ValidDiffEdi
|
||||||
|
|
||||||
registerThemingParticipant((theme, collector) => {
|
registerThemingParticipant((theme, collector) => {
|
||||||
const added = theme.getColor(diffInserted);
|
const added = theme.getColor(diffInserted);
|
||||||
|
const gutterAdded = theme.getColor(diffInsertedGutter) || added;
|
||||||
if (added) {
|
if (added) {
|
||||||
collector.addRule(`.monaco-editor .line-insert, .monaco-editor .char-insert { background-color: ${added}; }`);
|
collector.addRule(`.monaco-editor .line-insert, .monaco-editor .char-insert { background-color: ${added}; }`);
|
||||||
collector.addRule(`.monaco-diff-editor .line-insert, .monaco-diff-editor .char-insert { background-color: ${added}; }`);
|
collector.addRule(`.monaco-diff-editor .line-insert, .monaco-diff-editor .char-insert { background-color: ${added}; }`);
|
||||||
collector.addRule(`.monaco-editor .inline-added-margin-view-zone { background-color: ${added}; }`);
|
}
|
||||||
|
if (gutterAdded) {
|
||||||
|
collector.addRule(`.monaco-editor .inline-added-margin-view-zone { background-color: ${gutterAdded}; }`);
|
||||||
|
collector.addRule(`.monaco-editor .gutter-insert, .monaco-diff-editor .gutter-insert { background-color: ${gutterAdded}; }`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const removed = theme.getColor(diffRemoved);
|
const removed = theme.getColor(diffRemoved);
|
||||||
|
const gutterRemoved = theme.getColor(diffRemovedGutter) || removed;
|
||||||
if (removed) {
|
if (removed) {
|
||||||
collector.addRule(`.monaco-editor .line-delete, .monaco-editor .char-delete { background-color: ${removed}; }`);
|
collector.addRule(`.monaco-editor .line-delete, .monaco-editor .char-delete { background-color: ${removed}; }`);
|
||||||
collector.addRule(`.monaco-diff-editor .line-delete, .monaco-diff-editor .char-delete { background-color: ${removed}; }`);
|
collector.addRule(`.monaco-diff-editor .line-delete, .monaco-diff-editor .char-delete { background-color: ${removed}; }`);
|
||||||
collector.addRule(`.monaco-editor .inline-deleted-margin-view-zone { background-color: ${removed}; }`);
|
}
|
||||||
|
if (gutterRemoved) {
|
||||||
|
collector.addRule(`.monaco-editor .inline-deleted-margin-view-zone { background-color: ${gutterRemoved}; }`);
|
||||||
|
collector.addRule(`.monaco-editor .gutter-delete, .monaco-diff-editor .gutter-delete { background-color: ${gutterRemoved}; }`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const addedOutline = theme.getColor(diffInsertedOutline);
|
const addedOutline = theme.getColor(diffInsertedOutline);
|
||||||
|
|
|
@ -390,6 +390,9 @@ export const defaultRemoveColor = new Color(new RGBA(255, 0, 0, 0.2));
|
||||||
export const diffInserted = registerColor('diffEditor.insertedTextBackground', { dark: defaultInsertColor, light: defaultInsertColor, hc: null }, nls.localize('diffEditorInserted', 'Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations.'), true);
|
export const diffInserted = registerColor('diffEditor.insertedTextBackground', { dark: defaultInsertColor, light: defaultInsertColor, hc: null }, nls.localize('diffEditorInserted', 'Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations.'), true);
|
||||||
export const diffRemoved = registerColor('diffEditor.removedTextBackground', { dark: defaultRemoveColor, light: defaultRemoveColor, hc: null }, nls.localize('diffEditorRemoved', 'Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations.'), true);
|
export const diffRemoved = registerColor('diffEditor.removedTextBackground', { dark: defaultRemoveColor, light: defaultRemoveColor, hc: null }, nls.localize('diffEditorRemoved', 'Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations.'), true);
|
||||||
|
|
||||||
|
export const diffInsertedGutter = registerColor('diffEditor.insertedTextGutterBackground', { dark: defaultInsertColor, light: defaultInsertColor, hc: null }, nls.localize('diffEditorInsertedGutter', 'Background color for the margin where text got inserted.'), true);
|
||||||
|
export const diffRemovedGutter = registerColor('diffEditor.removedTextGutterBackground', { dark: defaultRemoveColor, light: defaultRemoveColor, hc: null }, nls.localize('diffEditorRemovedGutter', 'Background color for the margin where text got removed.'), true);
|
||||||
|
|
||||||
export const diffInsertedOutline = registerColor('diffEditor.insertedTextBorder', { dark: null, light: null, hc: '#33ff2eff' }, nls.localize('diffEditorInsertedOutline', 'Outline color for the text that got inserted.'));
|
export const diffInsertedOutline = registerColor('diffEditor.insertedTextBorder', { dark: null, light: null, hc: '#33ff2eff' }, nls.localize('diffEditorInsertedOutline', 'Outline color for the text that got inserted.'));
|
||||||
export const diffRemovedOutline = registerColor('diffEditor.removedTextBorder', { dark: null, light: null, hc: '#FF008F' }, nls.localize('diffEditorRemovedOutline', 'Outline color for text that got removed.'));
|
export const diffRemovedOutline = registerColor('diffEditor.removedTextBorder', { dark: null, light: null, hc: '#FF008F' }, nls.localize('diffEditorRemovedOutline', 'Outline color for text that got removed.'));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue