elixir-tools.vscode icon indicating copy to clipboard operation
elixir-tools.vscode copied to clipboard

Nextls server running in wrong workspace, keeps notifying of failed install deps

Open rvonzimr opened this issue 1 year ago • 10 comments

I have a few separate elixir projects that I normally keep in a single workspace. Right now I'm seeing strange behavior looking at the nextLS log. With a few elixir projects app, chat, and core, within ./app/.elixir-tools/next-ls.log, I see:

10:04:52.454 [debug] sent notification server -> client $/progress

10:04:52.454 [debug] sent notification server -> client window/logMessage

10:04:52.454 [debug] Runtime for folder core is ready...

It seems NextLS is using the wrong project root between projects? Sometimes it doesn't complain, and things seem to work, other times it will continue to request to reinstall deps.. leading to duplicate builds running on each workspace: image

when this happens, in the app log, I see:

10:10:21.423 [error] Runtime for folder chat failed to initialize

10:10:21.423 [debug] sent notification server -> client window/logMessage

10:10:21.423 [error] The runtime for chat has crashed with reason: {:shutdown, :unchecked_dependencies}

I noticed a closed issue that seems related: https://github.com/elixir-tools/elixir-tools.vscode/issues/85 Is this something that will not ever be supported? Hoping to switch away from Elixir LS, as it's very slow in giving back useful info but it does support workspaces. Here's the output panel showing each extension being run: image

rvonzimr avatar Jul 02 '24 17:07 rvonzimr

Question:

Do you have completions enabled? what elixir and OTP version(s) are you using with your projects?

There is a bug in a rebar3 dependency with 1.17/OTP27 that has a bug, and if you have completions enabled, it will internally use Elixir 1.17 instead of your system version (found on the PATH), which would lead i believe to dependency failures.

The dependencies are snappyer and port_compiler, and you can't actually easily update them because its a rebar3 plugin.

If it's not related to that, then I'll dig further.

Another thing to clarify regarding the .elixir-tools folder, it creates one in the folder's root and also the pwd of wherever nextls was actually started, and it seems like vscode is just picking one of the folders to start the exe in, not entirely sure why.


Regarding that previous issue, I think I misunderstood the screenshot and used the incorrect terminology, as the OP of that issue actually already did what I thought needed to be done, but I am not able to reproduce.

mhanberg avatar Jul 02 '24 18:07 mhanberg

Question:

Do you have completions enabled? what elixir and OTP version(s) are you using with your projects?

There is a bug in a rebar3 dependency with 1.17/OTP27 that has a bug, and if you have completions enabled, it will internally use Elixir 1.17 instead of your system version (found on the PATH), which would lead i believe to dependency failures.

The dependencies are snappyer and port_compiler, and you can't actually easily update them because its a rebar3 plugin.

If it's not related to that, then I'll dig further.

Another thing to clarify regarding the .elixir-tools folder, it creates one in the folder's root and also the pwd of wherever nextls was actually started, and it seems like vscode is just picking one of the folders to start the exe in, not entirely sure why.

Regarding that previous issue, I think I misunderstood the screenshot and used the incorrect terminology, as the OP of that issue actually already did what I thought needed to be done, but I am not able to reproduce.

running elixir through ASDF, don't have elixir installed outside of that.

✗ elixir --version
Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:20:20] [ds:20:20:10] [async-threads:1] [jit:ns]

Elixir 1.15.7 (compiled with Erlang/OTP 26)

The extension runs fine when I only have a single elixir project loaded up as well

rvonzimr avatar Jul 02 '24 20:07 rvonzimr

@rvonzimr lets continue to only chat in this issue, but please see my response i put in the other issue: https://github.com/elixir-tools/elixir-tools.vscode/issues/85#issuecomment-2206549892

mhanberg avatar Jul 03 '24 15:07 mhanberg

@rvonzimr lets continue to only chat in this issue, but please see my response i put in the other issue: #85 (comment)

that deps issue was silly of me :disappointed:

thanks for investigating the "go to definition" issue -- can you also find references? What about syntax errors / type issues?

rvonzimr avatar Jul 03 '24 16:07 rvonzimr

yes, everything works as expected except for go to definition.

mhanberg avatar Jul 03 '24 17:07 mhanberg

Seems like it was a bug, patch incoming.

mhanberg avatar Jul 03 '24 17:07 mhanberg

Same here, happens with umbrella dependencies. Any updates on this?

brunohkbx avatar Nov 27 '24 18:11 brunohkbx

Same here, happens with umbrella dependencies. Any updates on this?

can you clarify exactly what your issue is? This issue issue already suffered from some confusion.

mhanberg avatar Nov 27 '24 19:11 mhanberg

I installed the vscode extension but it can't seem to work due to the following error: The runtime for *** has crashed with reason: {:shutdown, :unchecked_dependencies}

Here's the complete log:

[Info  - 4:38:50 PM] [Next LS] Running `mix deps.get` in directory ***
[Info  - 4:38:55 PM] [Next LS] Restarting runtime *** for directory ***
[Info  - 4:38:55 PM] [Next LS] Resolving Hex dependencies...
Resolution completed in 1.371s
Unchanged:
  ...
[Info  - 4:38:55 PM] [Next LS] Beginning DB migration...
[Info  - 4:38:55 PM] [Next LS] Database is on the latest version: 7
[Info  - 4:38:55 PM] [Next LS] Finished DB migration...
[Info  - 4:38:55 PM] [Next LS] Booting runtime for ***.

- elixir: ***/.asdf/shims/elixir
- zombie wrapper script: ***/.local/share/.burrito/next_ls_erts-15.0_0.23.2/lib/next_ls-0.23.2/priv/cmd
- working_dir: ***
- command: ***/.asdf/shims/elixir --no-halt --sname nextls-runtime-1732736335825693966 --cookie Z4ER2X2KFNZWMEC65F5SIBKLBWALO6AXJYUMIFNSO6GV3FRQKUZA==== -S mix loadpaths --no-compile

Environment: 

LSP=nextls
NEXTLS_PARENT_PID=g1h3PG5leHQtbHMtMTczMjczNjI5NTYyMzIwMDQ2MUBicnVuby1MYXB0b3AtMTJ0aC1HZW4tSW50ZWwtQ29yZQAAAPUAAAAAZ0d1KA==
MIX_ENV=dev
MIX_TARGET=host
MIX_BUILD_ROOT=.elixir-tools/_build
ROOTDIR=false
BINDIR=false
RELEASE_ROOT=false
RELEASE_SYS_CONFIG=false
PATH=***
[Info  - 4:38:56 PM] [Next LS] Connected to node ***
[Next LS] Runtime for folder *** is ready...
[Next LS] Unchecked dependencies for environment dev:
* admin_web (apps/admin_web)
  the dependency is not available
[Error - 4:38:57 PM] [Next LS] Runtime for folder *** failed to initialize
[Error - 4:38:57 PM] [Next LS] The runtime for *** has crashed with reason: {:shutdown, :unchecked_dependencies}
[Info  - 4:38:57 PM] [Next LS] Booting runtime for ***.

- elixir: ***/.asdf/shims/elixir
- zombie wrapper script: ***/.local/share/.burrito/next_ls_erts-15.0_0.23.2/lib/next_ls-0.23.2/priv/cmd
- working_dir: ***
- command: ***/.asdf/shims/elixir --no-halt --sname nextls-runtime-1732736337157197105 --cookie Z4ER2X2KFNZWMEC65F5SIBKLBWALO6AXJYUMIFNSO6GV3FRQKUZA==== -S mix loadpaths --no-compile

Environment: 

LSP=nextls
NEXTLS_PARENT_PID=g1h3PG5leHQtbHMtMTczMjczNjI5NTYyMzIwMDQ2MUBicnVuby1MYXB0b3AtMTJ0aC1HZW4tSW50ZWwtQ29yZQAAAPUAAAAAZ0d1KA==
MIX_ENV=dev
MIX_TARGET=host
MIX_BUILD_ROOT=.elixir-tools/_build
ROOTDIR=false
BINDIR=false
RELEASE_ROOT=false
RELEASE_SYS_CONFIG=false
PATH=***
[Info  - 4:38:57 PM] [Next LS] The runtime for *** has successfully shut down.

brunohkbx avatar Nov 27 '24 19:11 brunohkbx

Is the working_dir (redacted from your logs) the child app in the umbrella or the whole app?

mhanberg avatar Nov 27 '24 22:11 mhanberg