- changed status to open
In LWC templates: CTRL+clic on a function shows all declarations with the same name, it should only show the declaration in the associated JS file
When you CTRL+click on a function in a LWC template. It displays the "Choose declaration" window with all the functions of the same name regardless of the current LWC component. Only the reference of the associated JS file should be displayed (As there would only be one declaration, it should directly display the JS function)
Comments (4)
-
repo owner -
repo owner Okay, I actually I did manage to figure out a way to do this…at least in one direction. Now those braced bind expressions should resolve to the one proper target added by IC, but if you attempt to find usages from that target element and there are others that would have previously had references to it based on the name, it will still show those usages. I’m trying to see if there’s a way to filter those as well since the way to do this is evidently not really as first-class as I’d prefer. But…good progress!
-
repo owner - changed status to resolved
Delivered in 2.3.0.3. Note that I'm still investigating Find Usages behavior, but Go To Declaration, Quick Definition, etc., should show the single correct target declaration now.
-
reporter Awesome! Thanks a lot! :)
- Log in to comment
Unfortunately this is more a behavior of the JetBrains IDE's HTML/JavaScript support than anything in IC. IC actually does explicitly add a reference to the one-and-only method with that name in the corresponding
.js
file, but the JetBrains JavaScript plugin is adding a number of other references due to the dynamic binding nature of the overarching language. There doesn't seem to be any way to suppress other reference contributions as far as I can tell, but I'll inquire again with JetBrains.This is obviously a larger issue with referenced symbols that have a common name, whether that's just across your own code base as in your example or, as I have in one of my own projects, something even more generic such as a method named
cancel
which then picks up references to methods/functions with that name from other modules.I agree that it's annoying. As stated above, I'll check in with JetBrains again to see if there's any way to suppress/avoid the other references.