Features
Insert spaces between Chinese characters and English letters, numbers, and symbols.
Due to an operational error, the original vscode-whitespace plugin was deleted.
However, it seems the plugin was soft-deleted from the marketplace, so it was renamed to Insert Whitespace and re-uploaded.
Usage
Via Command
Open the command palette with Ctrl+Shift+P and enter:
insertWhitespace.addSpaceSelection to add spaces to selected content
insertWhitespace.addSpaceWholeDocument to add spaces to the entire document
Via Menu
Right-click menu options: Whitespace: Add spaces to selected content and Whitespace: Add spaces to entire document
Via Keyboard Shortcuts
Ctrl+Shift+F to add spaces to selected content
Ctrl+Shift+G to add spaces to the entire document
Via Configuration
Add the following configuration to settings.json to automatically insert spaces when saving files:
{
"insertWhitespace.formatOnSave": true,
"insertWhitespace.formatOnSaveExt": [".js"]
}
Other Notes
Currently tested with prettier's auto-save without conflicts, but other scenarios haven't been fully tested and conflicts may exist.
Therefore, it's recommended to use this plugin primarily for formatting comments, and disable the auto-save configuration if conflicts occur.
Acknowledgements
This plugin is based on vinta/pangu.js, which automatically inserts spaces between Chinese characters and English letters, numbers, and symbols.
Code reference from halfcrazy/vscode-pangu implementation, with some version-specific modifications.