support showIcons setting in terminal completions, simple suggest widget (#235998)

support showIcons setting in terminal completions
This commit is contained in:
Megan Rogge
2024-12-12 15:24:30 -06:00
committed by GitHub
parent 1bf794adda
commit c19df5b00b

View File

@@ -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 };