The existing HTML/Razor intellisense for Visual Studio has a lot of limitations. It only works if your project is a web-based project, and does not support razor class libraries. It only scans for .css files in the wwwroot directory, and it doesn't support anything fancy like the relatively new isolated CSS feature for razor components.
This extension fixes all that, by improving the existing HTML intellisense with the following features:
- Works in any project type.
- Scans CSS files in the entire project structure, including referenced projects, as well as nuget packages.
- External CSS files, which are linked via the <link> attribute in any .html/.cshtml file, will be scanned as well.
- Isolated CSS support. CSS classes from *.razor.css files, will only be shown in the corresponding *.razor component.
Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=KevinMueller.HtmlCssClassCompletion22
After installing, the extension should scan for .css files automatically once all projects and the extension are fully loaded. You can see the progress in the bottom left corner.
If you add new css files, you can re-scan all files by using Tools -> Scan all Projects for CSS Classes.
The scanning also happens automatically every time you save a .css or .html file. This behavior can be turned off in the options under Tools -> Options -> Better Razor Css Class Intellisense.
You should now be able to use the intellisense:
Feel free to create an issue in this repo. :)