kevin-mueller / htmlcssclasscompletion Goto Github PK
View Code? Open in Web Editor NEWA Visual Studio 2022 extension, that improvies the exisiting intellisense of css classes for html-like languages.
License: MIT License
A Visual Studio 2022 extension, that improvies the exisiting intellisense of css classes for html-like languages.
License: MIT License
This is caused by the fact, that the obj
and bin
folders are scanned as well. Easy fix is to exclude those folders from scanning.
It would be great if there existed an option to disable or enable the "refresh on save for .html and .css". On large projects, every time I save, it takes a few seconds (5s to 10s) to refresh. During this time, visual studio is "froozen". By having this option, I can choose when I want to re-scan.
Otherwise, nice work!!
It haunted me for awhile but then I've looked into Event Viewer and found this:
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
at MoreLinq.MoreEnumerable+<>c__DisplayClass72_0+<<Flatten>g___|0>d.MoveNext()
at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Linq.Enumerable+WhereEnumerableIterator`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Linq.Enumerable.ToList[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at HtmlCssClassCompletion22.ElementCatalog+<>c__DisplayClass9_0+<<GetProjectPathsWithReferencesAsync>b__0>d.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
at HtmlCssClassCompletion22.ElementCatalog+<GetProjectPathsWithReferencesAsync>d__9.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
at HtmlCssClassCompletion22.ElementCatalog+<RefreshClassesAsync>d__8.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
at HtmlCssClassCompletion22.HtmlCssClassCompletion22Package+<OnAfterDocumentSaved>d__2.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
Since MoreLinq is only used by this extension I believe it's a culprit.
I noticed, after installing the extension I don't get any suggestions any more at all (not even the few measly buggy ones).
But after SCANNING I get them all. That's nice, since VS is extremely buggy and inconsistent (I get different suggestions each time I open VS and mostly BS is missing - w/o the extension).
But I noticed, when I delete a .css file, the suggestions stick - even after re-scanning. Only after closing VS, re-open and re-scan, it's correct again.
Also, when re-naming or deleting classes inside a css file, it's the same. RE-scanning w/o closing does not remove invalidated classes from the suggestion.
Getting NullReferenceException when running Tools->Scan all projects for CSS classes.
Using Visual Studio 2022, full program info:
Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.1.4
This is the exception I get:
System.NullReferenceException: Object reference not set to an instance of an object.
at HtmlCssClassCompletion22.ElementCatalog.<>c__DisplayClass9_0.<<GetProjectPathsWithReferencesAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask.<JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at HtmlCssClassCompletion22.ElementCatalog.<GetProjectPathsWithReferencesAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at HtmlCssClassCompletion22.ElementCatalog.<RefreshClassesAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at HtmlCssClassCompletion22.RefreshCssClassesCommand.<ExecuteAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Community.VisualStudio.Toolkit.BaseCommand.<>c__DisplayClass8_0.<<Execute>b__0>d.MoveNext()
Also saw other people having issues scanning:
Unfortunately, scanning isn't working either on startup or when I click
Tools -> Scan all Projects for css classes
.
I'm using VS2022 and am having Blazor app with lots of css files and it would be really appreciated if your extension worked.
Originally posted by @dev-elena in #4 (comment)
When renaming or deleting a CSS class, the suggestion stays in the cache, even if manually re-scanned.
The Tool dosnt work in my Visual Studio with Blazor Server Projects.
When I click "Scann all Projects...." nothing happend.
Using Win 11, VS v. 17.2.6
Better Razor CSS Class Intellisense V1.13
When typing the entire <class="">
attribute, the suggestion shows only the isolated classes. When setting the cursor in between of an ""
of an existing <class="">
attribute, all suggestion (including the isolated ones) are shown.
I have recently started working with Tailwind and thought it would be useful to have an extension that could display the various class names and a short description of their functionality. Does your extension override the default one used in VS2022, or could you have multiple extensions which display CSS classes from various sources?
Yours is the only example I've found that shows how to build an extension of this sort; kudos on the work you've done.
When working with about ~900 css files there is a short freeze of the vs window. Weird, because everything should execute asynchronous in the background.
The current tooltip for the css class display all the files, in which the class was found. If it's from a external file, the entire url is shown. At least remove the https:// part.
Hi,
I'm currently having a strange behavior if the extension is active, and I want to debug an application.
When debugging a Blazor Server application in Visual Studio 2022, Visual Studio crashes and restarts every time I update a CSS class.
After disabling the extension, changing a CSS class updates the application, which is the expected behavior.
I'm currently using Visual Studio 17.2.6. Hot reload is also activated
Great work, just one problem I had a structure for my project with a LIB solution folder and I place all my RCL there, it wasn't until I moved the RCL to the solution itself and deleted the solution folder that the extension worked and I could see the RCL classes.
First, thank you so much for trying to tackle this problem of CSS intellisense in Blazor. I installed the extension, rebooted the computer. The css intellisense isn't showing. I tried copying a bootstrap.css file directly into wwwroot and it doesn't load. Once I saw a background task message that said something like 9,700 classes were found. Subsequent executions of the "Scan all Projects for CSS Classes" causes the background task to flicker but not actually run and no results are shown in the background task status message. I even tried deleting the .vs folder with no luck.
This is a NET6 Blazor Server project using the extensions installed from the Visual Studio Marketplace (1.14.1). Other text processor extensions (like rainbow braces and file icons) are working just fine as is intellisense for everything but css.
Is there any way to force the scan to actually run or verify that it ran?
This screenshot shows a css file that should be picked up:
When writing CSS for Blazor CSS Isolation there is no Intellisense for CSS Variables declared in outside CSS Files. For example, I have my global style colors defined in variables under :root stored under a wwwroot folder within a Razor Class Library. I have the stylesheet linked in my index.html file as usual. However, when declaring colors with var(). There is no Intellisense. I would love to see a feature that searches the entire project for CSS variables and cache them for use in CSS isolation files.
F12 jumps to declarations in other parts of VS, but not for CSS classes. Seems like this extension may have an opportunity to support that for CSS class definitions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.