-
-
Notifications
You must be signed in to change notification settings - Fork 873
Discard unused variable code action #4967
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
base: main
Are you sure you want to change the base?
Conversation
Added the DiscardUnusedVariables struct to the actions vector in engine
Hi, I am having two problems with this pr! First, is the code action always applied after formatting? When the variable is assigned through a pattern, the code action must also remove the ' as ' before the variable name, and I haven't figured out how to find this span. Also, the tests for the code action are failing, although they produce the right result, how can I fix that? |
Accepted the snapshots, and the LabelShorthand edit now adds a ' ' to comply with formatting
|
Thank you! Now I understood the snapshot testing, and wow, it works so well! |
I couldn't find the assign pattern related to the unused variable warning, I tried to visit all assign patterns locations and check if the variable location start is inside, but this returned no patterns, and I did not think of any other way. Is there a way to, given a location, find the location of a string before it? I will try to fix it later, thanks for helping! |
This PR creates the code action to discarding an unused variable.
References Issue #4950
As suggested the code action is currently set as preferred.