-
|
Hello 👋 Is there support for detecting unused local variables? I sometimes rename a variable (manually) and then forget to rename it elsewhere and fish doesn't complain at all that the old variable doesn't exist of course. Is there a way to get a warning when a variable is unused? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
👋 Yeah so the next published release will have this in it. Infact I'm mostly done with it already besides needing to clean up the code base since I tried out structuring some logic differently. This branch has changes that should include getting unused local symbols in your 4004 diagnostics.
I'm pretty certain the upstream branch I linked you works for most common variable && function definitions, but any bugs would be awesome to tackle without foot gunning myself. There are significant improvements to how all FishSymbols including variables, use more strict groupings of rules to ensure they don't match with a false positive. However, there needs to be some significant refactoring to keep the project maintainable if we're to merge this. If you want to check out refactoring the code for this feature, it is right here. LMK if you run into any bugs or issues installing that version! |
Beta Was this translation helpful? Give feedback.
Unused local variables are now merged into master and available on release v1.0.10.
Shouldn't be very different from the branch you tested here (besides some slight improvements in narrowing weird edge-cases I could find). They'll be shown using the same diagnostic as unused functions,
4004.Thanks for the help testing and the source examples 🙏