Code Monkey home page Code Monkey logo

Comments (22)

JakeBecker avatar JakeBecker commented on July 23, 2024 1

The latest release of the VS Code extension (v0.2.13) should fix this. Give it a try!

from elixir-ls.

JakeBecker avatar JakeBecker commented on July 23, 2024

Try downloading the elixir-ls.zip here and extract it, then try running language_server.sh (or .bat on Windows) from a terminal. If that fails, hopefully it'll give a more informative error. If it works, I probably should add better logging to the extension so we can figure out what's going on when it fails to launch.

from elixir-ls.

JakeBecker avatar JakeBecker commented on July 23, 2024

Oh, also check the dev console (Help > Toggle Developer Tools)

from elixir-ls.

kokjinsam avatar kokjinsam commented on July 23, 2024

So I downloaded and extracted the folder.

In terminal, I did:

sammkj@sammkj:~/Downloads$ chmod 777 language_server.sh
sammkj@sammkj:~/Downloads$ ./language_server.sh
Content-Length: 101

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Started ElixirLS\n","type":4}}

Then in devtool, I saw some errors when I tried to save .ex file.

image

from elixir-ls.

JakeBecker avatar JakeBecker commented on July 23, 2024

Okay, try this: git clone --recursive [email protected]:JakeBecker/vscode-elixir-ls.git

Then open that project in VS Code and run the "Launch Extension" debug configuration. If everything goes wrong, it should break when it gets a message from the server and you can see what it is here:
screen shot 2018-02-24 at 11 50 31 am

Hopefully we'll be able to see what the server's sending that's messing things up.

from elixir-ls.

kokjinsam avatar kokjinsam commented on July 23, 2024

Okay.

Here's what I did:

git clone --recursive https://github.com/JakeBecker/vscode-elixir-ls.git
cd vscode-elixir-ls
yarn install
cd elixir-ls
mix deps.get

Then I opened the folder with VS Code and tried to debug it, saw nothing in any of the panels. 🤔

from elixir-ls.

kokjinsam avatar kokjinsam commented on July 23, 2024

I even uninstalled and re-installed VS Code. No difference noted.

from elixir-ls.

JakeBecker avatar JakeBecker commented on July 23, 2024

Open the parent folder, vscode-elixir-ls. It should have debug configurations already.

from elixir-ls.

kokjinsam avatar kokjinsam commented on July 23, 2024

yeap. that's what I did.

from elixir-ls.

JakeBecker avatar JakeBecker commented on July 23, 2024

In the VS Code window it launches, you need to open an Elixir project and open an elixir source file. That should launch the language server, which should then crash and you can debug the exception in the original VS Code window.

from elixir-ls.

kokjinsam avatar kokjinsam commented on July 23, 2024

This is what I saw:

image

from elixir-ls.

kokjinsam avatar kokjinsam commented on July 23, 2024

So apparently this Logger.debug("Disabling Timber logger") in config/config.ex is causing problem.

from elixir-ls.

JakeBecker avatar JakeBecker commented on July 23, 2024

Now I'm intrigued!

Try creating a new, empty Mix project and see if the language server launches on that. If it doesn't, please post a mix project somewhere that reproduces the error so I can check it out.

from elixir-ls.

fkumro avatar fkumro commented on July 23, 2024

Looks like I reported the same issue in the wrong repo: JakeBecker/vscode-elixir-ls#43

The source I am using worked on another OS (LinuxMint vs PopOS), so the mix file hasn't changed between working and none working installs.

Project (use the sensors branch) that causes the issue for me: https://gitlab.com/fkumro/lake_effect/commits/sensors

I launched the debugger for the extension, and my other Elixir project builds the core PLT. Nothing is shown in the debug console for the project that contains the errors (shown below).

screenshot from 2018-03-01 11-30-41

from elixir-ls.

JakeBecker avatar JakeBecker commented on July 23, 2024

@fkumro Thanks for posting that project, I can reproduce the problem on it. I'm looking into it.

from elixir-ls.

JakeBecker avatar JakeBecker commented on July 23, 2024

Okay, I've figured out the problem.

The first thing ElixirLS does when it launches is replace the built-in process for stdout with another process that wraps any output with a window/logMessage JSON message. But before Mix even launches the language server task, it loads the mixfile from the current folder, so if there's any print statements in the mixfile, it will print those without wrapping them.

I'm working on a fix.

from elixir-ls.

fkumro avatar fkumro commented on July 23, 2024

Excellent! I was also thinking what may have changed between my environments. I ended up upgrading to Nerves 1.0.0-rc.1 which may have changed what is sent to stdout. That would explain the timing of receiving the issue on my end.

from elixir-ls.

JakeBecker avatar JakeBecker commented on July 23, 2024

I'll do a release sometime in the next week or so with this fix, but for now, you can comment out any print or log calls in your mixfile.

from elixir-ls.

fkumro avatar fkumro commented on July 23, 2024

Thanks, in my case it was the call to Mix.shell().info

from elixir-ls.

fkumro avatar fkumro commented on July 23, 2024

removing contents of comment, issue was I didn't default a target when using it to include other configs.

from elixir-ls.

JakeBecker avatar JakeBecker commented on July 23, 2024

Ah... @fkumro, your "lake_effect" project is actually a good test case because of how complicated its setup is. I was able to reproduce the error and I think I've fixed it in a release I've just published (v0.2.14).

In the previous fix, I was able to have Mix avoid loading the project's mixfile until we've started intercepting stdout. But it would still try to load the config files, and in your project, that fails if the mixfile hasn't been loaded.

I've revised the way the server is launched now and it seems to fix it on your project. Please update and give it a try.

from elixir-ls.

fkumro avatar fkumro commented on July 23, 2024

Tested the latest release (v0.2.14) with my previous change removed. Works like a charm @JakeBecker, thanks!!

from elixir-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.