Symbol Converter
符号转换器
English / 简体中文
A VSCode extension which automatically convert symbols when entering.
在输入文本时自动转换符号的 VSCode 扩展。

Features
- Convert full-width characters to half-width characters automatically
- Customize symbol converting
- Set the filenames with and without replacement enabled
Commands
This extension provides the following commands:
Symbol Converter: Convert Whole Document: Convert all symbols in the currently opened document.
Extension Settings
This extension contributes the following settings:
symbol-converter.enabled: Enable live (on type) symbol replacement.
symbol-converter.ignore: Ignore file names for symbol replacement. The rules are the same as .gitignore. Example: ["*.md", "*.txt", "/package.json", "!README.md"]
symbol-converter.defaultRules: Default replacement rules, it is recommended to keep them unchanged. A list of {"from": <regex>, "to": <replacement symbol>}. For example, [{"from": "。(?=\\S)", "to": ". "}] means to replace 。 followed by a non-whitespace character with . . You can set multiple rules.
symbol-converter.extraRules: Additional replacement rules (can override default rules). A list of {"from": <regex>, "to": <replacement symbol>}. For example, [{"from": "。(?=\\S)", "to": ". "}] means to replace 。 followed by a non-whitespace character with . . You can set multiple rules.
Disable automatic conversion in a project
Add this setting to the project's .vscode/settings.json:
{
"symbol-converter.enabled": false
}
The change takes effect immediately, without restarting VSCode, and cancels pending automatic conversions. In a multi-folder workspace, each folder can set this independently; folder settings override workspace and user settings. To disable automatic conversion for the entire multi-folder workspace, add the same setting to the settings object in its .code-workspace file.
Re-enabling only converts new input; text entered while disabled is preserved. The Symbol Converter: Convert Whole Document command remains available while automatic conversion is disabled. Automatic conversion is enabled by default.
Install
There are three installation methods:
- Search for "Symbol Converter" in VSCode extensions and install it.
- In VSCode, use
Ctrl+Shift+P to open the Command Panel and enter ext install morningfrog.symbol-converter.
- Download the
.vsix file in the Release of the repository, then select Install from VISX in the upper right corner of the VSCode extension, and choose the downloaded .vsix file for installation.
Acknowledgments
This project was inspired by VSCode extension brand.change-symbol.
brand.change-symbol is licensed under MIT license,see LICENSE.
Release Notes
1.1.0
Major updates:
- Replacement algorithm optimized to be smarter and delayed, avoiding affecting unentered parts.
1.0.0
Major updates:
- The settings of the extension have changed significantly, please check and adjust the settings.
- The extension no longer directly replaces symbols in the entire document, but only replaces symbols in the inputted portion to avoid affecting unentered portions.
Fixes:
- Fixed issues with undo and redo.
0.0.1
Initial release of Symbol Converter.