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

Object reference not set to an instance of an object in .NET 7 Blazor WASM + IntelliSense doesn't work #14

Closed czerwonogrodzki closed 1 year ago

czerwonogrodzki commented 1 year ago

Visual Studio Community 17.7.1

Tailwind CSS VS2022 Editor Support 1.1.7.6

Tailwind 3.3.3

Node v18.16.0

Npm 9.8.1

tailwind.config.js

/** @type {import('tailwindcss').Config} */
module.exports = {
    content: [ "./Components/**/*.{razor, html, cshtml}",
               "./Shared/**/*.{razor, html, cshtml}",
               "./Pages/**/*.{razor, html, cshtml}",
               "./wwwroot/index.html" ],
  theme: {
    extend: {},
  },
  plugins: [],
}

Build proccess started in Build tab in VS. Output from Build doesn't show any errors

czerwonogrodzki commented 1 year ago

Regarding 2 issue - from what I see NRE is happening in RazorCompletionController.cs, line 245

if (!_currentSession.SelectedCompletionSet.SelectionStatus.IsSelected && !force)

_currentSession is not null, SelectedCompletionSet is null, CompletionSets throws exception twvsexception

theron-wang commented 1 year ago

Thank you for providing the information, it was very helpful for me to fix the bug. Unfortunately, I don't have much time to test right now, but since I will be unavailable for much of the day, I added null checks for the code that you mentioned. I tested it briefly and it worked, so if you have time, please let me know if it works.

Thanks!

czerwonogrodzki commented 1 year ago

Looks like 2nd issue is resolved, 1st still occurs, no TW classes in IS

I've also noticed weird behaviour. I've correctly set up my input/output files, ran Tailwind build process, everything works. However, after restarting VS for some reason build process doesn't seem to pick up my output correctly and will generate *nameofmyinputclass*.output.css in the same directory as my input class. tailwind.extensions.json doesn't change after VS restart

Found a quick fix tho - right click on your output class, remove it as an output file and add it again as an output file

theron-wang commented 1 year ago

Okay, thanks for letting me know. I’ll write a proper fix as soon as I can.

On Sat, Aug 19, 2023 at 11:00 AM czerwonogrodzki @.***> wrote:

Looks like 2nd issue is resolved, 1st still occurs, no TW classes in IS

I've also noticed weird behaviour. I've correctly set up my input/output files, ran Tailwind build process, everything works. However, after restarting VS for some reason build process doesn't seem to pick up my output correctly and will generate nameofmyinputclass.output.css in the same directory as my input class. Found a quick fix - right click on your output class, remove it as an output file and add it again as an output file

— Reply to this email directly, view it on GitHub https://github.com/theron-wang/VS2022-Editor-Support-for-Tailwind-CSS/issues/14#issuecomment-1685023335, or unsubscribe https://github.com/notifications/unsubscribe-auth/APRLLK3IBABVJGXV64JWJS3XWDIHXANCNFSM6AAAAAA3WO6RJE . You are receiving this because you commented.Message ID: <theron-wang/VS2022-Editor-Support-for-Tailwind-CSS/issues/14/1685023335@ github.com>

theron-wang commented 1 year ago

If your issue with IntelliSense was that the menu showed up, but the classes did not update as you typed (only options were things like hover: or active:), then I have found a fix for that (update not published yet).

As for your issue regarding the output file, can I have some more information? For example, when your build process is building to *nameofmyinputclass*.output.css instead of your specified file, is the OutputCssFile property in the tailwind.extension.json null, or is the path correct? Also, I am having trouble reproducing this issue - if you could provide some steps for me to follow, I would really appreciate that.

czerwonogrodzki commented 1 year ago

As for your issue regarding the output file, can I have some more information? For example, when your build process is building to *nameofmyinputclass*.output.css instead of your specified file, is the OutputCssFile property in the tailwind.extension.json null, or is the path correct? Also, I am having trouble reproducing this issue - if you could provide some steps for me to follow, I would really appreciate that.

  1. Set up Tailwind in your project, select config file, input file, output file
  2. Start build process with Build -> Start TailwindCSS build process. Everything should work correctly
  3. Restart VS
  4. Start build process once again with Build -> Start TailwindCSS build process. Now, a new .css file will be generated in the same directory as input file that will be named *nameofmyinputclass*.output.css. Correct output file will NOT change at all
  5. To fix, simply remove output file from acting as an output file and add it again as an output file

From point 1 to 4 OutputCssFile in tailwind.extension.json is never edited - it has the correct path throughout the whole process

theron-wang commented 1 year ago

I still can't seem to repro this issue. I'm thinking that the extension may not be able to find the extension file; do you have multiple projects in your solution? If so, are there tailwind.extension.json files in more than 1 of them?

theron-wang commented 1 year ago

I found a typo in my code, which I fixed in 1.1.7.8. It may be related to this issue, so you can update the extension and see if it fixes that behavior.

czerwonogrodzki commented 1 year ago

Looks like intellisense is working

I still can't seem to repro this issue. I'm thinking that the extension may not be able to find the extension file; do you have multiple projects in your solution? If so, are there tailwind.extension.json files in more than 1 of them?

Just one project

theron-wang commented 1 year ago

I've reproduced similar behavior when adding a new project to a solution. I'm unsure if the fix I just published fixes your issue as well - if you encounter this again, feel free to create a new issue (since this issue is about IntelliSense rather than build behavior).