A Visual Studio Code extension that provides intelligent autocompletion for CSS custom properties (CSS variables) across your entire workspace. Get suggestions for all your CSS variables with their values and documentation while you type.
- 🎨 Auto-completion for CSS variables across your entire workspace
- 🌈 Special handling for color variables with color indicators
- 📝 Shows variable values and comments in completions
- 📍 Displays source file location for each variable
- 🔄 Real-time updates when CSS files change
- ⚡ Works in CSS, SCSS, LESS, HTML, JSX, TSX, Vue and Astro files
- Start typing
var(
in any supported file - The extension will automatically show completions for all CSS variables defined in your workspace
- Select a variable to insert it
- Hover over a variable to see its value, documentation, and source location
Example completion:
.example {
/* Start typing var( here */
color: var( /* Completions will appear */
}
- CSS (
.css
) - SCSS (
.scss
) - LESS (
.less
) - HTML (
.html
) - React (
.jsx
,.tsx
) - Astro (
.astro
) - Vue (
vue
)
The extension detects CSS variables defined in the following format:
--variable-name: value; /* Optional comment */
It automatically indexes:
- Variable name
- Value
- Inline comments
- Source file and line number
- Shows variable name and value in the completion list
- Differentiates between color and other variables
- Provides inline preview for color values
When you highlight a completion, you'll see:
--variable-name value
Along with:
- Any associated comments
- Source file location (
filename:line
)
- Automatically detects changes to CSS files
- Updates completions when variables are added, modified, or removed
- Debounced updates to prevent performance issues
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "CSVars"
- Click Install
Currently, the extension works out of the box with no configuration needed. It automatically scans all CSS, SCSS, and LESS files in your workspace for variables.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- When using completions within the same CSS file where variables are defined, VS Code's built-in completions may also appear. This is handled by filtering out current file variables to prevent duplicates.
- Initial release
- Basic CSS variable completion
- Support for multiple file types
- Real-time file watching
- Documentation view with source information
If you encounter any problems or have suggestions, please open an issue on our GitHub repository.
Enjoy! 🎨