fix: 修复 README 及代码中的拼写错误
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
[Marketplace](https://marketplace.visualstudio.com/items?itemName=coder-xiaomo.variable-conversion) [GitHub](https://github.com/coder-xiaomo/variable-conversion-vscode-extension.git) [Gitee](https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension.git)
|
||||
|
||||
一个强大的变量命名及路径风格转换插件,支持一键转换、循环转换,支持右键菜单、快捷键、状态栏等多种方式使用。<br>
|
||||
A powerful variable and path conversion extension. Supports one-key conversion & cyclic conversion. You can use it through the editer menu, shortcut keys and status bar.
|
||||
A powerful variable and path conversion extension. Supports one-key conversion & cyclic conversion. You can use it through the editor menu, shortcut keys and status bar.
|
||||
|
||||
> **【近期更新】**
|
||||
>
|
||||
@@ -126,7 +126,7 @@ Or right-click on the selected text -> Convert string to...
|
||||
|
||||
现已支持的路径风格:
|
||||
|
||||
| 路径风格 | Sttyle | 举例 e.g. |
|
||||
| 路径风格 | Style | 举例 e.g. |
|
||||
| ------------ | ------------- | ---------------------------------------------- |
|
||||
| Windows 风格 | Windows Style | `C:\Windows\System32` <br />`.\public\assets\` |
|
||||
| Unix 风格 | Unix Style | `/usr/bin`<br />`./public/assets/` |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 插件 id 及名称
|
||||
"name": "variable-conversion",
|
||||
"displayName": "Variable Conversion",
|
||||
"description": "一个强大的变量名转换插件,支持右键菜单、快捷键、状态栏等多种方式使用,支持小驼峰、大驼峰(帕斯卡)、下划线(蛇形)、中划线(连字符/脊柱式)、空格分隔、点分隔、全小写、全大写等常用命名方式(及组合)转换。 \nA powerful variable naming conversion extension. You can use it through the editer menu, shortcut keys and bottom bar. Support camel, pascal, snake, kebab(spinal), space, dot, lower, upper case, and more.",
|
||||
"description": "一个强大的变量名转换插件,支持右键菜单、快捷键、状态栏等多种方式使用,支持小驼峰、大驼峰(帕斯卡)、下划线(蛇形)、中划线(连字符/脊柱式)、空格分隔、点分隔、全小写、全大写等常用命名方式(及组合)转换。 \nA powerful variable naming conversion extension. You can use it through the editor menu, shortcut keys and bottom bar. Support camel, pascal, snake, kebab(spinal), space, dot, lower, upper case, and more.",
|
||||
// 版本号
|
||||
"version": "2.1.0",
|
||||
// logo
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "variable-conversion",
|
||||
"displayName": "Variable Conversion",
|
||||
"description": "一个强大的变量名转换插件,支持右键菜单、快捷键、状态栏等多种方式使用,支持小驼峰、大驼峰(帕斯卡)、下划线(蛇形)、中划线(连字符/脊柱式)、空格分隔、点分隔、全小写、全大写等常用命名方式(及组合)转换。 \nA powerful variable naming conversion extension. You can use it through the editer menu, shortcut keys and bottom bar. Support camel, pascal, snake, kebab(spinal), space, dot, lower, upper case, and more.",
|
||||
"description": "一个强大的变量名转换插件,支持右键菜单、快捷键、状态栏等多种方式使用,支持小驼峰、大驼峰(帕斯卡)、下划线(蛇形)、中划线(连字符/脊柱式)、空格分隔、点分隔、全小写、全大写等常用命名方式(及组合)转换。 \nA powerful variable naming conversion extension. You can use it through the editor menu, shortcut keys and bottom bar. Support camel, pascal, snake, kebab(spinal), space, dot, lower, upper case, and more.",
|
||||
"version": "2.1.0",
|
||||
"icon": "image/logo.png",
|
||||
"publisher": "coder-xiaomo",
|
||||
|
||||
@@ -12,20 +12,20 @@ const DOUBLE_RIGHT_SLASH = '\\\\';
|
||||
export function pathConversion(targetPathType: SupportPathFormat, input: string, eol: EOL, cutText: Array<TransformTextResult> | undefined = undefined): string {
|
||||
let resultPath;
|
||||
|
||||
let isSeperator = false;
|
||||
let isSeparator = false;
|
||||
switch (targetPathType) {
|
||||
case SupportPathFormat.Windows:
|
||||
// 将其中的 / 替换为 \
|
||||
resultPath = Array.from(input).map((char: string) => {
|
||||
if (char !== LEFT_SLASH) {
|
||||
// 当前字符不是 /
|
||||
isSeperator = false;
|
||||
isSeparator = false;
|
||||
return char;
|
||||
} else {
|
||||
// 当前字符是 /
|
||||
if (!isSeperator) {
|
||||
if (!isSeparator) {
|
||||
// 上一字符不是 /
|
||||
isSeperator = true;
|
||||
isSeparator = true;
|
||||
return RIGHT_SLASH; // 替换成 \
|
||||
}
|
||||
// 上一字符是 /
|
||||
@@ -38,13 +38,13 @@ export function pathConversion(targetPathType: SupportPathFormat, input: string,
|
||||
resultPath = Array.from(input).map((char: string) => {
|
||||
if (char !== RIGHT_SLASH) {
|
||||
// 当前字符不是 \
|
||||
isSeperator = false;
|
||||
isSeparator = false;
|
||||
return char;
|
||||
} else {
|
||||
// 当前字符是 \
|
||||
if (!isSeperator) {
|
||||
if (!isSeparator) {
|
||||
// 上一字符不是 \
|
||||
isSeperator = true;
|
||||
isSeparator = true;
|
||||
return LEFT_SLASH; // 替换成 /
|
||||
}
|
||||
// 上一字符是 \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EOL } from '../../types/EOLType';
|
||||
import { SupportVariableCase } from './types/SupportVariableCaseType';
|
||||
import { TransformTextResult } from '../../types/TransformTextResultType';
|
||||
import { transformMutliLineText, transformText } from '../../utils/transform';
|
||||
import { transformMultiLineText } from '../../utils/transform';
|
||||
|
||||
/**
|
||||
* 统一文本转换函数
|
||||
@@ -52,7 +52,7 @@ export function caseConversion(targetCase: SupportVariableCase, str: string, eol
|
||||
}
|
||||
|
||||
// Cut text 切割文本
|
||||
const results: Array<TransformTextResult> = cutText === undefined ? transformMutliLineText(str) : cutText;
|
||||
const results: Array<TransformTextResult> = cutText === undefined ? transformMultiLineText(str) : cutText;
|
||||
// console.log('results', results);
|
||||
|
||||
const transformedLines: Array<string> = [];
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as vscode from 'vscode';
|
||||
import QuickPickItemEx from "../types/QuickPickItemExType";
|
||||
import { QuickPickSupportCaseItem, quickPickSupportCases } from '../../core/path-convert/types/SupportPathFormatType';
|
||||
import { TransformTextResult } from '../../types/TransformTextResultType';
|
||||
import { transformMutliSelectionText } from '../../utils/transform';
|
||||
import { transformMultiSelectionText } from '../../utils/transform';
|
||||
import { EOL } from '../../types/EOLType';
|
||||
import { pathConversion } from '../../core/path-convert/conversion';
|
||||
import { isStringArrayEqual } from '../../utils/utils';
|
||||
@@ -23,7 +23,7 @@ interface RecommendItem {
|
||||
*/
|
||||
function generateOptionsBasedOnText(textList: string[], eol: EOL, enabledQuickPickSupportCases: Array<QuickPickSupportCaseItem>): Array<QuickPickItemEx> {
|
||||
// Cut text 切割文本
|
||||
const resultsList: Array<TransformTextResult[]> = transformMutliSelectionText(textList);
|
||||
const resultsList: Array<TransformTextResult[]> = transformMultiSelectionText(textList);
|
||||
|
||||
const mergeResultList: Array<RecommendItem> = [];
|
||||
for (const quickPick of enabledQuickPickSupportCases) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as vscode from 'vscode';
|
||||
import QuickPickItemEx from "../types/QuickPickItemExType";
|
||||
import { QuickPickSupportCaseItem, quickPickSupportCases } from '../../core/variable-convert/types/SupportVariableCaseType';
|
||||
import { TransformTextResult } from '../../types/TransformTextResultType';
|
||||
import { transformMutliSelectionText } from '../../utils/transform';
|
||||
import { transformMultiSelectionText } from '../../utils/transform';
|
||||
import { EOL } from '../../types/EOLType';
|
||||
import { caseConversion } from '../../core/variable-convert/conversion';
|
||||
import { isStringArrayEqual } from '../../utils/utils';
|
||||
@@ -21,7 +21,7 @@ interface RecommendItem {
|
||||
*/
|
||||
function generateOptionsBasedOnText(textList: string[], eol: EOL, enabledQuickPickSupportCases: Array<QuickPickSupportCaseItem>): Array<QuickPickItemEx> {
|
||||
// Cut text 切割文本
|
||||
const resultsList: Array<TransformTextResult[]> = transformMutliSelectionText(textList);
|
||||
const resultsList: Array<TransformTextResult[]> = transformMultiSelectionText(textList);
|
||||
|
||||
const mergeResultList: Array<RecommendItem> = [];
|
||||
for (const quickPick of enabledQuickPickSupportCases) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { variableConvertTestGroups } from './test-case/variable-convert-test-cas
|
||||
import { pathConvertTestGroups } from './test-case/path-convert-test-case';
|
||||
import { VariableTestCase, VariableTestCaseGroup } from './test-case/types/VariableTestCaseType';
|
||||
import { PathTestCase, PathTestCaseGroup } from './test-case/types/PathTestCaseType';
|
||||
import { transformMutliLineText, transformText } from '../utils/transform';
|
||||
import { transformMultiLineText } from '../utils/transform';
|
||||
import { caseConversion } from '../core/variable-convert/conversion';
|
||||
import { pathConversion } from '../core/path-convert/conversion';
|
||||
import { SupportVariableCase } from '../core/variable-convert/types/SupportVariableCaseType';
|
||||
@@ -49,7 +49,7 @@ suite('Extension Test: run variable convert test case', () => {
|
||||
for (const input of inputList) {
|
||||
// console.log('input', '->' + input + '<-');
|
||||
// 验证 transformText
|
||||
const transformTextResult: Array<TransformTextResult> = transformMutliLineText(input);
|
||||
const transformTextResult: Array<TransformTextResult> = transformMultiLineText(input);
|
||||
const results = transformTextResult.map(res => res.result);
|
||||
for (let index = 0; index < testCase.transformText.length; index++) {
|
||||
const correctValue = testCase.transformText[index];
|
||||
|
||||
@@ -9,8 +9,8 @@ const logDebugInfo = false;
|
||||
* @returns
|
||||
* @since 2024-04-03
|
||||
*/
|
||||
export function transformMutliSelectionText(selectionInputs: string[]): Array<TransformTextResult[]> {
|
||||
return selectionInputs.map(selectionInput => transformMutliLineText(selectionInput));
|
||||
export function transformMultiSelectionText(selectionInputs: string[]): Array<TransformTextResult[]> {
|
||||
return selectionInputs.map(selectionInput => transformMultiLineText(selectionInput));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ export function transformMutliSelectionText(selectionInputs: string[]): Array<Tr
|
||||
* @returns
|
||||
* @since 2024-04-03
|
||||
*/
|
||||
export function transformMutliLineText(multiLineInput: string): TransformTextResult[] {
|
||||
export function transformMultiLineText(multiLineInput: string): TransformTextResult[] {
|
||||
const results: TransformTextResult[] = [];
|
||||
const lines = multiLineInput.split(/\r?\n/);
|
||||
for (const line of lines) {
|
||||
|
||||
Reference in New Issue
Block a user