next-ls
next-ls copied to clipboard
workspace command: convert an if into a cond
A workspace command that converts an if expression into a cond expression
Example:
defmodule Example do
def run(foo) do
if foo do
:ok
else
:error
end
end
end
Using the workspace command on the if
keyword of the expression will result in:
defmodule Example do
def run(foo) do
cond do
foo ->
:ok
true ->
:error
end
end
end
Consider the following:
- Inline if/else statements (keyword arg verisions