Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[json] Format selection doesn't fix indentation #105998

Open
jrieken opened this issue Sep 3, 2020 · 2 comments
Open

[json] Format selection doesn't fix indentation #105998

jrieken opened this issue Sep 3, 2020 · 2 comments
Assignees
Labels
feature-request Request for new features or functionality json JSON support issues
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Sep 3, 2020

  • have the JSON snippet below
  • select the 2nd line
  • run "Format Selection"
  • 馃悰 the indentation isn't fixed
{
"foobar": true,
    "bazz": false
}

Originally posted by @misolori in #105800 (comment)

@aeschli
Copy link
Contributor

aeschli commented Nov 4, 2020

Very unclear to me what the expect behavior of range format regarding the initial indentation.
Can we assume the content above is correctly formatted and indented?
Right now JSON builds on the original indent of the selected range.

TypeScript seems to look at the full file

{
{
var x; // selected line
}
}

=>

{
{
        var x; // selected line
}
}

@aeschli aeschli added this to the Backlog milestone Nov 4, 2020
@aeschli aeschli added feature-request Request for new features or functionality json JSON support issues labels Nov 4, 2020
@jrieken
Copy link
Member Author

jrieken commented Nov 4, 2020

Yeah, I think the general approach is to format the whole document but to only generate text edits for nodes inside the selected range.

@aeschli aeschli changed the title Format selection doesn't fix indentation [json] Format selection doesn't fix indentation Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality json JSON support issues
Projects
None yet
Development

No branches or pull requests

2 participants