You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I dunno, I like the flexibility here - for instance, imagine I want to stop using this and want to start passing in an object explicitly? As long as this stays contained to the function and doesn't leak into other scopes that have their own this, I feel like this is fine.
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 this yields all similarly-scoped value-position thises.
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.
imagine I want to stop using this and want to start passing in an object explicitly
I end up adding this: {} and then fix the errors for this access and then after fixing I delete the this: {} annotation. Just a workflow that's worked for me personally ;) 🌹
Sure, although #9198 is a lot bigger than this issue. The fix in #9171 just prevents rename for this identifiers, and the alternate approach of parsing a ThisKeyword as a parameter makes the possibility of renaming Just Working even less likely.
Activity
sandersn commentedon Jun 8, 2016
Thanks to Wesley Wigham (@weswigham) for coming up with this one.
DanielRosenwasser commentedon Jun 14, 2016
I dunno, I like the flexibility here - for instance, imagine I want to stop using
thisand want to start passing in an object explicitly? As long asthisstays contained to the function and doesn't leak into other scopes that have their ownthis, I feel like this is fine.sandersn commentedon Jun 14, 2016
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.
weswigham commentedon Jun 14, 2016
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
thisyields all similarly-scoped value-positionthises.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.
basarat commentedon Jun 15, 2016
I end up adding
this: {}and then fix the errors forthisaccess and then after fixing I delete thethis: {}annotation. Just a workflow that's worked for me personally ;) 🌹sandersn commentedon Jun 17, 2016
Sure, although #9198 is a lot bigger than this issue. The fix in #9171 just prevents rename for
thisidentifiers, and the alternate approach of parsing a ThisKeyword as a parameter makes the possibility of renaming Just Working even less likely.RyanCavanaugh commentedon Jun 24, 2016
Is this fixed?