nx-console
nx-console copied to clipboard
Since removing angular.json, IntelliJ/Webstorm IDE no longer shows Angular schematics in menus.
Current Behavior
I support an Angular NX monorepo at a company where many developers use the Intellij IDE. Intellij can detect the presence of an Angular application and show Angular schematics in it's menu. However, this appears to depend on the presence of an angular.json file. However, NX removed the angular.json file in favor of project.json files in each app/lib, thus Intellij no longer recognizes it as an Angular app and thus no longer shows schematics in the menu. Is there a way to both use the latest NX and continue to have Angular schematics appear in Intellij?
Expected Behavior
Angular schematics to show in Intellij menu (see screenshots). The screenshots shows Intellij menus once Intellij recognizes an Angular app due to the presence of an angular.json file.
GitHub Repo
No response
Steps to Reproduce
npx create-nx-workspace@latest nx-example-workspace- ✔ Which stack do you want to use? · angular ✔ Integrated monorepo, or standalone project? · integrated ✔ Application name · nx-example-workspace ✔ Which bundler would you like to use? · webpack ✔ Default stylesheet format · scss ✔ Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? · No ✔ Test runner to use for end to end (E2E) tests · none ✔ Which CI provider would you like to use? · skip ✔ Would you like remote caching to make your build faster? · skip
- Open workspace in Intellij or Webstorm.
- Open File -> New (Notice there is no menu option for Angular Schematics or Angular Dependencies
- Right click on a Typescript file in the workspace, go to New (Notice there is no menu option for Angular Schematics or Angular Dependencies)
Nx Report
NX Report complete - copy this into the issue template
Node : 18.20.5
OS : darwin-arm64
Native Target : aarch64-macos
npm : 10.8.2
nx : 20.3.3
@nx/js : 20.3.3
@nx/jest : 20.3.3
@nx/eslint : 20.3.3
@nx/workspace : 20.3.3
@nx/angular : 20.3.3
@nx/devkit : 20.3.3
@nx/eslint-plugin : 20.3.3
@nx/module-federation : 20.3.3
@nx/web : 20.3.3
@nx/webpack : 20.3.3
typescript : 5.6.3
---------------------------------------
Community plugins:
angular-eslint : 19.0.2
Failure Logs
Package Manager Version
pnpm 9.15.4
Operating System
- [x] macOS
- [ ] Linux
- [x] Windows
- [ ] Other (Please specify)
Additional Information
No response
Yes, there is a way. Please have a look at the NX Console Plugin
@schreibse I have tried the NX Console plugin, but I struggled to get it to work. When I click the "Generate (UI)" command, nothing happens. When I try the same thing in VS Code, I get this message: "No generators found. Did you run npm/pnpm/yarn install?", which of course I have.
I am able to run generators from the terminal, just not in the IDE. (i.e. this works: pnpm nx generate @nx/angular:component ...). I'm not sure if I'm doing something wrong or if NX console is just buggy.
Unfortunately, my organization is currently stuck on an old version of Node.js, so I'm testing with NX 16.
`Node : 16.20.2 OS : darwin-arm64 pnpm : 8.11.0
nx : 16.10.0 @nx/js : 16.10.0 @nx/jest : 16.10.0 @nx/linter : 16.10.0 @nx/workspace : 16.10.0 @nx/angular : 16.10.0 @nx/cypress : 16.10.0 @nx/devkit : 16.10.0 @nx/eslint-plugin : 16.10.0 @nx/storybook : 16.10.0 @nrwl/tao : 16.10.0 @nx/webpack : 16.10.0 nx-cloud : 19.1.0 typescript : 4.9.5
Community plugins: @fortawesome/angular-fontawesome : 0.10.2 @ng-bootstrap/ng-bootstrap : 14.2.0 @ngrx/component-store : 15.3.0 @ngrx/effects : 15.3.0 @ngrx/entity : 15.3.0 @ngrx/router-store : 15.3.0 @ngrx/schematics : 15.3.0 @ngrx/store : 15.3.0 @ngrx/store-devtools : 15.3.0 @sf/schematics : 0.0.2 @storybook/angular : 7.6.9 @testing-library/angular : 14.5.1 ngx-toastr : 16.2.0 `
Here is the output from idea.log when I try to open the "Generate (UI)" dialog:
2025-01-29 16:47:23,564 [ 878031] FINER - #dev.nx.console.nxls.NxlsWrapper - Error from nxls: Request nx/generators failed with message: Cannot read properties of undefined (reading 'generators') 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - Exception in thread "DefaultDispatcher-worker-10" org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request nx/generators failed with message: Cannot read properties of undefined (reading 'generators') 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:220) 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:204) 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at dev.nx.console.nxls.NxlsWrapper.start$lambda$10$lambda$9(NxlsWrapper.kt:110) 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185) 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97) 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114) 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) 2025-01-29 16:47:23,565 [ 878032] INFO - STDERR - at java.base/java.lang.Thread.run(Thread.java:1583) 2025-01-29 16:47:23,566 [ 878033] INFO - STDERR - Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [ComponentManager(ProjectImpl@418848641), com.intellij.codeWithMe.ClientIdContextElementPrecursor@7f56c14e, CoroutineName(dev.nx.console.generate.NxGenerateService), StandaloneCoroutine{Cancelling}@6a200bdf, Dispatchers.Default]
Hey! Any chance you could provide me with a minimal repro? Nx Console should be able to render angular schematics just fine, so that's the way to go here. But it looks like you're running into a bug when fetching the schematics & generators.
A minimal repro is the fastest way for me to find and fix the issue :)
I tried creating a new NX 16 workspace with the same properties as my company monorepo and opening it in IntelliJ, but the Generate UI menu works fine there. I also tried making my monorepo's nx.json file match the new one, but I'm still getting the same error.
So, I'm not sure yet how to create a minimal repro. @MaxKless Do you have any ideas I could try or any insight on places to look that could cause this error message?:
dev.nx.console.nxls.NxlsWrapper - Error from nxls: Request nx/generators failed with message: Cannot read properties of undefined (reading 'generators')
Hmmm interesting. I think maybe this place could be the problem? https://github.com/nrwl/nx-console/blob/migrate-ui/libs/language-server/workspace/src/lib/read-collections.ts#L95
Maybe there's a dependency in your node_modules that doesn't have a package.json?