提交 00599b2d 编写于 作者: A Alex Ross

Quick input shouldn't completely break if a ThemeIcon is provided

Part of #72489
上级 b748731f
......@@ -255,7 +255,7 @@ class QuickInput implements IQuickInput {
this.ui.leftActionBar.clear();
const leftButtons = this.buttons.filter(button => button === backButton);
this.ui.leftActionBar.push(leftButtons.map((button, index) => {
const action = new Action(`id-${index}`, '', button.iconClass || getIconClass(button.iconPath!), true, () => {
const action = new Action(`id-${index}`, '', button.iconClass || getIconClass(button.iconPath), true, () => {
this.onDidTriggerButtonEmitter.fire(button);
return Promise.resolve(null);
});
......@@ -265,7 +265,7 @@ class QuickInput implements IQuickInput {
this.ui.rightActionBar.clear();
const rightButtons = this.buttons.filter(button => button !== backButton);
this.ui.rightActionBar.push(rightButtons.map((button, index) => {
const action = new Action(`id-${index}`, '', button.iconClass || getIconClass(button.iconPath!), true, () => {
const action = new Action(`id-${index}`, '', button.iconClass || getIconClass(button.iconPath), true, () => {
this.onDidTriggerButtonEmitter.fire(button);
return Promise.resolve(null);
});
......
......@@ -11,7 +11,10 @@ import { IdGenerator } from 'vs/base/common/idGenerator';
const iconPathToClass = {};
const iconClassGenerator = new IdGenerator('quick-input-button-icon-');
export function getIconClass(iconPath: { dark: URI; light?: URI; }) {
export function getIconClass(iconPath: { dark: URI; light?: URI; } | undefined): string | undefined {
if (!iconPath) {
return undefined;
}
let iconClass: string;
const key = iconPath.dark.toString();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册