fix: 配置项 variable-conversion.formatOrder 在转换时不生效问题
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { EOL } from "../../types/EOLType";
|
import { EOL } from "../../types/EOLType";
|
||||||
import { cyclicConvertCaseOrder } from "./types/SupportVariableCaseType";
|
import { cyclicConvertCaseOrder, settingsKeyToEnableSettingsKey } from "./types/SupportVariableCaseType";
|
||||||
import { caseConversion } from "./conversion";
|
import { caseConversion } from "./conversion";
|
||||||
import { isStringArrayEqual, stringListArrayDuplicateRemoval } from '../../utils/utils';
|
import { isStringArrayEqual, stringListArrayDuplicateRemoval } from '../../utils/utils';
|
||||||
import { getUserConfigurations } from '../../utils/user-configuration';
|
import { getUserConfigurations } from '../../utils/user-configuration';
|
||||||
@@ -79,7 +79,12 @@ function lazyConvert() {
|
|||||||
for (const cyclicConvertCase of cyclicConvertCaseOrder) {
|
for (const cyclicConvertCase of cyclicConvertCaseOrder) {
|
||||||
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
||||||
// 跳过禁用的目标格式
|
// 跳过禁用的目标格式
|
||||||
if (enabledFormats[cyclicConvertCase.settingsKey] === false) {
|
const enableSettingsKey = settingsKeyToEnableSettingsKey.get(cyclicConvertCase.settingsKey);
|
||||||
|
if (!enableSettingsKey) {
|
||||||
|
console.warn('Cannot find enableSettingsKey for settingsKey:', cyclicConvertCase.settingsKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (enabledFormats[enableSettingsKey] !== true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -417,6 +417,12 @@ export const commands: Array<Command> = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// settingsKey 到 enableSettingsKey 的映射
|
||||||
|
export const settingsKeyToEnableSettingsKey = new Map<string, string>();
|
||||||
|
commands.forEach(command => {
|
||||||
|
settingsKeyToEnableSettingsKey.set(command.settingsKey, command.enableSettingsKey);
|
||||||
|
});
|
||||||
|
|
||||||
export interface QuickPickSupportCaseItem {
|
export interface QuickPickSupportCaseItem {
|
||||||
type: SupportVariableCase,
|
type: SupportVariableCase,
|
||||||
name: string,
|
name: string,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import QuickPickItemEx from "../types/QuickPickItemExType";
|
import QuickPickItemEx from "../types/QuickPickItemExType";
|
||||||
import { QuickPickSupportCaseItem, quickPickSupportCases } from '../../core/variable-convert/types/SupportVariableCaseType';
|
import { QuickPickSupportCaseItem, quickPickSupportCases, settingsKeyToEnableSettingsKey } from '../../core/variable-convert/types/SupportVariableCaseType';
|
||||||
import { TransformTextResult } from '../../types/TransformTextResultType';
|
import { TransformTextResult } from '../../types/TransformTextResultType';
|
||||||
import { transformMultiSelectionText } from '../../utils/transform';
|
import { transformMultiSelectionText } from '../../utils/transform';
|
||||||
import { EOL } from '../../types/EOLType';
|
import { EOL } from '../../types/EOLType';
|
||||||
@@ -104,7 +104,12 @@ export function handleQuickPick() {
|
|||||||
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
||||||
const enabledQuickPickSupportCases = [];
|
const enabledQuickPickSupportCases = [];
|
||||||
for (const quickPick of quickPickSupportCases) {
|
for (const quickPick of quickPickSupportCases) {
|
||||||
if (enabledFormats[quickPick.settingsKey] === false) {
|
const enableSettingsKey = settingsKeyToEnableSettingsKey.get(quickPick.settingsKey);
|
||||||
|
if (!enableSettingsKey) {
|
||||||
|
console.warn('Cannot find enableSettingsKey for settingsKey:', quickPick.settingsKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (enabledFormats[enableSettingsKey] !== true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
enabledQuickPickSupportCases.push(quickPick);
|
enabledQuickPickSupportCases.push(quickPick);
|
||||||
|
|||||||
Reference in New Issue
Block a user