-
Notifications
You must be signed in to change notification settings - Fork 363
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
Json formatting arrays #4936
base: main
Are you sure you want to change the base?
Json formatting arrays #4936
Conversation
…ng more cases in TabsAndIndentsVisitor
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
import org.jetbrains.annotations.NotNull; | ||
import org.jspecify.annotations.Nullable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.jetbrains.annotations.NotNull; | |
import org.jspecify.annotations.Nullable; | |
import org.jspecify.annotations.Nullable; |
return ret.getPadding().withValues(ensureCollectionHasNewLines(ret.getPadding().getValues())); | ||
} | ||
|
||
private static <J extends Json> @NotNull List<JsonRightPadded<J>> ensureCollectionHasNewLines(List<JsonRightPadded<J>> elements) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static <J extends Json> @NotNull List<JsonRightPadded<J>> ensureCollectionHasNewLines(List<JsonRightPadded<J>> elements) { | |
private static <J extends Json> List<JsonRightPadded<J>> ensureCollectionHasNewLines(List<JsonRightPadded<J>> elements) { |
import org.jetbrains.annotations.NotNull; | ||
import org.jspecify.annotations.Nullable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.jetbrains.annotations.NotNull; | |
import org.jspecify.annotations.Nullable; | |
import org.jspecify.annotations.Nullable; |
for (int i = 0; i < indentMultiple; i++) { | ||
if (style.getUseTabCharacter()) { | ||
shiftedPrefixBuilder.append("\t"); | ||
private static @NotNull <J extends Json> List<JsonRightPadded<J>> ensureCollectionHasIndents(List<JsonRightPadded<J>> elements, String relativeIndent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static @NotNull <J extends Json> List<JsonRightPadded<J>> ensureCollectionHasIndents(List<JsonRightPadded<J>> elements, String relativeIndent) { | |
private static <J extends Json> List<JsonRightPadded<J>> ensureCollectionHasIndents(List<JsonRightPadded<J>> elements, String relativeIndent) { |
|
||
@Override | ||
public String getDescription() { | ||
return "Indents JSON using the most common indentation size and tabs or space choice in use in the file."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this will be about more than indenting, we might want to make the description a bit more general.
What's changed?
What's your motivation?
Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
Checklist