espec
espec copied to clipboard
Syntax doesn't play nicely with vimerl
Possible related to the first answer mentioned on https://github.com/jimenezrick/vimerl/issues/7
Auto indenting ends up with:
spec() ->
describe("beforespec", fun() ->
it("should do stuff", fun() ->
io:format("output from: it should do stuff~n", [])
end),
end).
It should be:
spec() ->
describe("beforespec", fun() ->
it("should do stuff", fun() ->
io:format("output from: it should do stuff~n", [])
end),
end).
there are a couple of alternative syntaxes we could use.
for example the following plays nice with vimerl and is valid erlang:
spec() ->
describe("blah",
it("should do stuff",
X = 2,
Y = 3
)
).
i've tried a bunch of different erlang expressions and they all seem to play nice. i assume since everything in erlang is an expression then it doesn't really matter if you are in a function body or in the actual params to a function call but i might be wrong here.
though, i can see how people might be wtffffff
there is also the more rubyish syntax but that doesn't play nice with vimerl :(
describe("foo", begin
it("should do stuff", begin
X = 2,
Y = 3
end)
end).
i also like this syntax:
describe("foo"), begin
it("should do stuff"), begin
X = 2,
Y = 3
end
end.
doesn't play nice with vimerl and is kind of evil
Hmm. I don't think any of those are really nicer than what we have at the moment. Maybe it can be easily fixed in Vimerl?
maybe the fix is use a proper editor like emacs or textmate :)
:P
Do Textmate and Emacs handle it fine?
textmate works for me but emacs has an even worse behaviour. the first indent of the body of a fun starts at the character after the fun() ->.