Open Zalastax opened 5 years ago
Hi,
Sorry for the delay.
I am not used to using escript, can you give me detail about it ? so i take a sample from erlang documention... but plugin didn't failed...
here is my sample :
%% -- erlang -- %%! -smp enable -sname factorial -mnesia debug verbose main([String]) -> try N = list_tointeger(String), F = fac(N), io:format("factorial ~w = ~w\n", [N,F]) catch : -> usage() end; main() -> usage().
usage() -> io:format("usage: factorial integer\n"), halt(1).
fac(0) -> 1; fac(N) -> N * fac(N-1).
The issue is quite weird it seems.
I took your sample and wrote it to a file test.erl
. Setting the language to Erlang, everything works. However, if I restart the editor:
test.erl
automatically[erl] syntax error before: '#' (1, 1)
Switching the language to something else and then back to Erlang, the error disappears.
Hi,
In the mentioned example the first line is not part of the language at any means and ignored by escript (used by Linux shell). Since I've got no error on the first line I guess it's solved in the meantime. The second line is exclusively for Emacs as it was the de-facto editor in the good old days, other editors treat is as a simple comment without no meaning. The third line is used by escript if present but it's a simple comment even for Emacs.
Extension .escript
is now associated to erlang extension. If other extensions are preferred then a VSC extension like Shebang Language Associator could be handy.
When writing an escript, the file will start with a shebang, e.g.
#!/usr/bin/env escript
. It would we very nice if the shebang didn't cause the plugin to fail completely.