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

[Bug] No intellisense for `*.cshtml` or `*.razor`.

Closed this issue · 7 comments

I'm not getting any Tailwind CSS Intellisense for .cshtml and .razor files.

Steps to re-produce, originally using Visual Studio 2022 Enterprise, with no other extensions installed:

  1. File -> New Project -> ASP.NET Core MVC

    • .NET7
    • No Authentication
    • No HTTPS
    • No Docker Support
  2. Solution Exporer -> Right-Click on Project -> Set Up Tailwind CSS.

    • Set a valid input file.
    • Set a valid output file.
    • Build -> Start Tailwind CSS build process
  3. Solution Exporer -> Right-Click on Project -> Add Item -> NewFile.cshtml OR NewFile.razor

    • And then just add...
<p class=""></p>
  1. However, if you create NewFile.html, and do the same, you get the intellisense working fine.

With all CSS files, it works ok; .css, .scss, .less, .sss, the intellisense works fine, with just this:

* {
    @apply 
}

If Tailwind completions aren't showing up in a clean project, then this is intended behavior to prevent Tailwind completions from clogging up Intellisense in projects that do not use Tailwind.

Intellisense should show up if you add tailwind to the project (right click on the project node and click 'set up Tailwind') or if you explicitly set a configuration file (done by right clicking on a js file in the solution explorer).

I've tested this out in a new MVC project and clicking 'set up Tailwind' enables intellisense in cshtml files:

image

If you already have a file specified, and it still doesn't show up, are there any messages on the status bar or in the 'Extensions' output window?

Ahh, sorry. I did miss a step in my report. Setting up the extension is obviously needed as well. Haha. I've edited the post, with the missing step.

Working in a HTML file.

image

Not working in a Razor file.

image

Working in a CSS file.

image

Not working in a CSHTML file.

image

Which version of VS2022 are you using? Is it the latest one? I think it might be an issue with ContentType since older versions use a different one for .razor and .cshtml files.

Visual Studio 2022 Enterprise 17.6.5

Fully up to date in the Installer. It's only been installed for a month, on a clean install of Windows 11, on a brand new PC.

Unfortunately, I couldn't reproduce it on my own visual studio instance; I did modify how the completion handlers were created, though. I just released an update if you could check it out and see if the problem is still there.

This seems to be fixed now, thanks. There's a few other types of "Razor" content types that may need supporting. I really like this project, thank you.