lexical-lsp / lexical

Lexical is a next-generation elixir language server
883 stars 82 forks source link

Support `Mix.install` in `.exs` files #403

Open zachallaun opened 1 year ago

zachallaun commented 1 year ago

If you have a file in a project directory that uses Mix.install, Lexical will generate a warning when you open it along the lines of "Mix.install cannot be used inside a mix project." This is because Lexical always compiles files in the current project's node.

I'm not sure what the best way forward is for supporting Mix.install. One option is to treat a .exs that uses Mix.install as its own project containing just one file. I think we'd have to parse out the deps & options from the Mix.install call and use them to set up the new remote node, and then possibly strip that call from the source before compiling...? But maybe there's an easier way.

cd-slash commented 5 months ago

Got a warning just after installing lexical regarding my line Mix.install([{:jason, "~> 1.4"}]): cannot retrieve dependencies information because dependencies were not loaded. Please invoke one of "deps.loadpaths", "loadpaths", or "compile" Mix task.

Not sure if this is because Mix.install still isn't supported or if I'm somehow using incorrectly? The script compiles and runs without any errors or issues.

scohen commented 5 months ago

Mix install isn't supported yet