From 2d7f4690be4ff19a48cc74c880253b5c6ac74a9a Mon Sep 17 00:00:00 2001 From: zhangbk1 Date: Wed, 3 Apr 2024 10:02:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=8F=92=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E7=A7=B0:=20text-conversion=20->=20variable-conversion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- package-comment.jsonc | 4 +++- package-lock.json | 4 ++-- src/extension.ts | 8 ++++---- .../{text-conversion.ts => variable-conversion.ts} | 4 ++-- .../{text-transform.ts => variable-transform.ts} | 2 +- src/test/extension.test.ts | 6 +++--- ...{text-transform-type.ts => variable-transform-type.ts} | 0 8 files changed, 16 insertions(+), 14 deletions(-) rename src/main-code/{text-conversion.ts => variable-conversion.ts} (92%) rename src/main-code/{text-transform.ts => variable-transform.ts} (96%) rename src/type-definition/{text-transform-type.ts => variable-transform-type.ts} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe0514b..5de28f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -All notable changes to the "text-conversion" extension will be documented in this file. +All notable changes to the "variable-conversion" extension will be documented in this file. Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. diff --git a/package-comment.jsonc b/package-comment.jsonc index 70eab1f..fbaff06 100644 --- a/package-comment.jsonc +++ b/package-comment.jsonc @@ -106,6 +106,7 @@ // "group": "1_modification@9" // }, { + "when": "editorTextFocus && _textSelectionLength >= 1", "submenu": "extension.stringConversionMenu", // docs: https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups // "group": "1_modification@9" @@ -144,7 +145,8 @@ { "command": "extension.toCamelSnakeCase", "group": "group-extension" - }, + } + // 隐藏菜单项 // { // "command": "editor.action.transformToCamelcase", // "group": "group-vscode", diff --git a/package-lock.json b/package-lock.json index bdcabfd..a1be089 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "text-conversion", + "name": "variable-conversion", "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "text-conversion", + "name": "variable-conversion", "version": "0.0.1", "devDependencies": { "@types/mocha": "^10.0.6", diff --git a/src/extension.ts b/src/extension.ts index 9ebb3d3..1901124 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,7 +1,7 @@ // The module 'vscode' contains the VS Code extensibility API // Import the module and reference it with the alias vscode in your code below import * as vscode from 'vscode'; -import * as TextConversion from './main-code/text-conversion'; +import * as TextConversion from './main-code/variable-conversion'; import { ConvertFunction, EOL } from './type-definition/convert-function-type'; // This method is called when your extension is activated @@ -10,15 +10,15 @@ export function activate(context: vscode.ExtensionContext) { // // Use the console to output diagnostic information (console.log) and errors (console.error) // // This line of code will only be executed once when your extension is activated - // console.log('Congratulations, your extension "text-conversion" is now active!'); + // console.log('Congratulations, your extension "variable-conversion" is now active!'); // // The command has been defined in the package.json file // // Now provide the implementation of the command with registerCommand // // The commandId parameter must match the command field in package.json - // let disposable = vscode.commands.registerCommand('text-conversion.helloWorld', () => { + // let disposable = vscode.commands.registerCommand('variable-conversion.helloWorld', () => { // // The code you place here will be executed every time your command is executed // // Display a message box to the user - // vscode.window.showInformationMessage('Hello World from text-conversion!'); + // vscode.window.showInformationMessage('Hello World from variable-conversion!'); // }); // 用于判断是否展示右键菜单 diff --git a/src/main-code/text-conversion.ts b/src/main-code/variable-conversion.ts similarity index 92% rename from src/main-code/text-conversion.ts rename to src/main-code/variable-conversion.ts index 3275532..5686fac 100644 --- a/src/main-code/text-conversion.ts +++ b/src/main-code/variable-conversion.ts @@ -1,6 +1,6 @@ import { ConvertFunction, EOL } from '../type-definition/convert-function-type'; -import { TransformTextResult } from '../type-definition/text-transform-type'; -import { transformMutliLineText, transformText } from './text-transform'; +import { TransformTextResult } from '../type-definition/variable-transform-type'; +import { transformMutliLineText, transformText } from './variable-transform'; /** * 转小驼峰 to Camel Case diff --git a/src/main-code/text-transform.ts b/src/main-code/variable-transform.ts similarity index 96% rename from src/main-code/text-transform.ts rename to src/main-code/variable-transform.ts index 33b7294..d1f961e 100644 --- a/src/main-code/text-transform.ts +++ b/src/main-code/variable-transform.ts @@ -1,4 +1,4 @@ -import { TransformTextResult } from "../type-definition/text-transform-type"; +import { TransformTextResult } from "../type-definition/variable-transform-type"; const logDebugInfo = false; diff --git a/src/test/extension.test.ts b/src/test/extension.test.ts index e436e2d..1733a4b 100644 --- a/src/test/extension.test.ts +++ b/src/test/extension.test.ts @@ -5,9 +5,9 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; import testGroups from './test-case'; import { TestCase, TestCaseGroup } from '../type-definition/test-case-type'; -import { transformMutliLineText, transformText } from '../main-code/text-transform'; -import { toCamelCase, toLowerCase, toPascalCase, toUpperCase } from '../main-code/text-conversion'; -import { TransformTextResult } from '../type-definition/text-transform-type'; +import { transformMutliLineText, transformText } from '../main-code/variable-transform'; +import { toCamelCase, toLowerCase, toPascalCase, toUpperCase } from '../main-code/variable-conversion'; +import { TransformTextResult } from '../type-definition/variable-transform-type'; // import * as myExtension from '../../extension'; /* diff --git a/src/type-definition/text-transform-type.ts b/src/type-definition/variable-transform-type.ts similarity index 100% rename from src/type-definition/text-transform-type.ts rename to src/type-definition/variable-transform-type.ts