racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
447 stars 94 forks source link

[Feature Request] Dr. Racket: Uniform renaming behaviour, regardless of whether there are references or not #629

Closed rxg closed 1 year ago

rxg commented 3 years ago

Is your feature request related to a problem? Please describe. A description of what the problem is. E.g., I'm always frustrated when [...]

I use Dr. Racket's renaming facilities often to rename identifiers. I am sometimes frustrated when I two-finger-tap on an identifier that I would like to rename, as I have others, in preparation to rename it only for Dr. Racket to not pop up the opportunity to rename because there are no references. It throws me out of my routine that I have to switch mechanisms to rename depending on whether there are outstanding references in the rest of the file. It would be helpful if this were more uniform.

Describe the solution you'd like A description of what you want to happen.

Describe alternatives you've considered A description of any alternative solutions or features you've considered.

Do you want to contribute to this feature If you're interested in working on the development of this feature, say so here.

[Optional] Additional context Add any other context or screenshots about the feature request here.

sorawee commented 3 years ago

Yeah, I would love it to be uniform too.

One of the features in DrRacket's identifier renaming is a warning if the new name conflicts with existing names. For example: consider

(define x 1)
x
(define y 2)
y

If you rename x to y, you will get a warning.

The new name you have chosen, "y", conflicts with an already established name in this scope.

So in the uniform renaming, we definitely should have this feature too. The problem is that with how DrRacket is currently structured, the procedure to detect conflicts is attached to arrows. Because there is no arrow in your case, we can't (easily) detect the conflict.

@rfindler would it make sense to have a new method for syncheck that provides an access to name-dup? for each binding occurrence?

rfindler commented 3 years ago

I think it would be good to get this fixed, yes. I'm not sure the best way but probably a method that sends over each binding occurrence would be required, yeah, instead of inferring them from the arrows.