Hi @Mpanarin,
I’m not sure if you solved your problem. I have one repo that is shared between electronjs and elixir/phoenix projects. The mix.exs is in subfolder of that repo, so elixir-ls has problem locating it. I was trying to apply suggestions from the wiki but it didn’t work for me. So I looked at lsp repo and elixir support there. I found that there are custom variables defined that you can tune. One specific to project location is called lsp-elixir-project-dir. So you have an option just to set it whenever you work with the project or you can automate it.
Looking at lsp repo I found that the function it is using to change elixir-ls options is lsp-register-custom-settings, so I made the following changes:
In init.el (or .emacs) I put the following:
(add-hook 'lsp-after-initialize-hook
(lambda ()
(lsp-register-custom-settings '(("elixirLS.projectDir" lsp-elixir-project-dir)))))
I also created a file called .dir-locals.el in the root folder of my repo with the following content:
((nil . ((lsp-elixir-project-dir . "/<path name of my repo with mix.exs in>"))))
Having these two pieces worked for me. The file local custom variable lsp-elixir-project-dir is set (or default) depending on the repo I’m working with.
If you would like to change some other options It would probably require to add more options to hook function above. Here is a complete list of valiables that lsp-mode sets for elixir when the elixir mode is initialized:
(lsp-register-custom-settings
'(("elixirLS.dialyzerEnabled" lsp-elixir-dialyzer-enabled t)
("elixirLS.dialyzerWarnOpts" lsp-elixir-dialyzer-warn-opts)
("elixirLS.dialyzerFormat" lsp-elixir-dialyzer-format)
("elixirLS.mixEnv" lsp-elixir-mix-env)
("elixirLS.mixTarget" lsp-elixir-mix-target)
("elixirLS.projectDir" lsp-elixir-project-dir)
("elixirLS.fetchDeps" lsp-elixir-fetch-deps t)
("elixirLS.suggestSpecs" lsp-elixir-suggest-specs t)
("elixirLS.signatureAfterComplete" lsp-elixir-signature-after-complete t)
("elixirLS.enableTestLenses" lsp-elixir-enable-test-lenses t)))
You can just copy/paste lines you are interested in tuning then use the custom variables to make changes.
I hope it helps,
Pawel






















