theron-wang / VS2022-Editor-Support-for-Tailwind-CSS

Unofficial VS2022 Tailwind CSS extension for IntelliSense, linting, sorting, and more to enhance the development experience in Visual Studio 2022.
https://marketplace.visualstudio.com/items?itemName=TheronWang.TailwindCSSIntellisense
MIT License
86 stars 5 forks source link

[Feature request] Build type: Manual #49

Closed betfix closed 2 months ago

betfix commented 3 months ago

In Tools > Options > Tailwind CSS IntelliSense, there are 4 options for Build type: None, OnSave, OnBuild, Default. I'd like to have additionally Manual option, just like in Class sort.

The reason is that, in a project stage where the css is only changed occasionally, OnSave and OnBuild options generate many unnecessary tailwindcss builds, e.g. when coding razor files. It would be nice instead to use a keyboard shortcut to build the tailwindcss manually, instead of changing the Build type option from None to OnBuild and back again.

I tried to use Build > Stop Tailwindcss build process for this, but it only stops the current build process and does not work as a on/off switch.

In my case, I sometimes experience 100% processor usage for long time and the process that is responsible for this is node.exe. This happens when I have this extension turned on, because I don't use node for other things. The extension works fine, so it might be a problem with node.exe itself, I don't know. Anyway, I prefer to set the Build type to Nonewhen I do programming without changing css, just to save myself from killing the node.exe too often. But then I need to turn it back on after changing some css and then off again. That's why I'd be particularly interested in the manual build option.

theron-wang commented 2 months ago

Yes, I completely agree with your issue. I added a Manual option (and removed OnSave because it's redundant), which you can call by either clicking the menu button through the Build menu or by clicking Ctrl + 1, Ctrl + 2 (or Ctrl + 1, Ctrl + 3 for minification).

As for the node.exe process usage, does this only occur when building, or does it occur at other times as well? I just want to make sure my code is not handling any processes incorrectly.

Thank you!

betfix commented 2 months ago

I updated the extension and so far the Manual option is working very nice, thanks! This is a very helpful extension.

The 100% permanent CPU node.exe process issue was occurring when I frequently hit the Run or Debug button after small code changes while working on Blazor projects. VS 2022 re-built the project automatically. The extension was set to work OnBuild. Then I disabled the extension and issue was gone (still lot of Runs and Debugs). Then after a few days I enabled it again and the issue was back. And so forth (recently instead of disabling I used the option for build type: None). So there is a correlation between the extension working OnBuild and the issue. However other tools, like Blazor debugger, also use node. I didn't use this extension for non-Blazor projects. The issue frequency was statistically around twice a day.

theron-wang commented 2 months ago

That’s strange. For OnBuild, the extension should only create one node process which builds once without watch, so it might not be handling processes correctly when building frequently. Thank you for letting me know- I will definitely take a look into this.