fix: 修复 README 及代码中的拼写错误
This commit is contained in:
@@ -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