Variable Assignment Helper
A VS Code extension that helps you quickly assign expressions to variables with intelligent naming suggestions.
Features
- Automatically assigns expressions to variables with smart name suggestions
- Works with the cursor on any line containing an expression
- Maintains proper indentation
- Handles comments and whitespace intelligently
- Supports Python expressions (more languages coming soon)
Usage
- Place your cursor on a line containing an expression
- Press
Ctrl+Shift+A (Windows/Linux) or Cmd+Shift+A (Mac)
- The expression will be automatically assigned to a variable with a suggested name
Example
Before:
print(len([1, 2, 3])) # your cursor is here
After pressing Ctrl+Shift+A :
length = len([1, 2, 3])
print(length)
Smart Naming Rules
The extension suggests variable names based on common programming patterns:
- List operations →
items , list
- Dictionary operations →
dict
- Length calculations →
length
- Sum operations →
total
- And many more...
Requirements
Extension Settings
This extension contributes the following commands:
extension.smartAssign : Assign expression to variable with smart naming
Known Issues
None at the moment.
Release Notes
1.0.0
Initial release:
- Smart variable naming
- Automatic expression detection
- Proper indentation handling
- Comment and whitespace handling
| |