Inspect.Algebra.next_break_fits
You're seeing just the function
next_break_fits
, go back to Inspect.Algebra module for more information.
Specs
next_break_fits(t(), :enabled | :disabled) :: doc_fits()
Considers the next break as fit.
mode
can be :enabled
or :disabled
. When :enabled
,
it will consider the document as fit as soon as it finds
the next break, effectively cancelling the break. It will
also ignore any force_unfit/1
in search of the next break.
When disabled, it behaves as usual and it will ignore
any further next_break_fits/2
instruction.
Examples
This is used by Elixir's code formatter to avoid breaking code at some specific locations. For example, consider this code:
some_function_call(%{..., key: value, ...})
Now imagine that this code does not fit its line. The code
formatter introduces breaks inside (
and )
and inside
%{
and }
. Therefore the document would break as:
some_function_call(
%{
...,
key: value,
...
}
)
The formatter wraps the algebra document representing the
map in next_break_fits/1
so the code is formatted as:
some_function_call(%{
...,
key: value,
...
})