satoru
VSCode autocomplete doesn't work for mix-created projects
I’ve installed vscode-elixir and autocomplete works as expected when I’m editing single files.
But when I create projects with mix new, the autocomple doesn’t work.
It’s quite weird, when I run code something.ex in the root of the project directory, autocomplete works. But it doesn’t work for mix.exs in the same directory.
Most Liked
Dusty
lukaszsamson
I wouldn’t expect vscode-elixir to work properly on anything newer than elixir 1.5. it uses an over 3 years old elixir_sense dependancy. A lot has changed in elixir internals since then (especially in 1.7 and 1.10).
@satoru Could you post a more complete error log from ElixirLS?. Also how did you install erlang and elixir?
Please note that for ElixirLS to work other extensions may need to be disabled.
lukaszsamson
Thanks. It looks like your project dir is set to nil for some reason.
It’s crashing in line
Path.join([project_dir, ".elixir_ls", ".gitignore"])
Try setting it to . in extension settings
satoru
Thanks.
This seems to be relevant to the issue.
After change projectDir to ".", ElixirLS works for all both existing and newly created mix projects. But it still fails when editing single files outside any project, eg, code hello.exs.
Dusty
Does it make any difference if you are inside a VS Code workspace or not? There are a few scenarios I can think of:
- You open a single file without opening any folder or workspace in VSC.
- You open a folder, but not a workspace, and:
a. The folder contains the file of interest.
b. The folder does not contain the file of interest. - You open a VSC workspace and:
a. The workspace contains the file of interest.
b. The workspace does not contain the file of interest.
I suspect your troubles may be related to the idea of spawning language servers per workspace. That might affect the scenario where you open a file outside any workspace, or where the file is not in the folder of the current workspace.
Perhaps one of the primary contributors can comment.







