-
Notifications
You must be signed in to change notification settings - Fork 12.8k
this-function parameter can be renamed #9037
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
Comments
Thanks to @weswigham for coming up with this one. |
I dunno, I like the flexibility here - for instance, imagine I want to stop using |
Unfortunately it would be a lot of work because this isn't treated like a normal identifier anywhere else. Notice that the current behaviour doesn't rename body thises. That's because those occurrences aren't linked to the parameter via a symbol, but ad-hoc code in checkThisExpression. |
So, for consistency, we should probably just change the parameter to be a this-keyword, then if we actually want renaming capabilities, add a branch in find all references/rename where inputting a value-position The other option being to leave it as a parameter and add special cases for parameters named 'this' in a bunch of places, which seems hackier to me, IMO. |
I end up adding |
This is related to #9198, so do you mind if I take this? |
Is this fixed? |
Now try to rename or find all references at
/**/
.Expected: Message "You cannot rename this element".
Actual: Rename just the parameter, nothing in the body. Find all references just finds one reference, the definition.
Probably
this
needs to be classified as ThisKeyword by the parser as long as that doesn't break anything else.The text was updated successfully, but these errors were encountered: