1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

Optimize: 优化 QickPick 转换值展示 (trim 前后空格及换行)

This commit is contained in:
zhangbk1 2024-04-07 09:41:30 +08:00
parent 741bf562ab
commit ef42f97944
2 changed files with 10 additions and 3 deletions

View File

@ -24,6 +24,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-->
## [Unreleased]
### Changed
-- Optimize QickPick conversion value display (优化 QickPick 转换值展示)
## 1.0.6
### Added

View File

@ -55,10 +55,11 @@ function generateOptionsBasedOnText(text: string, eol: EOL): Array<QuickPickItem
if (text === recommendItem.conversionText) {
continue; // 如果转换后与转换前相同,那么跳过这一项
}
const conversionTextForDisplay = recommendItem.conversionText.trim();
let quickPickItem: QuickPickItemEx = {
label: recommendItem.conversionText.length >= QuickPickLabelMaxLength
? (recommendItem.conversionText.substring(0, QuickPickLabelMaxLength - 3) + '...')
: recommendItem.conversionText,
label: conversionTextForDisplay.length >= QuickPickLabelMaxLength
? (conversionTextForDisplay.substring(0, QuickPickLabelMaxLength - 3) + '...')
: conversionTextForDisplay,
description: `转换为 ${recommendItem.transforTo.join(' / ')}`,
detail: `关键词 ${recommendItem.keyword.join(' ')}`,
value: recommendItem.conversionText,