-
-
Notifications
You must be signed in to change notification settings - Fork 218
Fix formatting for super and self keywords #898
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
base: master
Are you sure you want to change the base?
Fix formatting for super and self keywords #898
Conversation
|
I may be reading this wrong, but it doesn't seem like this fixes: |
|
No it doesn't. (when would that even happen?) |
When you use 'self' as a key for a Dictionary. |
|
Yes that's obvious but I'm struggling to imagine when I would ever want that. |
|
@theXYZT can you think of any other cases?
|
|
In your image, is |
|
Thinking about it, is there a reason why this can't be the simplification for part of this fix: if (next === "]") {
return "";
}
if (prev === "[") {
return "";
}Are there any cases where you want an opening square bracket / closing square bracket to be followed / preceded by a space? But perhaps this is for a different pull request to experiment with. |
Hm, I just doubled checked and other dict literals are not expanded here. I've been writing mostly ts lately and a similar object literal does have the extra padding. Just checked python/ruff, and padding is not added to dict literals there. I have intentionally avoided adding more rules for this syntax because my formatter does not modify indentation at all. A proper formatter would re-indent list/dict literals, collapse small ones onto one line, expand large ones onto multiple lines, etc. Mine is not smart enough to handle that so I've just left them alone. Let me mess with it a bit more... |
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.
The lines being changed here should probably be removed entirely rather than commented out (since you can find them back using version control).
|
Is there anything blocking this from being pushed? I'd love to have a nightly build with this. |


Fixes #890