Skip to content

Sort by nested / indentation level instead of globally? #7

Open
@alexleduc76

Description

@alexleduc76

Perhaps this type of feature would only be useful if the file extension is .json or .js, but it would be nice if it could take nested JSON or JS object literals:

{
	"workbench.iconTheme": "vscode-icons",
	"zenMode.hideLineNumbers": false,
	"emmet.includeLanguages": {
		"javascript": "javascriptreact"
	},
	"beautify.options": {
		"indent_with_tabs?": true,
		"indent_size?": 1,
		"end_with_newline?": true
	},
	"search.exclude": {
		"**/public/fonts": true,
		"**/public/js": true,
		"**/public/themes": true,
		"**/public/css": true
	}
}

And sort it like this:

{
	"beautify.options": {
		"end_with_newline?": true
		"indent_size?": 1,
		"indent_with_tabs?": true,
	},
	"emmet.includeLanguages": {
		"javascript": "javascriptreact"
	},
	"search.exclude": {
		"**/public/css": true
		"**/public/fonts": true,
		"**/public/js": true,
		"**/public/themes": true,
	}
	"workbench.iconTheme": "vscode-icons",
	"zenMode.hideLineNumbers": false,
}

... and if the last item in a nested list doesn't have one and it's moved to another position in the order, add a comma at the end so that ti doesn't have to be manually fixed after the sort (errors in the format should be highlighted above)

instead of:

		"**/public/css": true,
		"**/public/fonts": true,
		"**/public/js": true,
		"**/public/themes": true
		"end_with_newline?": true
		"indent_size?": 1,
		"indent_with_tabs?": true,
		"javascript": "javascriptreact"
	"beautify.options": {
	"emmet.includeLanguages": {
	"search.exclude": {
	"workbench.iconTheme": "vscode-icons",
	"zenMode.hideLineNumbers": false,
	}
	},
	},
{
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions