Skip to content

SpacesPerIndentionLevel is not respected #2197

@jnyrup

Description

@jnyrup

Description

c4e7ca7 exposed the instance property DefaultValueFormatter.SpacesPerIndentionLevel to ease the implementation of custom formatters.

bde29a6 changed DefaultValueFormatter to use the static FormattedObjectGraph.SpacesPerIndentation instead.

Reproduction Steps

See the exinsting test When_defining_a_custom_value_formatter_it_should_respect_the_overrides.
The CustomClassValueFormatter overrides DefaultValueFormatter.SpacesPerIndentionLevel to 8, but in the formatted output the indentation is 4 because FormattedObjectGraph.SpacesPerIndentation is unconditionally used.

Expected behavior

DefaultValueFormatter.SpacesPerIndentionLevel should be respected when deriving from DefaultValueFormatter.

Actual behavior

DefaultValueFormatter.SpacesPerIndentionLevel is never used.

Regression?

Not from a consumer perspective since both commits were part of 6.0.0.

Known Workarounds

No response

Configuration

No response

Other information

Consider whether we should remove DefaultValueFormatter.SpacesPerIndentionLevel since it has never worked, and I'm not sure why would would want to have different indentation levels depending on the object type.
As I recall I simply exposed that property for maximum flexibility.

We could probably also adjust SpacesPerIndentionLevel to default to FormattedObjectGraph.SpacesPerIndentation and make it work.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions