Code Monkey home page Code Monkey logo

Comments (17)

lud-wj avatar lud-wj commented on May 30, 2024 1

IIRC the compilation was long time finished. Plus listing the current file symbols works well.

I'm leaving the office for now but I can run any tests you want later.

Erlang/OTP 25 [erts-13.0] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]

Elixir 1.14.0 (compiled with Erlang/OTP 25)

from next-ls.

lud-wj avatar lud-wj commented on May 30, 2024

I think you will need to evaluate the compile-time config files, otherwise it is possible that some user modules do not compile at all. (For instance, anything that call Application.compile_env! is at risk.

So I believe it is just the runtime.exs that should be skipped.

A very very dirty solution would be to redefine the Mix.Tasks.Loadconfig module, with a no-op function as load_runtime/1.

What is strange is that NextLS is not supposed to boot the user application, is it? If I raise in my runtime.exs and run mix compile it works, because it is not evaluated at compile-time. So why does NextLS evaluates that file instead of its own configuration?

from next-ls.

mhanberg avatar mhanberg commented on May 30, 2024

I think you will need to evaluate the compile-time config files, otherwise it is possible that some user modules do not compile at all.

Yes, I was thinking that even dependencies sometimes need app config when compiling, so they have to run.

What is strange is that NextLS is not supposed to boot the user application, is it?

Next LS starts your project with a bunch of flags to not actually start anything, just load your code and deps into a VM that is then connected to Next LS via distributed erlang.

from next-ls.

lud-wj avatar lud-wj commented on May 30, 2024

Would it be imaginable that NextLS starts a custom application in that VM, just adding the elixirc_paths of the user project to its own paths, dynamically or in mix.exs. That way you do not need flags because the mod in .app is not the user's.

That would sill require to copy the config files or something...

from next-ls.

mhanberg avatar mhanberg commented on May 30, 2024

I think a workaround for you right now would be to wrap your entire runtime.exs file in if not System.get_env("NEXT_LS_PARENT_PID") do

this env var is set by Next LS, so if it is present, it means you are in Next LS and can avoid executing anything

from next-ls.

mhanberg avatar mhanberg commented on May 30, 2024

I published 0.5.2 that sets an LSP variable, so you can do if System.get_env("LSP") do

from next-ls.

lud-wj avatar lud-wj commented on May 30, 2024

Using NEXT_LS_PARENT_PID works with a custom run with TCP but it does not work with the default stdio adapter (and letting the extension start it itself)

[Error - 13:06:35] Client NextLS: connection to server is erroring. Shutting down server.
[Error - 13:06:35] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: starting

I'm using vscode and the last extension version is one week old so I did not try with the "LSP" variable.

Besides, when I start the tool from a shell ( NEXTLS_VERSION=0.5.1 /home/lud/.vscode/extensions/elixir-tools.elixir-tools-0.2.2/bin/nextls --port 9999 ) the vscode output shows that the app is compiling, an I can have the current file symbols, but there is no code formatting nor go-to-definition and the workspace symbols do not work, they always display the symbols for the same module. Not sure if it is expected or related to the runtime.exs problem though.

( Same with NEXTLS_VERSION=0.5.2 )

from next-ls.

mhanberg avatar mhanberg commented on May 30, 2024

The extension version is not tied to the NextLS version. When you start it normally it will fetch the latest version of NextLS.

With regard to your last statement, did you let it finish compiling? Or were those features not working while it was compiling?

from next-ls.

mhanberg avatar mhanberg commented on May 30, 2024

Can you remind me what your exact elixir and OTP versions are?

from next-ls.

mhanberg avatar mhanberg commented on May 30, 2024

@lud-wj

Let me know if you get to try this out again and if it fixed your issues.

from next-ls.

lud-wj avatar lud-wj commented on May 30, 2024

Hello, I see a vscode version from 4 days ago. Same errors on my side, telling that the server cannot be started

It works though, if I run the server manually and connect with TCP with this version of the extension:

NEXTLS_VERSION=0.5.4 /home/lud/.vscode/extensions/elixir-tools.elixir-tools-0.3.0/bin/nextls --port 9999

from next-ls.

mhanberg avatar mhanberg commented on May 30, 2024

The vscode extension version is not tied to the next ls version. It always fetches the latest version of next ls automatically.

But, you now can set the version from the extension. Could you try that just to be sure?

from next-ls.

lud-wj avatar lud-wj commented on May 30, 2024

I can confirm that it works now with this configuration:

  "elixir-tools.credo.enable": false,
  "elixir-tools.nextls.enable": true,
  "elixir-tools.nextls.version": "0.5.4",

Though "Go To Definition" works only for a few cases (full module name, no aliases, and only for some modules). Is there a way to debug that?

from next-ls.

mhanberg avatar mhanberg commented on May 30, 2024

Delete the .elixir-tools folder so it forces it to rebuild the lookup table.

from next-ls.

lud-wj avatar lud-wj commented on May 30, 2024

No changes unfortunately. I can try to debug to see why, I do not know when though.

from next-ls.

mhanberg avatar mhanberg commented on May 30, 2024

Make sure they aren't anything in these cases that haven't been implemented yet: https://www.elixir-tools.dev/next-ls/#definition

from next-ls.

lud-wj avatar lud-wj commented on May 30, 2024

Ah yes, that should be it. Thank you.

from next-ls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.