From c19df5b00b9408ca693eca5d7a1863668cb15d5e Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Thu, 12 Dec 2024 15:24:30 -0600 Subject: [PATCH] support showIcons setting in terminal completions, simple suggest widget (#235998) support showIcons setting in terminal completions --- .../services/suggest/browser/simpleSuggestWidget.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.ts b/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.ts index 97417bed34f..6f22b0d0d77 100644 --- a/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.ts +++ b/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.ts @@ -19,6 +19,7 @@ import { localize } from '../../../../nls.js'; import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js'; import { SuggestWidgetStatus } from '../../../../editor/contrib/suggest/browser/suggestWidgetStatus.js'; import { MenuId } from '../../../../platform/actions/common/actions.js'; +import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js'; const $ = dom.$; @@ -86,7 +87,8 @@ export class SimpleSuggestWidget extends Disposable { private readonly _persistedSize: IPersistedWidgetSizeDelegate, private readonly _getFontInfo: () => ISimpleSuggestWidgetFontInfo, options: IWorkbenchSuggestWidgetOptions, - @IInstantiationService instantiationService: IInstantiationService + @IInstantiationService instantiationService: IInstantiationService, + @IConfigurationService configurationService: IConfigurationService, ) { super(); @@ -141,6 +143,9 @@ export class SimpleSuggestWidget extends Disposable { state = undefined; })); + const applyIconStyle = () => this.element.domNode.classList.toggle('no-icons', !configurationService.getValue('editor.suggest.showIcons')); + applyIconStyle(); + const renderer = new SimpleSuggestWidgetItemRenderer(_getFontInfo); this._register(renderer); this._listElement = dom.append(this.element.domNode, $('.tree')); @@ -196,6 +201,11 @@ export class SimpleSuggestWidget extends Disposable { this._register(this._list.onMouseDown(e => this._onListMouseDownOrTap(e))); this._register(this._list.onTap(e => this._onListMouseDownOrTap(e))); this._register(this._list.onDidChangeSelection(e => this._onListSelection(e))); + this._register(configurationService.onDidChangeConfiguration(e => { + if (e.affectsConfiguration('editor.suggest.showIcons')) { + applyIconStyle(); + } + })); } private _cursorPosition?: { top: number; left: number; height: number };