define symbol highlight colors which default to range highlight colors, #84553

This commit is contained in:
Johannes Rieken
2019-11-18 16:54:55 +01:00
parent 3b17b79438
commit dcf4572abd
3 changed files with 14 additions and 2 deletions

View File

@@ -15,6 +15,8 @@ export const editorLineHighlight = registerColor('editor.lineHighlightBackground
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.'));
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);
export const editorRangeHighlightBorder = registerColor('editor.rangeHighlightBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('rangeHighlightBorder', 'Background color of the border around highlighted ranges.'), true);
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);
export const editorSymbolHighlightBorder = registerColor('editor.symbolHighlightBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('symbolHighlightBorder', 'Background color of the border around highlighted symbols.'), true);
export const editorCursorForeground = registerColor('editorCursor.foreground', { dark: '#AEAFAD', light: Color.black, hc: Color.white }, nls.localize('caret', 'Color of the editor cursor.'));
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) => {
collector.addRule(`.monaco-editor .rangeHighlight { border: 1px ${theme.type === 'hc' ? 'dotted' : 'solid'} ${rangeHighlightBorder}; }`);
}
const symbolHighlight = theme.getColor(editorSymbolHighlight);
if (symbolHighlight) {
collector.addRule(`.monaco-editor .symbolHighlight { background-color: ${symbolHighlight}; }`);
}
const symbolHighlightBorder = theme.getColor(editorSymbolHighlightBorder);
if (symbolHighlightBorder) {
collector.addRule(`.monaco-editor .symbolHighlight { border: 1px ${theme.type === 'hc' ? 'dotted' : 'solid'} ${symbolHighlightBorder}; }`);
}
const invisibles = theme.getColor(editorWhitespaces);
if (invisibles) {
collector.addRule(`.vs-whitespace { color: ${invisibles} !important; }`);

View File

@@ -160,7 +160,7 @@ abstract class SymbolNavigationAction extends EditorAction {
if (highlight) {
const modelNow = targetEditor.getModel();
const ids = targetEditor.deltaDecorations([], [{ range, options: { className: 'rangeHighlight' } }]);
const ids = targetEditor.deltaDecorations([], [{ range, options: { className: 'symbolHighlight' } }]);
setTimeout(() => {
if (targetEditor.getModel() === modelNow) {
targetEditor.deltaDecorations(ids, []);

View File

@@ -140,7 +140,7 @@ export class OutlineNavigation implements IEditorContribution {
const ids = this._editor.deltaDecorations([], [{
range: element.symbol.selectionRange,
options: {
className: 'rangeHighlight',
className: 'symbolHighlight',
}
}]);
setTimeout(() => {