-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
deeply nested object literals #88
Comments
Do you have a real world example where the display is not optimal? |
@vjeux sure Another nifty side effect is that folding doesn't work for inline printed lines (in atom for example). That is a minor issue, but I use it often within style definitions to get an overview of the structure. Overall this issue is quite minor and mainly based on personal taste. THX to all the contributors of this project. Impressive progress in the last weeks. |
Thanks this is very helpful. On a similar vein, React Native StyleSheet.create() generates similar output which isn't the way people are used to format it. #475 is an idea on how to fix the problem, but unclear if it is a good heuristic. |
As another real-world example, here's an excerpt from a uglify: { compress: { drop_console: true, global_defs: { DEBUG: false } } },
autoReload: { enabled: false }
},
overrides: { autoreload: { plugins: { autoReload: { enabled: true } } } } |
Another idea: automatically expand all the objects at the top level. This may be weird and feel inconsistent but would solve the problem of RN StyleSheet.create and the brunch config. |
#74 is also talking about the same issue, let's condensate them into one. Closing this one. |
Currently deeply nested object literals will be formatted in a collapsed form.
This behavior is nice for simple object literals, but for deeply nested ones it would be nice to have the nested properties indented. Maybe a complexity level (like for Arrow expressions) would be nice here.
source
formatted
https://vjeux.github.io/prettier-browser/#%7B%22content%22%3A%22%5Cnvar%20simple%20%3D%20%7B%5Cnname%3A'a'%5Cn%7D%5Cn%5Cnvar%20test%20%3D%20%7B%5Cn%20%20%20%20name%3A'f'%2C%5Cn%20%20%20%20nested%3A%20%7B%5Cn%20%20%20%20%5Ctnested%3A%20%7B%5Cn%20%20%20%20%5Ct%5Ctnested%3A%20%7B%5Cn%20%20%20%20%5Ct%5Ct%5Ctnested%3A%20%7B%5Cn%20%20%20%20%5Ct%5Ct%5Ct%5Ctnested%3A%20%7B%5Cn%20%20%20%20%5Ct%5Ct%5Ct%5Ct%5Ctnested%3A%20%7B%5Cn%20%20%20%20%5Ct%5Ct%5Ct%5Ct%5Ct%5Ctnested%3A%20%7B%5Cn%20%20%20%20%5Ct%5Ct%5Ct%5Ct%5Ct%5Ct%5Ctname%3A%20'a'%5Cn%20%20%20%20%5Ct%5Ct%5Ct%5Ct%5Ct%5Ct%7D%5Cn%20%20%20%20%5Ct%5Ct%5Ct%5Ct%5Ct%7D%5Cn%20%20%20%20%5Ct%5Ct%5Ct%5Ct%7D%5Cn%20%20%20%20%5Ct%5Ct%5Ct%7D%5Cn%20%20%20%20%5Ct%5Ct%7D%5Cn%20%20%20%20%5Ct%7D%5Cn%20%20%20%20%7D%5Cn%7D%3B%22%2C%22options%22%3A%7B%22printWidth%22%3A80%2C%22tabWidth%22%3A2%2C%22useFlowParser%22%3Afalse%2C%22singleQuote%22%3Atrue%2C%22trailingComma%22%3Afalse%2C%22bracketSpacing%22%3Afalse%7D%7D
The text was updated successfully, but these errors were encountered: