A VS Code extension that helps protect sensitive information in your code by making specific sections masked. When someone tries to copy marked sections, they are automatically replaced with configurable placeholder text.
- 🔒 Mark specific code sections as masked
- 🔄 Automatically replaces sensitive content with customizable placeholder text
- 🎨 Visual highlighting of protected sections
- ⌨️ Convenient keyboard shortcuts
- 🛠️ Configurable replacement text and highlighting color
-
Mark Text as Masked:
- Select the sensitive text
- Use
Cmd+K Cmd+M(Mac) orCtrl+K Ctrl+M(Windows/Linux) - Or right-click and select "Mark as Masked"
-
Remove Mask:
- Select the marked text
- Use
Cmd+K Cmd+U(Mac) orCtrl+K Ctrl+U(Windows/Linux) - Or right-click and select "Remove Mask"
-
Copying Behavior:
- When copying marked text, it will be automatically replaced with your configured placeholder text
- Unmarked portions of the selection remain unchanged
You can customize the extension through VS Code settings:
mask.replacementText: Text to show when copying masked code (default: "[***]")mask.decorationColor: Background color for masked code regions (default: light red)
const config = {
apiKey: "abc123def456", // Mark this as masked
url: "https://api.example.com",
secret: "mysecret789" // Mark this as masked
};When copying the entire config object, the output will be:
const config = {
apiKey: "[API_KEY]",
url: "https://api.example.com",
secret: "[***]"
};- Open VS Code
- Press
Cmd+P(Mac) orCtrl+P(Windows/Linux) - Type
ext install mask - Press Enter
- VS Code version 1.96.0 or higher
This extension contributes the following settings:
mask.replacementText: Text to show when copying masked codemask.decorationColor: Background color for masked code regions
Please report issues on our GitHub repository.
Initial release of Mask:
- Basic functionality for marking text as masked
- Custom replacement text support
- Visual highlighting
- Keyboard shortcuts
Contributions are welcome! Please feel free to submit a Pull Request.
This extension is licensed under the MIT License.