Skip to content

Improve UI for rename argument/temporary variable and add tests#19846

Open
Biljcica wants to merge 7 commits into
pharo-project:Pharo14from
Biljcica:week1
Open

Improve UI for rename argument/temporary variable and add tests#19846
Biljcica wants to merge 7 commits into
pharo-project:Pharo14from
Biljcica:week1

Conversation

@Biljcica

@Biljcica Biljcica commented Jul 1, 2026

Copy link
Copy Markdown

Copied StRefactoringPreviewPresenter and modified the UI to support renaming arguments/temporary variables. The updated view allows entering a new name, triggering the rename action, and displaying a preview of changes based on the selected scope. Added unit tests to verify each part of the functionality and introduced missing tests for ReLocalNameConflictCondition.

@request-info

request-info Bot commented Jul 1, 2026

Copy link
Copy Markdown

This issue has either a default title or empty body. We would appreciate it if you could provide more information. Note: I am not a very intelligent bot, I can only react to new comments. Please add a comment for me if you update the body or title.

@Biljcica
Biljcica marked this pull request as draft July 1, 2026 11:50
@balsa-sarenac

Copy link
Copy Markdown
Member

Thanks! Feel free to update description and explain what you did and optionally why!
In the reviewers section, you can find people you want to take a look before we get this merged, then we'll be notified, and will review the code. Happy to help with your first contribution!

@balsa-sarenac

Copy link
Copy Markdown
Member

@Ducasse we want to leave this for Pharo15, right?

@Ducasse
Ducasse requested a review from balsa-sarenac July 1, 2026 20:08
@Ducasse

Ducasse commented Jul 1, 2026

Copy link
Copy Markdown
Member

@Ducasse we want to leave this for Pharo15, right?

This is my impression like that less stress :)

@Ducasse

Ducasse commented Jul 1, 2026

Copy link
Copy Markdown
Member

I will change the branch when it is ready so that we have less git magic.

@Biljcica
Biljcica marked this pull request as ready for review July 2, 2026 12:33

@balsa-sarenac balsa-sarenac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good progress, awesome to see tests alongside!

let's iterate and try to clean the noise, there are a lot of changes/additions that are not needed. I tried to flag them with inline comments. to get this merged, we ideally want minimal code to introduce, and remove the dead code/unused code. we can discuss if something is not clear

it would be nice if for next iteration to clean the leftover halts and new empty lines in random methods (just brings noise and unnecessary history)

Comment on lines +15 to +18
| temp |
temp := 35.
| tmp1 |
tmp1 := 35.

^ temp
^ tmp1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing leftovers

Comment on lines +299 to +304
{ #category : 'initialization' }
ReCompositeChange >> resetChanges [

changes := OrderedCollection new
]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed, let's try to do it with new model for each update, instead of cleaning the model before generating new changes
we can compare them afterwards and pick better one

My precondition verifies that the new name is a valid variable name and not an existing instance or a class variable name
"
Class {
#name : 'ReRenameArgumentOrTemporaryRefactoring2',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is different from original refactoring?
Or - what you needed to change and why? - could we use the existing refactoring instead?

]

{ #category : 'accessing' }
ReRenameArgumentOrTemporaryDriver2 >> gatherUserInput [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's try to clean the driver of methods it is not using, just so it's easier to understand. I'm even thinking of creating a superclass of InteractionDriver (like a Driver), and have just the entrypoint and minimal things we need - like runRefactoring and hooks we use. we can discuss this, it will remove noise for you here, and since it's new way of doing drivers, doesn't make sense to try to force it and avoid all existing defined API


"
Class {
#name : 'SycRefactoringPreviewPresenter2',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rename this to SycRenameArgumentOrTemporaryPresenter or something similar, since this is now specific to this refactoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants