microsoft / microsoft/vscode-json-languageservice

Sorting should respecing `keepLines` option from json formatter

Open
#282 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
326
Forks
145
Avg merge
22h 10m
Merged PRs (30d)
9

Description

Example:

A formatted json before run sorting:

{
    "editor.rulers": [ 70, 75 ],
    "css.format.braceStyle": "expand"
}

Result after run sorting:

{
    "css.format.braceStyle": "expand",
    "editor.rulers": [
        70,
        75
    ]
}

But I think what most people would expect is:

{
    "css.format.braceStyle": "expand",
    "editor.rulers": [ 70, 75 ]
}

In another word, it should not sort the content inside an array. What do you guys think?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test entry point is named. Start by locating the JSON formatter's sorting logic and how it handles the keepLines option; use the examples to verify that object properties are sorted while array contents retain their original compact formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.