It it possible to have a warning showing that a public method is unused?
In my angular/ts project webstorm tells me when a private method is not being used (method name will be grey), but is does not show any information when a public method is not being used anywhere.
Any clue on this?
I'm using PHP Strom 2019.3 with Angular/typescript
Thank you.
Please sign in to leave a comment.
For as I see, it has something to do with the size of the project. If the project is small, the information that the field is unused is shown accordingly(changing the color to gray and becomed underlined) but if the project is a big one or mid size the editor is not able to track the refereces and the info is not provided (just when you try to go to references - Ctrl+B - he "wakes up" and says that it's unused, as in the picture above in comment)
Is JavaScript | General | Unused global symbol inspection enabled in Settings | Editor | Inspections? It normally reports unused public methods. If enabling inspection doesn't help, try invalidating caches (File > Invalidate caches, Invalidate and Restart).
BTW, what's a result on searching for your public method usages (Alt+F7, Find Usages in method right-click menu)?
I am having the same issue in WebStorm 2020.2
Unused properties defined in Typescript class are not highlighted but the message is good: "No usaged found in All Places".
How can we fix this? The settings mentioned above are well configured but the IDE is still not working as the setup says it should.
Same problem with public fields of an exported interface. The inspection mentioned above is on. Alt+F7 gives the correct result, it can see that a field is never used in the project. Running the "Unused global symbol" inspection manually does not help either, it just says everything is OK. I wonder why it cannot highlight all unused fields, seems like a bug that nobody even cares about.
I am using Rider 2021.1.2.
I have the same issue with Java code (bigger project). Running inspections for "Unused declaration" for any scope and level do not detect any unused code, but Ctrl+Click or Ctrl+B shows Pop-Up saying "No usages found in All Places" on some methods. My IDE version: IntelliJ IDEA 2021.1.1
Thank you for your reply.
I already had the setting "Unused global symbol " as suggested. I also invalidated caches&restart but still no changes: there isn't any information about the method not being used. Not even if i inspect code (code/inspect Code...)
Curiously, if i try to find usages of that method, it gives me the right message: "no usages found in project Files"
can you reproduce the issue in a new project (File -> New Project -> Static Web -> Angular CLI, for example)?
I am trying to reproduce this behaviour Jolteteofil mentioned in a dedicated repo, but it is not possible. It might have something to do with the overall size of the project.
In my test repo everything works fine (I copied the "buggy" code in it). In the actual project it does not show unused methods.
Same issue here
i have the same issue, it's not able to show warning on un-used public method inside a class.
is there any updated on this issue
Is there already a solution? I also have this problem in a PHP context of a huge project directory.
you can checkout https://github.com/bytefury/crater and create a method in a controller -> make a function call -> delete function call.
The method should marked.
IntelliJ IDEA 2020.3.1 (Ultimate Edition)
Build #IU-203.6682.168, built on December 29, 2020
Runtime version: 11.0.9.1+11-b1145.63 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.16
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 12
Seeing the same issue on a typescript + react project Intellij IDEA Ultimate 2021.3.1 - pop up says 'No Usages found in All Places', becomes greyed out after I remove the 'export' statement
Works fine for me, I need a test project to see what's going it
See https://intellij-support.jetbrains.com/hc/en-us/community/posts/360006792180/comments/360002071999 above