Using an Erlang LSP server with Sublime Text 3
Torben Hoffmann
torben.lehoff@REDACTED
Tue Jan 21 17:35:23 CET 2020
Hi Roberto,
Thanks for taking the time to look into this. Sorry about the lag - I'm on
a business trip and have been rather busy.
I have tried using your config settings, but I still get the "Unable to
open…" error message and there is no Erlang LS in sight when I try to
enable it.
At this point I'm suspecting that this is a problem between Sublime and
LSP, so I'll try to get some help on that.
I will report back with my findings.
Cheers,
Torben
On Sat, 18 Jan 2020 at 20:52, Roberto Aloi <prof3ta@REDACTED> wrote:
> Hi Torben!
>
> I'm using this language server for Erlang: github.com/erlang-ls/erlang_ls
>
>
> Nice that you are taking Erlang LS for a spin. We haven't tried the server
> with Sublime text yet, so I gave Sublime I try just now (I think I have all
> possible editors on my laptop now). Disclaimer: I am not a Sublime user, so
> take my response with a grain of salt.
>
> Looking in the console for ST3 I find a complaint about Rebar (the ancient
>> one, so I'm ignoring that for now) and a problem wrt reading a config file:
>> Unable to open /Users/torben.hoffmann/Library/Application Support/Sublime
>> Text 3/Packages/LSP/LSP.sublime-settings
>> Which is a bit confusing because that file is at
>> Packages/User/LSP.sublime-settings.
>>
>
> I wouldn't worry about that. It seems the LSP Package for Sublime uses a
> default settings file (the one in [...]/LSP/LSP.sublime-settings)
> and one for the user overrides (the one in
> [...]/User/LSP.sublime-settings).
>
> So, what I did to get the connection to the Erlang LS working:
>
> Preferences -> Package Settings -> LSP -> Settings
>
> Added:
>
> {
> "clients":
> {
> "erlang-ls":
> {
> "command":
> [
> "/path/to/my/erlang_ls", "--transport", "stdio"
> ],
> "enabled": true,
> "languageId": "erlang",
> "scopes":
> [
> "source.erlang"
> ],
> "syntaxes":
> [
> "Packages/Erlang/Erlang.sublime-syntax"
> ]
> }
> }
> }
>
> Even if I have `erlang_ls` in my $PATH, I had to use an absolute path. I
> guess there's some way to pass the correct $PATH to Sublime, but I haven't
> tried that. Some Sublime user may help with that.
> That's all it was required to get things working. One thing I noticed is
> that, if you open a single .erl file, Sublime will complain about an error
> during the error initialization.
> Instead, you should open the "project" first (i.e. the directory
> containing your Erlang file), then the file. This seems due to a bug in
> Erlang LS which always expects a non-null "root path" to be passed during
> initialization and in Sublime that happens only if you open a directory
> first. Indeed the LSP protocol specifies that the "root path" can be null,
> so we will fix that. Fro the time being, please use the workaround.
>
> I will add the above to the Erlang LS README. We should also try to get
> Erlang LS included in the Sublime LSP Package to ease installation.
> Contributions are always welcome :)
>
> But given the nature of the error messages I don't think that is
>> the issue, at least not yet ;-)
>
> Now that you are in Erlang LS land, feel free to use the #language-server
> channel in the Erlanger Slack or our github issue tracker at
> github.com/erlang-ls/erlang_ls to get in touch!
>
> Best,
>
> Roberto
>
>
--
http://www.linkedin.com/in/torbenhoffmann
@LeHoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200121/4dbd77b9/attachment.htm>
More information about the erlang-questions
mailing list