-
Notifications
You must be signed in to change notification settings - Fork 380
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
REF: introduce constant refactoring #4985
Conversation
|
I tried two variants of the highlighting, the first one simply selects the scope: And the second one inserts a placeholder comment (or something else) into the corresponding place:
What do you think? This selection would be shown after you select whether you want to replace occurences or not. |
|
Added expression selection, auto import and interactive renaming (those features should be independent of highlighting). For some reason this works in Clion, but not in tests: let x = /*caret*/5 + 5;
const i: i32 = 5 + 5; /// IDE
const X1: _ = 5 + 5; /// testsIn tests the |
dcdcd78
to
b2f762c
Compare
|
Rebased over master. |
|
I fixed the tests, they needed the stdlib Here's how the refactoring currently looks like: https://gifyu.com/image/76pa. @vlad20012 let me know if there are any other changes that I should make. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main/kotlin/org/rust/ide/refactoring/introduceConstant/RsIntroduceConstantHandler.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/rust/ide/refactoring/introduceConstant/RsIntroduceConstantHandler.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/rust/ide/refactoring/introduceConstant/RsIntroduceConstantHandler.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/rust/ide/refactoring/introduceConstant/RsIntroduceConstantHandler.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/rust/ide/refactoring/introduceConstant/ui.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/rust/ide/refactoring/introduceConstant/ui.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/rust/ide/inspections/import/AutoImportFix.kt
Outdated
Show resolved
Hide resolved
|
Could you please squash these commits? |
aba9f3c
to
cb9b1e2
Compare
|
👍 Thanks! |





In this PR I'd like to tackle the Introduce constant refactoring. The current state is just a sketch, because I have a few questions:
We could offer these 4 locations (inner function, outer function, inside module, outside module).
Related issue: #4246