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

Duplicate definitions shown in 'Go to Definition' for Angular templates #2133

Closed
1 of 2 tasks
pabloherrero1986 opened this issue Jan 5, 2025 · 8 comments
Closed
1 of 2 tasks

Comments

@pabloherrero1986
Copy link

pabloherrero1986 commented Jan 5, 2025

🐞 bug report

Is this a regression?

No.

Description

Angular templates incorrectly show duplicate definitions for methods or variables in the editor. When clicking on a method or variable, a modal appears to select the definition, but as shown in the attached screenshot, the same definition is listed multiple times.

  • Angular Language Service VSCode extension
  • Angular Language Service server

Reproduction

Steps to reproduce the behavior:

  1. Open an Angular project with strictTemplates set to true in tsconfig.json.
  2. Hover over or click on a method/variable in an Angular template.
  3. Observe that the selection modal lists duplicate definitions for the same item.

Expected behavior

Each method or variable should appear only once in the modal for selection.

Screenshots

Image

🌍 Your Environment

Angular Version: 14, 16 and 18


Angular CLI: 14.2.7
Node: 20.10.0 (Unsupported)
Package Manager: npm 10.2.3 
OS: darwin arm64

Angular: 14.2.8
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1402.7
@angular-devkit/build-angular   14.2.7
@angular-devkit/core            14.2.7
@angular-devkit/schematics      14.2.7
@angular/cdk                    14.2.6
@angular/cli                    14.2.7
@angular/google-maps            14.2.6
@angular/material               14.2.6
@schematics/angular             14.2.7
rxjs                            7.5.7
typescript                      4.7.4

Extension Version:


v19.0.3

VSCode Version:


Version: 1.96.2 (Universal)
Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f
Date: 2024-12-19T10:22:47.216Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.0.0

Operating System:


Windows 11 and MacOS 15

Anything else relevant?

  • This issue occurs only when the extension is installed.
  • Uninstalling the extension resolves the problem.
@pabloherrero1986
Copy link
Author

Is there anyone on the other end who cares about these issues or will they remain untouched forever? This is a pain, having duplicate references makes the extension unusable. The problem is that the TS service and this extension are showing references at the same time, when one of the two should have preference over the other. Can anyone offer support, please?

@atscott
Copy link
Collaborator

atscott commented Feb 12, 2025

I haven't been able to reproduce the issue in any of the listed versions. Note that VSCode deduplicates results itself.

Do you have other extensions that are somehow providing results for the definition outside of the Angular Language Service? If another extension is providing a reference that has a different span than what Angular provides, it would not be considered a duplicate.

@pabloherrero1986
Copy link
Author

@atscott No, is due to the Angular Language Service extension 100%. I have been able to verify that it only happens when definitions are requested from the template. Maybe this detail will help to reproduce it 🙂

@atscott
Copy link
Collaborator

atscott commented Feb 12, 2025

Unfortunately not and I suspect this is a problem unique to your development environment since there have been no additional reports of this issue.

Are you able to provide a reproduction github repo?

Can you also enable verbose server tracing and include the information from the definition request in the output panel showing the duplicate results?

Image

Image

@pabloherrero1986
Copy link
Author

Yes, sure. Let me test it with a VSCode from scratch, and I'll get back to you with the results and the repo if the bug is still present. Thanks!

@pabloherrero1986
Copy link
Author

@atscott you were absolutely right, sorry... it is not a bug in the Angular Service extension, the problem is caused by another extension (angular2-switcher). It seems that the tests I did when opening the issue were not enough, but I hope this helps someone who has the same thing happen to them in the future. Thank you!

@atscott
Copy link
Collaborator

atscott commented Feb 12, 2025

No worries, glad you were able to get to the bottom of this!

@atscott atscott closed this as not planned Won't fix, can't repro, duplicate, stale Feb 12, 2025
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants