When the "Introduce pipe" code action is called, the file is reformatted but the line width setting from .formatter.exs is ignored.
Expected behavior:
- Option 1: file is not reformatted on pipe code action
- Option 2: file is reformatted following the rules in
.formatter.exs
Observed behavior: line width setting from .formatter.exs is ignored when the "Introduce pipe" code action is applied, and the file is reformatted with a default line width (e.g. 80 characters) instead of the one specified in .formatter.exs (e.g. 120 characters).
Affected versions:
- Expert 0.1.0
- Editors tested:
- NeoVim 0.11
- Visual Studio Code 1.115.0 with official Expert LSP extension 0.3.1
Example
This is how it looks like:
Before
defmodule FormatterLineWidth do
# first, put `line_length: 120` into `.formatter.exs`
def function_to_apply_the_code_action_to() do
Map.put(%{}, :foo, :bar)
# ⮤ Apply the code action "Introduce pipe" here
end
def function_that_should_be_a_oneliner() do
some_function() |> some_function() |> some_function() |> some_function() |> some_function() |> some_function()
# ⮤ this expression fits within 114 characters and should stay on one line after the code action is applied
# The expression stays on one line when formatted with `mix format`, and also (e.g. on save) with Expert
end
def some_function(foo \\ 0), do: foo + 1
end
After
defmodule FormatterLineWidth do
# first, put `line_length: 120` into `.formatter.exs`
def function_to_apply_the_code_action_to() do
%{} |> Map.put(:foo, :bar)
# ⮤ Apply the code action "Introduce pipe" here
end
def function_that_should_be_a_oneliner() do
some_function()
|> some_function()
|> some_function()
|> some_function()
|> some_function()
|> some_function()
# ⮤ this expression fits within 114 characters and should stay on one line after the code action is applied
# The expression stays on one line when formatted with `mix format`, and also (e.g. on save) with Expert
end
def some_function(foo \\ 0), do: foo + 1
end
When the "Introduce pipe" code action is called, the file is reformatted but the line width setting from
.formatter.exsis ignored.Expected behavior:
.formatter.exsObserved behavior: line width setting from
.formatter.exsis ignored when the "Introduce pipe" code action is applied, and the file is reformatted with a default line width (e.g. 80 characters) instead of the one specified in.formatter.exs(e.g. 120 characters).Affected versions:
Example
This is how it looks like:
Before
After