-
-
Notifications
You must be signed in to change notification settings - Fork 892
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! |
|
Hello! Are you still working on this one? :) |
Hi! I don't think I will be able to work on this issue until next year due to some of my deadlines, and I believe I would need help, as I got stuck finding a way to remove the 'as' in the assign pattern and got nowhere. If someone wants to solve this issue on another PR, or wants to continue from here, feel free to do so, and I'm here to explain what I've done or discuss it! |
|
No worries @clr-cera ! Thank you again. I'll close this, and anyone looking at the linked PR in future can reference thisone. |
This PR creates the code action to discarding an unused variable.
References Issue #4950
As suggested the code action is currently set as preferred.