Skip to content

Consistent formatting of multivariable try-with-resource blocks. #1392

@thatcomputerguy0101

Description

@thatcomputerguy0101

The current formatting of try-with-resource blocks that manage multiple variables is strange, as it results in inconsistent alignment and doesn't match how multiline parameters or code blocks are formatted.

Current output:

try (var input = Files.newInputStream(Path.of("./input"));
    var output = Files.newOutputStream(Path.of("./output")); ) {
  output.write(input.read());
} catch (IOException _) {
}

How I think it should be formatted:

try (
  var input = Files.newInputStream(Path.of("./input"));
  var output = Files.newOutputStream(Path.of("./output"));
) {
  output.write(input.read());
} catch (IOException _) {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions