satoru

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

Dusty

Hi @satoru,

The community has rallied behind the ElixirLS extension, which is the most actively maintained. Perhaps see if it serves your purpose?

lukaszsamson

lukaszsamson

ElixirLS Core Team

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

lukaszsamson

ElixirLS Core Team

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

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

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:

  1. You open a single file without opening any folder or workspace in VSC.
  2. 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.
  3. 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.

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3268 119930 1237
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

We're in Beta

About us Mission Statement