Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have to restart VS Code every time I make a change to a generator or add a library #1987

Closed
astanb opened this issue Jan 19, 2024 · 15 comments
Closed
Labels
type: bug Something isn't working

Comments

@astanb
Copy link

astanb commented Jan 19, 2024

If I make some changes to a generator file, or create a new library or anything like that, I have to reload VS code before it will show in NX console generators, for example if I then want to remove it. I've tried clicking the refresh nx workspace button and running the command, and restarting the TS server, but nothing helps. Only a restart of VS code will produce the correct behaviour.

Expected Behavior

NX console should reflect the changes I have made to the workspace. The generator when run should be the latest version I have saved. The drop down to show projects/libs should show any projects/libs I have just added. Instead, it seems to cache a snapshot of the workspace that was there when I first opened VS code and use that until I restart. Frustrating to say the least.

Steps to Reproduce

  1. Create a generator.
  2. Edit the generator implementation and save.
  3. Run the generator from NX Console.
  4. Notice it is not using the latest code changes.
  5. Restart VS Code
  6. Repeat steps 1-4 and notice it now runs the latest code.

Or

  1. Create a new project/library using a generator.
  2. Then run the NX remove generator (for example)
  3. Notice the project/library you just created doesn't show in the list.
  4. Restart VS Code
  5. Repeat steps 1-3 and notice it now shows.

Environment

Nx Report:

OS     : darwin-arm64
yarn   : 1.22.19

nx                 : 17.2.8
@nx/js             : 17.2.8
@nx/jest           : 17.2.8
@nx/linter         : 17.2.8
@nx/eslint         : 17.2.8
@nx/workspace      : 17.2.8
@nx/detox          : 17.2.8
@nx/devkit         : 17.2.8
@nx/esbuild        : 17.2.8
@nx/eslint-plugin  : 17.2.8
@nx/node           : 17.2.8
@nx/playwright     : 17.2.8
@nx/plugin         : 17.2.8
@nx/react          : 17.2.8
@nx/react-native   : 17.2.8
@nrwl/tao          : 17.2.8
@nx/vite           : 17.2.8
@nx/web            : 17.2.8
typescript         : 5.2.2
---------------------------------------
Community plugins:
@simondotm/nx-firebase : 1.1.0-beta.0
---------------------------------------
Local workspace plugins:
      @my-company-name-here/workspace-plugins
  • Nx Console version: 18.13.0
  • VSCode version: 1.85.1 (Universal)
@astanb astanb added the type: bug Something isn't working label Jan 19, 2024
@MaxKless
Copy link
Collaborator

Hey! Thanks a lot for the report @alexstanbury. I just recently ran into this myself, something is up with the daemon process :)
I'm looking into this and will get it fixed asap.

@zackarydev

This comment was marked as outdated.

@MaxKless
Copy link
Collaborator

After disabling the extension this is still happening for me.
can you elaborate on this? What issue is persisting without the extension?

@MaxKless
Copy link
Collaborator

Btw I've pushed a fix for this in the nx repo, I'll let you know once it's released.
Would love some feedback on whether the fixworked for you then.

@astanb
Copy link
Author

astanb commented Jan 25, 2024

Thanks, can you link me to the fix? I'd like to implement it myself asap as I'm trying to write generators at the moment.

@MaxKless
Copy link
Collaborator

nrwl/nx#21283

@MaxKless
Copy link
Collaborator

You can check out the CONTRIBUTING.MD to see how to release a local version from master for your own testing :)

@zackarydev
Copy link

After disabling the extension this is still happening for me.

can you elaborate on this? What issue is persisting without the extension?

Essentially VSCode slows to a crawl, file saving, deletion etc, would trigger prettier via "file participants" but it would just load for like 30-45s per file change. Super annoying disabling prettier fixes it but it's not a great solution. NX console didn't seem to be the issue, at least not for me. But I'm curious about this fix. Do we have a release forecast for it ?

@MaxKless
Copy link
Collaborator

No idea what would be the issue here... but if you disable Nx Console, restart your PC and the issue is still there, it's definitely nothing nx console related.

@MaxKless
Copy link
Collaborator

Hey @alexstanbury can you check whether this still happens on the latest nx & nx console?

@joeldbirch
Copy link

I have the same issue with 17.1.3. I'll try to schedule an upgrade and report back if it helps. May a while though.

@MaxKless
Copy link
Collaborator

MaxKless commented Mar 5, 2024

Please also include some logs :)

  • Go to Output -> Nx Console Client and paste what you see there.
  • Run Toggle Developer Tools and paste what you see there too
  • Finally, run nx daemon and provide the contents of the daemon.log file linked there

Thank you! I appreciate you helping out around the repo @joeldbirch

@MaxKless
Copy link
Collaborator

hey! any insights? Is it still happening?

@astanb
Copy link
Author

astanb commented Mar 20, 2024

Sorry for not getting back to you sooner, I have literally not used NX since filing the issue until this week, so your prompt was exceptional timing!

I'm happy to report that I am not seeing the issue anymore, I created a test generator following the docs here. Then I hardcoded the output path, generated a lib, then changed the path, saved the file and ran it again, and the updated path was used. So it's safe to assume the fix has worked 👍

I also see the projects list update when going into NX console after generating a project, so that's working too 👍

The only very slight thing I noticed, is if I generate a project/lib using NX console, the list does not update until next time I open it. This isn't a big deal but it would be nice for it to update in real time, but I expect there are reasons why it doesn't.

Thanks for sorting it 🥇

@MaxKless
Copy link
Collaborator

that's great to hear! The updates should be as instantaneous as possible so you're right it is an issue. I'm working on some things to improve behavior in this area so it should be better soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants