Skip to content

Commit dcf4572

Browse files
committed
define symbol highlight colors which default to range highlight colors, microsoft#84553
1 parent 3b17b79 commit dcf4572

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/vs/editor/common/view/editorColorRegistry.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export const editorLineHighlight = registerColor('editor.lineHighlightBackground
1515
export const editorLineHighlightBorder = registerColor('editor.lineHighlightBorder', { dark: '#282828', light: '#eeeeee', hc: '#f38518' }, nls.localize('lineHighlightBorderBox', 'Background color for the border around the line at the cursor position.'));
1616
export const editorRangeHighlight = registerColor('editor.rangeHighlightBackground', { dark: '#ffffff0b', light: '#fdff0033', hc: null }, nls.localize('rangeHighlight', 'Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations.'), true);
1717
export const editorRangeHighlightBorder = registerColor('editor.rangeHighlightBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('rangeHighlightBorder', 'Background color of the border around highlighted ranges.'), true);
18+
export const editorSymbolHighlight = registerColor('editor.symbolHighlightBackground', { dark: editorRangeHighlight, light: editorRangeHighlight, hc: null }, nls.localize('symbolHighlight', 'Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations.'), true);
19+
export const editorSymbolHighlightBorder = registerColor('editor.symbolHighlightBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('symbolHighlightBorder', 'Background color of the border around highlighted symbols.'), true);
1820

1921
export const editorCursorForeground = registerColor('editorCursor.foreground', { dark: '#AEAFAD', light: Color.black, hc: Color.white }, nls.localize('caret', 'Color of the editor cursor.'));
2022
export const editorCursorBackground = registerColor('editorCursor.background', null, nls.localize('editorCursorBackground', 'The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.'));
@@ -73,6 +75,16 @@ registerThemingParticipant((theme, collector) => {
7375
collector.addRule(`.monaco-editor .rangeHighlight { border: 1px ${theme.type === 'hc' ? 'dotted' : 'solid'} ${rangeHighlightBorder}; }`);
7476
}
7577

78+
const symbolHighlight = theme.getColor(editorSymbolHighlight);
79+
if (symbolHighlight) {
80+
collector.addRule(`.monaco-editor .symbolHighlight { background-color: ${symbolHighlight}; }`);
81+
}
82+
83+
const symbolHighlightBorder = theme.getColor(editorSymbolHighlightBorder);
84+
if (symbolHighlightBorder) {
85+
collector.addRule(`.monaco-editor .symbolHighlight { border: 1px ${theme.type === 'hc' ? 'dotted' : 'solid'} ${symbolHighlightBorder}; }`);
86+
}
87+
7688
const invisibles = theme.getColor(editorWhitespaces);
7789
if (invisibles) {
7890
collector.addRule(`.vs-whitespace { color: ${invisibles} !important; }`);

src/vs/editor/contrib/gotoSymbol/goToCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ abstract class SymbolNavigationAction extends EditorAction {
160160

161161
if (highlight) {
162162
const modelNow = targetEditor.getModel();
163-
const ids = targetEditor.deltaDecorations([], [{ range, options: { className: 'rangeHighlight' } }]);
163+
const ids = targetEditor.deltaDecorations([], [{ range, options: { className: 'symbolHighlight' } }]);
164164
setTimeout(() => {
165165
if (targetEditor.getModel() === modelNow) {
166166
targetEditor.deltaDecorations(ids, []);

src/vs/workbench/contrib/outline/browser/outlineNavigation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class OutlineNavigation implements IEditorContribution {
140140
const ids = this._editor.deltaDecorations([], [{
141141
range: element.symbol.selectionRange,
142142
options: {
143-
className: 'rangeHighlight',
143+
className: 'symbolHighlight',
144144
}
145145
}]);
146146
setTimeout(() => {

0 commit comments

Comments
 (0)