Compare commits
	
		
			6 Commits
		
	
	
		
			1.1.0
			...
			d7aa9ac403
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d7aa9ac403 | |||
| 922407bdb6 | |||
| 4c51b72892 | |||
| 57d6be7019 | |||
| d3a4b0d79f | |||
| 66c429dd54 | 
@@ -6,8 +6,9 @@
 | 
			
		||||
A powerful variable naming conversion extension. Supports one-key conversion & cyclic conversion. You can use it through the editer menu, shortcut keys and bottom bar.
 | 
			
		||||
 | 
			
		||||
- ✅ 支持多选区 Support multi-selection
 | 
			
		||||
- ✅ 支持多窗口 (不支持子窗口状态栏) Support subwindow  (subwindow status bar are not supported)
 | 
			
		||||
- ✅ 支持多窗口 Support subwindow
 | 
			
		||||
- ✅ 支持撤回 & 重做 Support undo & redo (Ctrl + Z / Ctrl + Y)
 | 
			
		||||
- ✅ 支持禁用部分目标转换格式 Supports disabling some target conversion formats
 | 
			
		||||
 | 
			
		||||
> 🔭 Tips for Chinese users: 如果您无法看到下文图片,请[点这里](https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension/blob/main/README.md)查看
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -209,7 +209,9 @@
 | 
			
		||||
      // 编辑器右键菜单
 | 
			
		||||
      "editor/context": [
 | 
			
		||||
        {
 | 
			
		||||
          "when": "editorTextFocus",
 | 
			
		||||
          // "when": "editorTextFocus",
 | 
			
		||||
          // 2024.12.07 当未选中文字时,隐藏 [变量转换] 右键菜单
 | 
			
		||||
          "when": "editorTextFocus && _textSelectionLength >= 1",
 | 
			
		||||
          "command": "variable-conversion.convertCase",
 | 
			
		||||
          // "group": "1_modification@9"
 | 
			
		||||
          "group": "navigation@9"
 | 
			
		||||
 
 | 
			
		||||
@@ -143,7 +143,7 @@
 | 
			
		||||
    "menus": {
 | 
			
		||||
      "editor/context": [
 | 
			
		||||
        {
 | 
			
		||||
          "when": "editorTextFocus",
 | 
			
		||||
          "when": "editorTextFocus && _textSelectionLength >= 1",
 | 
			
		||||
          "command": "variable-conversion.convertCase",
 | 
			
		||||
          "group": "navigation@9"
 | 
			
		||||
        },
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import * as vscode from 'vscode';
 | 
			
		||||
import { EOL } from '../type-definition/EOLType';
 | 
			
		||||
import { caseConversion } from '../main-code/conversion';
 | 
			
		||||
import { caseConversion } from '../main-code/variable-convert/conversion';
 | 
			
		||||
import { SupportCase } from '../type-definition/SupportCaseType';
 | 
			
		||||
import { isStringArrayEqual } from '../main-code/utils';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,9 @@ import * as vscode from 'vscode';
 | 
			
		||||
import QuickPickItemEx from "../type-definition/QuickPickItemExType";
 | 
			
		||||
import { QuickPickSupportCaseItem, quickPickSupportCases } from '../type-definition/SupportCaseType';
 | 
			
		||||
import { TransformTextResult } from '../type-definition/TransformTextResultType';
 | 
			
		||||
import { transformMutliSelectionText } from '../main-code/transform';
 | 
			
		||||
import { transformMutliSelectionText } from '../main-code/variable-convert/transform';
 | 
			
		||||
import { EOL } from '../type-definition/EOLType';
 | 
			
		||||
import { caseConversion } from '../main-code/conversion';
 | 
			
		||||
import { caseConversion } from '../main-code/variable-convert/conversion';
 | 
			
		||||
import { isStringArrayEqual } from '../main-code/utils';
 | 
			
		||||
import { getUserConfigurations } from '../main-code/user-configuration';
 | 
			
		||||
 | 
			
		||||
@@ -98,7 +98,7 @@ export function handleQuickPick() {
 | 
			
		||||
 | 
			
		||||
    // 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 = [];
 | 
			
		||||
    for (const quickPick of quickPickSupportCases) {
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ import handleEditorReplace from './extension-handler/editor-submenu-handler';
 | 
			
		||||
import { handleQuickPick } from './extension-handler/quick-pick-handler';
 | 
			
		||||
import { commands } from './type-definition/SupportCaseType';
 | 
			
		||||
import { createStatusBarItem, updateStatusBarItemVisable } from './extension-handler/status-bar-handler';
 | 
			
		||||
import * as CyclicConversion from './main-code/cyclic-conversion';
 | 
			
		||||
import * as CyclicConversion from './main-code/variable-convert/cyclic-conversion';
 | 
			
		||||
import { EOL } from './type-definition/EOLType';
 | 
			
		||||
import { getUserConfigurations } from './main-code/user-configuration';
 | 
			
		||||
 | 
			
		||||
@@ -44,7 +44,7 @@ export function activate(context: vscode.ExtensionContext) {
 | 
			
		||||
 | 
			
		||||
		// 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) {
 | 
			
		||||
			vscode.commands.executeCommand('setContext', '_isHideSubMenuItem_' + settingsKey, disableFormatList.includes(settingsKey));
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,16 @@
 | 
			
		||||
const vscode = require('vscode');
 | 
			
		||||
import vscode from 'vscode';
 | 
			
		||||
 | 
			
		||||
function getUserConfigurations(configKey: string) {
 | 
			
		||||
/**
 | 
			
		||||
 * 获取用户配置项
 | 
			
		||||
 *
 | 
			
		||||
 * @param configKey 配置项的键
 | 
			
		||||
 * @returns 配置项的值
 | 
			
		||||
 * @since 2024-07-29
 | 
			
		||||
 */
 | 
			
		||||
function getUserConfigurations<T>(configKey: string): T | undefined {
 | 
			
		||||
    const config = vscode.workspace.getConfiguration('variable-conversion');
 | 
			
		||||
 | 
			
		||||
    // 获取 disableFormat 配置项
 | 
			
		||||
    const configValue = config.get(configKey);
 | 
			
		||||
    const configValue = config.get<T>(configKey);
 | 
			
		||||
    console.log('configValue:', configValue);
 | 
			
		||||
    return configValue;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,11 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 比较两个字符串数组 `Array<string>` 是否相同
 | 
			
		||||
 *
 | 
			
		||||
 * @param array1 数组1
 | 
			
		||||
 * @param array2 数组2
 | 
			
		||||
 * @returns
 | 
			
		||||
 * @since 2024-04-09
 | 
			
		||||
 */
 | 
			
		||||
export function isStringArrayEqual(array1: string[], array2: string[]) {
 | 
			
		||||
    if (array1.length !== array2.length) {
 | 
			
		||||
        return false;
 | 
			
		||||
@@ -12,6 +20,15 @@ export function isStringArrayEqual(array1: string[], array2: string[]) {
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 去除二维字符串数组中的重复数组元素
 | 
			
		||||
 *
 | 
			
		||||
 * 例如,输入 [["a", "b"], ["a", "b"], ["c", "d"]],会返回 [[ "a", "b"], ["c", "d"]],去除了重复出现的 ["a", "b"]。
 | 
			
		||||
 *
 | 
			
		||||
 * @param stringArr 要进行去重操作的二维字符串数组,即数组中每个元素又是一个字符串数组,代表一组相关的字符串元素集合。
 | 
			
		||||
 * @returns 返回一个二维字符串数组,其中已经去除了原输入二维数组中重复的元素组合,基于JSON序列化后的字符串比较来判定重复与否。
 | 
			
		||||
 * @since 2024-04-09
 | 
			
		||||
 */
 | 
			
		||||
export function stringListArrayDuplicateRemoval(stringArr: Array<string[]>): Array<string[]> {
 | 
			
		||||
    const tempArr: Array<string> = [];
 | 
			
		||||
    const newArr: Array<string[]> = [];
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { EOL } from '../type-definition/EOLType';
 | 
			
		||||
import { SupportCase } from '../type-definition/SupportCaseType';
 | 
			
		||||
import { TransformTextResult } from '../type-definition/TransformTextResultType';
 | 
			
		||||
import { EOL } from '../../type-definition/EOLType';
 | 
			
		||||
import { SupportCase } from '../../type-definition/SupportCaseType';
 | 
			
		||||
import { TransformTextResult } from '../../type-definition/TransformTextResultType';
 | 
			
		||||
import { transformMutliLineText, transformText } from './transform';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
import * as vscode from 'vscode';
 | 
			
		||||
import { EOL } from "../type-definition/EOLType";
 | 
			
		||||
import { cyclicConvertCaseOrder } from "../type-definition/SupportCaseType";
 | 
			
		||||
import { EOL } from "../../type-definition/EOLType";
 | 
			
		||||
import { cyclicConvertCaseOrder } from "../../type-definition/SupportCaseType";
 | 
			
		||||
import { caseConversion } from "./conversion";
 | 
			
		||||
import { isStringArrayEqual, stringListArrayDuplicateRemoval } from './utils';
 | 
			
		||||
import { getUserConfigurations } from './user-configuration';
 | 
			
		||||
import { isStringArrayEqual, stringListArrayDuplicateRemoval } from '../utils';
 | 
			
		||||
import { getUserConfigurations } from '../user-configuration';
 | 
			
		||||
 | 
			
		||||
interface UserSelection {
 | 
			
		||||
    currentEol: EOL
 | 
			
		||||
@@ -66,7 +66,7 @@ function lazyConvert() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 获取用户配置
 | 
			
		||||
    const disableFormatList = getUserConfigurations('disableFormat');
 | 
			
		||||
    const disableFormatList = getUserConfigurations<Array<string>>('disableFormat') || [];
 | 
			
		||||
 | 
			
		||||
    const textList = userSelection.currentSelectionsText;
 | 
			
		||||
    // vscode.window.showInformationMessage('lazyConvert' + textList.join('\n'));
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { TransformTextResult } from "../type-definition/TransformTextResultType";
 | 
			
		||||
import { TransformTextResult } from "../../type-definition/TransformTextResultType";
 | 
			
		||||
 | 
			
		||||
const logDebugInfo = false;
 | 
			
		||||
 | 
			
		||||
@@ -5,8 +5,8 @@ import * as assert from 'assert';
 | 
			
		||||
import * as vscode from 'vscode';
 | 
			
		||||
import testGroups from './test-case';
 | 
			
		||||
import { TestCase, TestCaseGroup } from '../type-definition/TestCaseType';
 | 
			
		||||
import { transformMutliLineText, transformText } from '../main-code/transform';
 | 
			
		||||
import { caseConversion } from '../main-code/conversion';
 | 
			
		||||
import { transformMutliLineText, transformText } from '../main-code/variable-convert/transform';
 | 
			
		||||
import { caseConversion } from '../main-code/variable-convert/conversion';
 | 
			
		||||
import { SupportCase } from '../type-definition/SupportCaseType';
 | 
			
		||||
import { TransformTextResult } from '../type-definition/TransformTextResultType';
 | 
			
		||||
// import * as myExtension from '../../extension';
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user