Angular support not working properly

已回答

Hi, in one of our projects, the Angular support does not work properly (anymore). It seems that Angular support is not applied to the project at all.

E.g. within HTML-template-files, components are marked as unknown HTML tags, navigation to components is not possible, “No related symbols” is shown when trying to navigate to related symbols.

I already saw quite some threads related to this topic, but nothing really pointed me into the proper direction.

- Angular plugin is enabled
- @angular/core is in package.json (~18.1.2)
- node_modules/@angular seems to be included just like in other projects where the support works properly

I already invalidated all the caches.

Quick documentation for a HTML-file:

Project View:

Dependencies (package.json)

Settings / Plugins:

Additional Information:

IntelliJ IDEA 2024.2.3 (Ultimate Edition)
Build #IU-242.23339.11, built on September 25, 2024

Runtime version: 21.0.4+13-b509.17 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 14.7
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 8192M
Cores: 10
Metal Rendering is ON
Registry:
 debugger.new.tool.window.layout=true
 ide.experimental.ui=true
 i18n.locale=
 scala.erase.compiler.process.jdk.once=false
Non-Bundled Plugins:
 PythonCore (242.23339.11)
 com.arcticicestudio.nord.jetbrains (0.13.0)
 Intellij_GitHub_Dark_Theme (1.1.3)
 Pythonid (242.23339.11)
 com.intellij.ml.llm (242.23339.11)
 Jetty (242.20224.159)
 org.intellij.scala (2024.2.28)
 com.github.copilot (1.5.24.6840)
Kotlin: 242.23339.11-IJ

 

 

Any help is appreciated.

Regards,
Peter Lanser

 

1

Could you please provide the logs (Help > Collect logs and diagnostic data)? You can upload them to https://uploads.services.jetbrains.com/ and let me know the upload ID.

0

Hi, thanks for your response.

Upload id: 2024_09_27_7gvFWGVCU5vn9fA1xozKFZ (file: idea-logs-20240927-0750586378631114932628785.zip)

Recards,
Peter

0

Thanks! The IDE configuration itself looks correct. There might be a conflict if other frameworks are also used in the same project. Could you please upload your package.json(s) to https://uploads.services.jetbrains.com/?

 

0

Upload id: 2024_09_30_21GSAcyMpQvLd5NFaLS5WJ (file: package.json)

0

Hi, your request to upload my package.json(s) (plural) made me think again… The project is based on nx (https://nx.dev/) and there are package.json(s) in sub-modules which represent deployable libraries.

These package.json(s) do _not_ explicitly mention angular/core as a dependency. However, I just added this dependency for test-purposes and that solves the problem.

To be honest, I have to check if 1) these package.json(s) are (still) needed at all and 2) if we can (or even should) put angular/core as a dependency there.

For me some questions remain:

  • The IDE does not only consider a single root package.json but it does consider other package.json(s) that exist somewhere in the hierarchy. Is this correct?
  • It seems, that it's enough to mention angular/core as a peerDependency. It this correct?
  • Did this behaviour change on purpose? We did not have any problems with previous versions of the IDE.
0

Thank you for providing the file. Just to be sure, when you say “project.json” do you still mean package.json? Is the provided file located in the root or in a sub-project? Which previous version did you use?

0

I'm sorry… it's supposed to be package.json(s) of course. I edited my comment above.

The package.json that I provided, is the one from the root-project.

For the given project, Angular support works properly until version 2023.2.8 (inclusive).

0

Thanks for the clarification! It's helpful to know that Angular support works smoothly up until version 2023.2.8. I'll make sure to check the package.json files in the root-project and adjust accordingly. Appreciate the update! 

0

Thanks for the clarification! It's helpful to know that Angular support works smoothly up until version 2023.2.8. I'll make sure to check the package.json files in the root-project and adjust accordingly. Appreciate the update! 

 

Many thanks for that complete information!

0

There is a known issue with detection of Angular context within the Nx workspaces. Have you tried installing the official Nx plugin: https://plugins.jetbrains.com/plugin/21060-nx-console ? You can also force the framework context within the whole project with .ws-context file with contents:

{
  "framework": "angular"
}

 

0

Hi, I just installed the Nx plugin. Angular support now works properly. Thanks a lot for the hint.

Regards,
Peter

0

请先登录再写评论。