-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat: Add an assist to extract an expression into a constant #18652
Conversation
That's fine, in that case we do want the assist to be more permissive I think. Its okay for assists to generate semantically invalid code (to a certain degree), its not okay for them to generate broken syntax. |
This I think we might want to do, grouped together with function extraction, as well as closure extraction, once we have that, as i believe those can trigger on the same selection snippets at times. |
☔ The latest upstream changes (presumably #18657) made this pull request unmergeable. Please resolve the merge conflicts. |
6a7bfaf
to
1979d3f
Compare
This force-push was just fixing merge conflicts, I will begin working on those suggestions now! |
closes #7692
Technically, this will permit some invalid const definitions since, as far as I know, we don't have the ability to properly ensure that an expression can be const evaluated, but I believe that would require a larger overhaul of RA's integration of MIR stuff. Either way, this should be fine for now and does a good job rejecting most of the obviously incorrect definitions.
I could also group these assists if that's desirable, just let me know.