解决一处 ts 类型定义问题 (function: getUserConfigurations)
This commit is contained in:
parent
57d6be7019
commit
4c51b72892
@ -98,7 +98,7 @@ 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 disableFormatList = getUserConfigurations('disableFormat');
|
const disableFormatList = getUserConfigurations<Array<string>>('disableFormat') || [];
|
||||||
// 排除禁用的选项
|
// 排除禁用的选项
|
||||||
const enabledQuickPickSupportCases = [];
|
const enabledQuickPickSupportCases = [];
|
||||||
for (const quickPick of quickPickSupportCases) {
|
for (const quickPick of quickPickSupportCases) {
|
||||||
|
@ -44,7 +44,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
|
|
||||||
// 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 disableFormatList = getUserConfigurations('disableFormat');
|
const disableFormatList = getUserConfigurations<Array<string>>('disableFormat') || [];
|
||||||
// 更新右键菜单每一项是否展示
|
// 更新右键菜单每一项是否展示
|
||||||
for (const { settingsKey } of commands) {
|
for (const { settingsKey } of commands) {
|
||||||
vscode.commands.executeCommand('setContext', '_isHideSubMenuItem_' + settingsKey, disableFormatList.includes(settingsKey));
|
vscode.commands.executeCommand('setContext', '_isHideSubMenuItem_' + settingsKey, disableFormatList.includes(settingsKey));
|
||||||
|
@ -7,10 +7,10 @@ import vscode from 'vscode';
|
|||||||
* @returns 配置项的值
|
* @returns 配置项的值
|
||||||
* @since 2024-07-29
|
* @since 2024-07-29
|
||||||
*/
|
*/
|
||||||
function getUserConfigurations(configKey: string) {
|
function getUserConfigurations<T>(configKey: string): T | undefined {
|
||||||
const config = vscode.workspace.getConfiguration('variable-conversion');
|
const config = vscode.workspace.getConfiguration('variable-conversion');
|
||||||
|
|
||||||
const configValue = config.get(configKey);
|
const configValue = config.get<T>(configKey);
|
||||||
console.log('configValue:', configValue);
|
console.log('configValue:', configValue);
|
||||||
return configValue;
|
return configValue;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ function lazyConvert() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户配置
|
// 获取用户配置
|
||||||
const disableFormatList = getUserConfigurations('disableFormat');
|
const disableFormatList = getUserConfigurations<Array<string>>('disableFormat') || [];
|
||||||
|
|
||||||
const textList = userSelection.currentSelectionsText;
|
const textList = userSelection.currentSelectionsText;
|
||||||
// vscode.window.showInformationMessage('lazyConvert' + textList.join('\n'));
|
// vscode.window.showInformationMessage('lazyConvert' + textList.join('\n'));
|
||||||
|
Loading…
Reference in New Issue
Block a user