项目代码结构调整
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
				
			|||||||
import { EOL } from '../../type-definition/EOLType';
 | 
					import { EOL } from '../../type-definition/EOLType';
 | 
				
			||||||
import { SupportCase } from '../../type-definition/SupportCaseType';
 | 
					import { SupportCase } from './types/SupportCaseType';
 | 
				
			||||||
import { TransformTextResult } from '../../type-definition/TransformTextResultType';
 | 
					import { TransformTextResult } from '../../type-definition/TransformTextResultType';
 | 
				
			||||||
import { transformMutliLineText, transformText } from './transform';
 | 
					import { transformMutliLineText, transformText } from '../../utils/transform';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 统一文本转换函数
 | 
					 * 统一文本转换函数
 | 
				
			||||||
@@ -9,6 +9,7 @@ import { transformMutliLineText, transformText } from './transform';
 | 
				
			|||||||
 * @param {SupportCase} targetCase 目标文本情况
 | 
					 * @param {SupportCase} targetCase 目标文本情况
 | 
				
			||||||
 * @param {string} str 用户选择的文本 user selection
 | 
					 * @param {string} str 用户选择的文本 user selection
 | 
				
			||||||
 * @param {EOL} eol 行结束符
 | 
					 * @param {EOL} eol 行结束符
 | 
				
			||||||
 | 
					 * @param {Array<TransformTextResult>?} cutText 行结束符
 | 
				
			||||||
 * @returns 转换后的文本
 | 
					 * @returns 转换后的文本
 | 
				
			||||||
 * @since 2024-04-04
 | 
					 * @since 2024-04-04
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -1,9 +1,9 @@
 | 
				
			|||||||
import * as vscode from 'vscode';
 | 
					import * as vscode from 'vscode';
 | 
				
			||||||
import { EOL } from "../../type-definition/EOLType";
 | 
					import { EOL } from "../../type-definition/EOLType";
 | 
				
			||||||
import { cyclicConvertCaseOrder } from "../../type-definition/SupportCaseType";
 | 
					import { cyclicConvertCaseOrder } from "./types/SupportCaseType";
 | 
				
			||||||
import { caseConversion } from "./conversion";
 | 
					import { caseConversion } from "./conversion";
 | 
				
			||||||
import { isStringArrayEqual, stringListArrayDuplicateRemoval } from '../utils';
 | 
					import { isStringArrayEqual, stringListArrayDuplicateRemoval } from '../../utils/utils';
 | 
				
			||||||
import { getUserConfigurations } from '../user-configuration';
 | 
					import { getUserConfigurations } from '../../utils/user-configuration';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface UserSelection {
 | 
					interface UserSelection {
 | 
				
			||||||
    currentEol: EOL
 | 
					    currentEol: EOL
 | 
				
			||||||
@@ -4,10 +4,10 @@
 | 
				
			|||||||
 * Code:
 | 
					 * Code:
 | 
				
			||||||
 * - Add type definition in below `SupportCase` enum and following array
 | 
					 * - Add type definition in below `SupportCase` enum and following array
 | 
				
			||||||
 * - Add `commands`, `menus`, `configuration` parts in [package.json] and [package-comment.jsonc]
 | 
					 * - Add `commands`, `menus`, `configuration` parts in [package.json] and [package-comment.jsonc]
 | 
				
			||||||
 * - Add main conversion logic in [src/main-code/conversion.ts]
 | 
					 * - Add main conversion logic in [src/core/variable-convert/conversion.ts]
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Test:
 | 
					 * Test:
 | 
				
			||||||
 * - Add test case type definition in [src/type-definition/TestCaseType.ts]
 | 
					 * - Add test case type definition in [src/test/types/TestCaseType.ts]
 | 
				
			||||||
 * - Add test case in [src/test/test-case.ts]
 | 
					 * - Add test case in [src/test/test-case.ts]
 | 
				
			||||||
 * - Add test code in [src/test/extension.test.ts]
 | 
					 * - Add test code in [src/test/extension.test.ts]
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -1,13 +1,23 @@
 | 
				
			|||||||
// The module 'vscode' contains the VS Code extensibility API
 | 
					/**
 | 
				
			||||||
// Import the module and reference it with the alias vscode in your code below
 | 
					 * @file extension.ts
 | 
				
			||||||
 | 
					 * @description 该文件包含了 VS Code 插件的主要扩展逻辑,包括命令注册、菜单配置和编辑器事件监听等。
 | 
				
			||||||
 | 
					 * @author coder-xiaomo
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 * @license MIT
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 本文件是插件的核心文件,负责扩展命令的注册以及编辑器中各种事件的处理。通过监听编辑器的选择状态,
 | 
				
			||||||
 | 
					 * 动态更新命令行为。插件在启动时会初始化必要的命令,并根据编辑器状态决定是否启用相关功能。
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @see https://code.visualstudio.com/api
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
import * as vscode from 'vscode';
 | 
					import * as vscode from 'vscode';
 | 
				
			||||||
import handleEditorReplace from './extension-handler/editor-submenu-handler';
 | 
					import handleEditorReplace from './handler/editor-submenu-handler';
 | 
				
			||||||
import { handleQuickPick } from './extension-handler/quick-pick-handler';
 | 
					import { handleQuickPick } from './handler/quick-pick-handler';
 | 
				
			||||||
import { commands } from './type-definition/SupportCaseType';
 | 
					import { commands } from './core/variable-convert/types/SupportCaseType';
 | 
				
			||||||
import { createStatusBarItem, updateStatusBarItemVisable } from './extension-handler/status-bar-handler';
 | 
					import { createStatusBarItem, updateStatusBarItemVisable } from './handler/status-bar-handler';
 | 
				
			||||||
import * as CyclicConversion from './main-code/variable-convert/cyclic-conversion';
 | 
					import * as CyclicConversion from './core/variable-convert/cyclic-conversion';
 | 
				
			||||||
import { EOL } from './type-definition/EOLType';
 | 
					import { EOL } from './type-definition/EOLType';
 | 
				
			||||||
import { getUserConfigurations } from './main-code/user-configuration';
 | 
					import { getUserConfigurations } from './utils/user-configuration';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// This method is called when your extension is activated
 | 
					// This method is called when your extension is activated
 | 
				
			||||||
// Your extension is activated the very first time the command is executed
 | 
					// Your extension is activated the very first time the command is executed
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
import * as vscode from 'vscode';
 | 
					import * as vscode from 'vscode';
 | 
				
			||||||
import { EOL } from '../type-definition/EOLType';
 | 
					import { EOL } from '../type-definition/EOLType';
 | 
				
			||||||
import { caseConversion } from '../main-code/variable-convert/conversion';
 | 
					import { caseConversion } from '../core/variable-convert/conversion';
 | 
				
			||||||
import { SupportCase } from '../type-definition/SupportCaseType';
 | 
					import { SupportCase } from '../core/variable-convert/types/SupportCaseType';
 | 
				
			||||||
import { isStringArrayEqual } from '../main-code/utils';
 | 
					import { isStringArrayEqual } from '../utils/utils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 编辑器右键菜单
 | 
					 * 编辑器右键菜单
 | 
				
			||||||
@@ -1,12 +1,12 @@
 | 
				
			|||||||
import * as vscode from 'vscode';
 | 
					import * as vscode from 'vscode';
 | 
				
			||||||
import QuickPickItemEx from "../type-definition/QuickPickItemExType";
 | 
					import QuickPickItemEx from "../type-definition/QuickPickItemExType";
 | 
				
			||||||
import { QuickPickSupportCaseItem, quickPickSupportCases } from '../type-definition/SupportCaseType';
 | 
					import { QuickPickSupportCaseItem, quickPickSupportCases } from '../core/variable-convert/types/SupportCaseType';
 | 
				
			||||||
import { TransformTextResult } from '../type-definition/TransformTextResultType';
 | 
					import { TransformTextResult } from '../type-definition/TransformTextResultType';
 | 
				
			||||||
import { transformMutliSelectionText } from '../main-code/variable-convert/transform';
 | 
					import { transformMutliSelectionText } from '../utils/transform';
 | 
				
			||||||
import { EOL } from '../type-definition/EOLType';
 | 
					import { EOL } from '../type-definition/EOLType';
 | 
				
			||||||
import { caseConversion } from '../main-code/variable-convert/conversion';
 | 
					import { caseConversion } from '../core/variable-convert/conversion';
 | 
				
			||||||
import { isStringArrayEqual } from '../main-code/utils';
 | 
					import { isStringArrayEqual } from '../utils/utils';
 | 
				
			||||||
import { getUserConfigurations } from '../main-code/user-configuration';
 | 
					import { getUserConfigurations } from '../utils/user-configuration';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const QuickPickLabelMaxLength = 60;
 | 
					const QuickPickLabelMaxLength = 60;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -4,10 +4,10 @@ import * as assert from 'assert';
 | 
				
			|||||||
// as well as import your extension to test it
 | 
					// as well as import your extension to test it
 | 
				
			||||||
import * as vscode from 'vscode';
 | 
					import * as vscode from 'vscode';
 | 
				
			||||||
import testGroups from './test-case';
 | 
					import testGroups from './test-case';
 | 
				
			||||||
import { TestCase, TestCaseGroup } from '../type-definition/TestCaseType';
 | 
					import { TestCase, TestCaseGroup } from './types/TestCaseType';
 | 
				
			||||||
import { transformMutliLineText, transformText } from '../main-code/variable-convert/transform';
 | 
					import { transformMutliLineText, transformText } from '../utils/transform';
 | 
				
			||||||
import { caseConversion } from '../main-code/variable-convert/conversion';
 | 
					import { caseConversion } from '../core/variable-convert/conversion';
 | 
				
			||||||
import { SupportCase } from '../type-definition/SupportCaseType';
 | 
					import { SupportCase } from '../core/variable-convert/types/SupportCaseType';
 | 
				
			||||||
import { TransformTextResult } from '../type-definition/TransformTextResultType';
 | 
					import { TransformTextResult } from '../type-definition/TransformTextResultType';
 | 
				
			||||||
// import * as myExtension from '../../extension';
 | 
					// import * as myExtension from '../../extension';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { TestCaseGroup } from "../type-definition/TestCaseType";
 | 
					import { TestCaseGroup } from "./types/TestCaseType";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const LF = '\n';
 | 
					const LF = '\n';
 | 
				
			||||||
const CRLF = '\r\n';
 | 
					const CRLF = '\r\n';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { EOL } from "./EOLType";
 | 
					import { EOL } from "../../type-definition/EOLType";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type TestCaseGroup = {
 | 
					export type TestCaseGroup = {
 | 
				
			||||||
    group: string
 | 
					    group: string
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { TransformTextResult } from "../../type-definition/TransformTextResultType";
 | 
					import { TransformTextResult } from "../type-definition/TransformTextResultType";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const logDebugInfo = false;
 | 
					const logDebugInfo = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -11,7 +11,7 @@ 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<T>(configKey);
 | 
					    const configValue = config.get<T>(configKey);
 | 
				
			||||||
    console.log('configValue:', configValue);
 | 
					    // console.log('configValue:', configValue);
 | 
				
			||||||
    return configValue;
 | 
					    return configValue;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Reference in New Issue
	
	Block a user