diff --git a/package.json b/package.json index a0b6ca3d..e10cd718 100644 --- a/package.json +++ b/package.json @@ -600,6 +600,11 @@ "type": "boolean", "default": false, "description": "默认展开期货" + }, + "leek-fund.enableHighlights": { + "type": "number", + "default": -1, + "description": "是否打开涨跌高亮(0关闭,1涨高亮,-1跌高亮)" } } }, diff --git a/src/extension.ts b/src/extension.ts index ca4426a4..bc6fddb9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -206,6 +206,8 @@ function setGlobalVariable() { globalState.labelFormat = LeekFundConfig.getConfig('leek-fund.labelFormat'); + globalState.enableHighlights = LeekFundConfig.getConfig('leek-fund.enableHighlights', -1); + globalState.immersiveBackground = LeekFundConfig.getConfig('leek-fund.immersiveBackground', true); } diff --git a/src/globalState.ts b/src/globalState.ts index 066f47d4..00fd053f 100644 --- a/src/globalState.ts +++ b/src/globalState.ts @@ -18,6 +18,7 @@ let remindSwitch = 1; // 是否打开提示 let newsIntervalTime = 20000; // 新闻刷新频率(毫秒) let newsIntervalTimer: NodeJS.Timer | any = null; // 计算器控制 let labelFormat = DEFAULT_LABEL_FORMAT; +let enableHighlights = -1; // 是否打开高亮 let aStockCount = 0; let usStockCount = 0; @@ -53,6 +54,7 @@ export default { stocksRemind, remindSwitch, labelFormat, + enableHighlights, showStockErrorInfo, immersiveBackground, isDevelopment, diff --git a/src/shared/leekTreeItem.ts b/src/shared/leekTreeItem.ts index 134bb79a..513d9a20 100644 --- a/src/shared/leekTreeItem.ts +++ b/src/shared/leekTreeItem.ts @@ -163,7 +163,14 @@ export class LeekTreeItem extends TreeItem { : `${formatTreeText(`${_percent}%`)}「${code}」`; } - this.label = grow ? { label: text, highlights: [[0, text.length]] } : text; + if (globalState.enableHighlights === 0) { + this.label = text; + } else if (globalState.enableHighlights >= 1) { + this.label = grow ? { label: text, highlights: [[0, text.length]] } : text; + } else if (globalState.enableHighlights <= -1) { + this.label = grow ? text : { label: text, highlights: [[0, text.length]] }; + } + this.id = info.id || code; if (this._itemType === TreeItemType.STOCK || this._itemType === TreeItemType.FUND) {