mgesbert / vscode-indent-nested-dictionary Goto Github PK
View Code? Open in Web Editor NEWVS Code extension for formatting nested data structures
VS Code extension for formatting nested data structures
If a nested dictionary has comments in it, whether on their own lines, or at the end of lines with code on them, the formatter does not take this into account and reflows with the comments. This causes lines to become commented out and that breaks the dictionaries.
For example:
{
"foo": [
# this is a comment
1, 2, 3
],
# this is another comment
"baz": {
"a": "b",
"c": "d",
}
}
Becomes
{
"foo": [
#thisisacomment1,
2,
3
],
#thisisanothercomment"baz": {
"a": "b",
"c": "d",
}
}
Note that the first element of the foo
array gets slurped up into the comment and the second element of the outer dictionary (baz
) is commented out leaving a broken nested dictionary.
Currently using tabs for indentation is hard-coded. Would be nice to have the code honor the current editor indentation setting for indentation and use tabs or the configured number of spaces.
Awesome and incredibly useful extension!!
Hi
Thank you for your tool. Really helpful. I use it to format several test fixtures. Your tool makes it easier to get an overview of complex data structures. However, I think that the readability would improve if no newlines were added for empty lists and objects(dicts). Example with this {"foo":[{}]}
:
Now:
{
"foo": [
{
}
]
}
Future:
{
"foo": [{}]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.