Skip to content

Ugly formatting with empty try block #789

@boris-petrov

Description

@boris-petrov

Prettier-Java 2.7.7

Playground link

--print-width 140

Input:

void main() {
	try (x) {
	} catch (IOException exception) {
	}
}

Output:

void main() {
	try (x) {} catch (IOException exception) {}
}

Expected behavior:

void main() {
	try (x) {
	} catch (IOException exception) {
	}
}

Or maybe:

void main() {
	try (x) {
	} catch (IOException exception) {}
}

Because it becomes very strange if there is something in the catch block:

void main() {
	try (x) {} catch (IOException exception) {
		LOGGER.error();
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions