text-utils
简体中文
Introduce
Text formatting tool, right-click to select the function, the current functions are as follows:
- TODO list (shortcut key: Alt + X)
- string reverse
- string to lowercase/uppercase/titlecase
- generate ordered/unordered list
- base64 encode/decode
- AES encrypt/decrypt
- uri encode/decode
- unicode encode/decode
- hex encode/decode
- sort lines
- deduplicate
- random password(space separated string required)
- print today date
- generate UUID(v4)
You can search for Text Utils
in settings, choose whether to enable some functions, change date format
Note: Only suitable for processing small amounts of data, large amounts of data may not be effective
Example
# TODO
- [ ] hello world
- [x] good morning
# string
HelloWorld -> helloworld
helloWorld -> HELLOWORLD
hello world -> Hello World
# list
1. hello
2. world
- hello
- world
# base64
hello <-> aGVsbG8=
# AES password: world
hello <-> fa40d8662cfbd6d8ed5348561b81f2a5c7c67be5a6278c31f915759015ee62b7baac7118bd92aa496a1f64681e6c0da9
# uri
https://baike.baidu.com/item/你好/32416 <-> https://baike.baidu.com/item/%E4%BD%A0%E5%A5%BD/32416
# unicode
你好,世界 <-> \u4F60\u597D\uFF0C\u4E16\u754C
# hex
hello <-> 68656c6c6f
# sort lines
hello good
world --> hello
good morning
morning world
# deduplicate lines
world word
hello --> hello
world
hello
# random password
hello world -> h3llo*world
# date
2021/6/12
# UUID
2e58dfd9-13eb-4f81-b684-01a3fb5e24e5
How to install
How to develop
Preparing the Environment:
git clone https://github.com/qux-bbb/text-utils
cd text-utils
npm install
Create a new .ts file under the src directory to write the functional code. For examples:
src/date.ts
src/hex.ts
Import functions and add commands in extension.ts
src/extension.ts
Add command names, menu items, submenu items in package.json. If there are configurations, they can be added under the "configuration"(e.g. enable func, choose format)
package.json
Add corresponding languages in the nls (National Language Support) files. Currently, English and Simplified Chinese are supported
package.nls.json
package.nls.zh-cn.json
After development is complete, you can use vscode for debugging
If you want to publish a new version, you generally need to modify the following 5 files:
package.json
update the version
package-lock.json
update the version
CHANGELOG.md
write changes from the previous version to this version
README.md
relevant descriptions
README-zh_CN.md
relevant descriptions in Simplified Chinese
Build the vsix package
cd text-utils
npm install
npm install -g vsce
vsce package
Reference
- https://github.com/yzhang-gh/vscode-markdown
- https://github.com/microsoft/vscode-extension-samples/blob/master/document-editing-sample
- https://www.freecodecamp.org/news/three-ways-to-title-case-a-sentence-in-javascript-676a9175eb27/
- https://marketplace.visualstudio.com/items?itemName=RushFrisby.Encryptor
- https://nodejs.org/api/crypto.html
- https://attacomsian.com/blog/nodejs-encrypt-decrypt-data
- https://github.com/adamhartford/vscode-base64
- Multiple selection editing: https://github.com/microsoft/vscode/issues/5886
- Config Sample: https://github.dev/microsoft/vscode-extension-samples/tree/main/configuration-sample