Skip to content

Commit 3edd565

Browse files
committed
Add editorSuggestFocusBackground and editorSuggestForegroundColor . Fixes microsoft#25522
1 parent a3022cf commit 3edd565

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/vs/editor/contrib/suggest/browser/suggestWidget.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { alert } from 'vs/base/browser/ui/aria/aria';
2929
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
3030
import { attachListStyler } from 'vs/platform/theme/common/styler';
3131
import { IThemeService, ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
32-
import { registerColor, editorWidgetBackground, contrastBorder, listFocusBackground, activeContrastBorder, listHighlightForeground } from 'vs/platform/theme/common/colorRegistry';
32+
import { registerColor, editorWidgetBackground, contrastBorder, listFocusBackground, activeContrastBorder, listHighlightForeground, editorForeground } from 'vs/platform/theme/common/colorRegistry';
3333

3434
const sticky = false; // for development purposes
3535

@@ -49,6 +49,10 @@ interface ISuggestionTemplateData {
4949
*/
5050
export const editorSuggestWidgetBackground = registerColor('editorSuggestWidgetBackground', { dark: editorWidgetBackground, light: editorWidgetBackground, hc: editorWidgetBackground }, nls.localize('editorSuggestWidgetBackground', 'Background color of the suggest widget.'));
5151
export const editorSuggestWidgetBorder = registerColor('editorSuggestWidgetBorder', { dark: '#454545', light: '#C8C8C8', hc: contrastBorder }, nls.localize('editorSuggestWidgetBorder', 'Border color of the suggest widget.'));
52+
export const editorSuggestWidgetForeground = registerColor('editorSuggestWidgetForeground', { dark: editorForeground, light: editorForeground, hc: editorForeground }, nls.localize('editorSuggestWidgetForeground', 'Foreground color of the suggest widget.'));
53+
export const editorSuggestWidgetSelectedBackground = registerColor('editorSuggestWidgetSelectedBackground', { dark: listFocusBackground, light: listFocusBackground, hc: listFocusBackground }, nls.localize('editorSuggestWidgetSelectedBackground', 'Background color of the selected entry in the suggest widget.'));
54+
export const editorSuggestWidgetHighlightForeground = registerColor('editorSuggestWidgetHighlightForeground', { dark: listHighlightForeground, light: listHighlightForeground, hc: listHighlightForeground }, nls.localize('editorSuggestWidgetHighlightForeground', 'Color of the match highlights in the suggest widget.'));
55+
5256

5357
const colorRegExp = /^(#([\da-f]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))$/i;
5458
function matchesColor(text: string) {
@@ -383,7 +387,10 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
383387
});
384388

385389
this.toDispose = [
386-
attachListStyler(this.list, themeService, { listInactiveFocusBackground: listFocusBackground, listInactiveFocusOutline: activeContrastBorder }),
390+
attachListStyler(this.list, themeService, {
391+
listInactiveFocusBackground: editorSuggestWidgetSelectedBackground,
392+
listInactiveFocusOutline: activeContrastBorder
393+
}),
387394
themeService.onThemeChange(t => this.onThemeChange(t)),
388395
editor.onDidBlurEditorText(() => this.onEditorBlur()),
389396
this.list.onSelectionChange(e => this.onListSelection(e)),
@@ -925,8 +932,12 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
925932
}
926933

927934
registerThemingParticipant((theme, collector) => {
928-
let matchHighlight = theme.getColor(listHighlightForeground);
935+
let matchHighlight = theme.getColor(editorSuggestWidgetHighlightForeground);
929936
if (matchHighlight) {
930937
collector.addRule(`.monaco-editor.${theme.selector} .suggest-widget:not(.frozen) .monaco-highlighted-label .highlight { color: ${matchHighlight}; }`);
931938
}
939+
let foreground = theme.getColor(editorSuggestWidgetForeground);
940+
if (foreground) {
941+
collector.addRule(`.monaco-editor.${theme.selector} .suggest-widget { color: ${foreground}; }`);
942+
}
932943
});

0 commit comments

Comments
 (0)