Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with pyls #33

Closed
tuxiqae opened this issue Jun 1, 2021 · 8 comments · Fixed by #170 or #287
Closed

Issues with pyls #33

tuxiqae opened this issue Jun 1, 2021 · 8 comments · Fixed by #170 or #287
Labels
A-language-server Area: Language server client C-bug Category: This is a bug

Comments

@tuxiqae
Copy link

tuxiqae commented Jun 1, 2021

Seems like Helix panics when it tries to open Python files specifically, I tried both large and small files, it panicked on both, both when the file is given using the CLI and both when selected through the :open <file.py> option.
I was able to open TOML, Rust, C, C++, txt, XML, CSV, JSON perfectly well.

❯ hx ~/path/to/file.py
thread 'tokio-runtime-worker' panicked at 'called `Option::unwrap()` on a `None` value', helix-lsp/src/transport.rs:103:60
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', helix-lsp/src/client.rs:156:18

Reproducible in both helix-git and helix-bin AUR packages.
(Seems like it also panics when I try to extract the version on the helix-git package)

❯ hx --version
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)', helix-term/src/main.rs:117:46
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Active Rust versions:

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.54.0-nightly (657bc0188 2021-05-31)
@archseer
Copy link
Member

archseer commented Jun 2, 2021

It looks like you have pyls installed and it's failing to communicate with it (can't find the Content-Length header).

Do you have a sample project I could test on?

@tuxiqae
Copy link
Author

tuxiqae commented Jun 2, 2021

You may try testing on my WIP project https://github.com/tuxiqae/Friecipe

Or any other Python project TBH

@tuxiqae
Copy link
Author

tuxiqae commented Jun 2, 2021

P.S. Seems like pyls really isn't working

 ❯ pyls
Traceback (most recent call last):
  File "/home/user/.local/bin/pyls", line 5, in <module>
    from pyls.__main__ import main
ModuleNotFoundError: No module named 'pyls'

@IceDragon200
Copy link
Contributor

IceDragon200 commented Jun 2, 2021

So this is a language server integration issue, I was able to navigate your project without issue, but I don't have pyls at all, so that may have helped.

I think the editor should probably show an error, saying it couldn't start/communicate with the language server and just disables it to prevent crashing unexpectedly

@archseer
Copy link
Member

archseer commented Jun 8, 2021

Reopening because I'd still like to solve the underlying cause, but at least it shouldn't panic anymore

@archseer archseer changed the title Panics when Python files are opened Issues with pyls Jun 8, 2021
@archseer archseer added the A-language-server Area: Language server client label Jun 8, 2021
@malte-v
Copy link
Contributor

malte-v commented Jun 18, 2021

I don't think this is specific to pyls. I frequently get random crashes with rust-analyzer, too.

@malte-v
Copy link
Contributor

malte-v commented Jun 18, 2021

Some debug logging reveals that language servers may sometimes send ill-formed messages:

2021-06-18T19:11:50.957 helix_lsp::transport [INFO] header: Content-Length: 111
2021-06-18T19:11:50.957 helix_lsp::transport [INFO] header: 
2021-06-18T19:11:50.957 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":142,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Indexing"}}
2021-06-18T19:11:50.957 helix_lsp::transport [INFO] header: Content-Length: 141
2021-06-18T19:11:50.957 helix_lsp::transport [INFO] header: 
2021-06-18T19:11:50.957 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"begin","title":"Indexing","percentage":0}}}
2021-06-18T19:11:50.961 helix_lsp::transport [INFO] header: Content-Length: 157
2021-06-18T19:11:50.961 helix_lsp::transport [INFO] header: 
2021-06-18T19:11:50.961 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":142}
2021-06-18T19:11:50.961 helix_lsp::transport [INFO] header: {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","message":"40/523 (tokio_macros)","percentage":7}}}Content-Length: 156
2021-06-18T19:11:50.961 helix_lsp::transport [INFO] header: 
<crash happened here>

Notice that the last message does not look right at all.

@malte-v
Copy link
Contributor

malte-v commented Jun 18, 2021

#306 should fix this issue. (I think the pyls error is also caused by the content_length unwrap.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client C-bug Category: This is a bug
Projects
None yet
4 participants