如何设置 Elixir 1.6 格式化程序在模块函数之间添加 2 行?
How to set Elixir 1.6 formatter to add 2 new lines between module functions?
是否可以配置 .formatter.exs
以便格式化程序在模块中的函数之间添加 2 行?
示例:
@spec start_link(String.t()) :: {:error, String.t()} | {:ok, pid()}
def start_link(url) do
Agent.start_link(fn -> %Links{url: url, remaining: [url]} end)
end
# 2 lines
#
@spec has_more_links?(pid()) :: boolean()
def has_more_links?(agent_pid) do
length(get_remaining_links(agent_pid)) > 0
end
谢谢!
目前不支持此功能。 documentation 表示:
The formatter respects the input format in some cases. Those are
listed below:
...
Newlines inside blocks are kept as in the input
except for: 1) expressions that take multiple lines will always have
an empty line before and after and 2) empty lines are always
squeezed together into a single empty line
...
是否可以配置 .formatter.exs
以便格式化程序在模块中的函数之间添加 2 行?
示例:
@spec start_link(String.t()) :: {:error, String.t()} | {:ok, pid()}
def start_link(url) do
Agent.start_link(fn -> %Links{url: url, remaining: [url]} end)
end
# 2 lines
#
@spec has_more_links?(pid()) :: boolean()
def has_more_links?(agent_pid) do
length(get_remaining_links(agent_pid)) > 0
end
谢谢!
目前不支持此功能。 documentation 表示:
The formatter respects the input format in some cases. Those are listed below:
...
Newlines inside blocks are kept as in the input except for: 1) expressions that take multiple lines will always have an empty line before and after and 2) empty lines are always squeezed together into a single empty line
...