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

hx --health rust-analyzer checked, but in helix nothing works for rust language support #6400

Closed
AddictArts opened this issue Mar 22, 2023 · 7 comments
Labels
C-bug Category: This is a bug

Comments

@AddictArts
Copy link

AddictArts commented Mar 22, 2023

Summary

hx --health rust-analyzer checked, but in helix nothing works for rust language support

Reproduction Steps

  1. Install and open a rust file on Windows with Terminal preview.

Helix log

~/.cache/helix/helix.log

No Log is generated, finally found it in AppData/Local/helix

2023-03-21T19:20:51.814 helix_view::editor [ERROR] Failed to initialize the LSP for `source.toml` { cannot find binary path }

Platform

Windows

Terminal Emulator

Terminal Preview

Helix Version

helix 22.08 (ee94031)

rustlings\exercises\threads (fc9fb53) via 🦀 v1.68.0 took 3m
❯ hx --health rust
Configured language server: rust-analyzer
Binary for language server: C:\Users\XYZ\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\rust-analyzer.EXE
Configured debug adapter: lldb-vscode
Binary for debug adapter: Not found in $PATH
Highlight queries: ✓
Textobject queries: ✓
Indent queries: ✓
@AddictArts AddictArts added the C-bug Category: This is a bug label Mar 22, 2023
@AddictArts
Copy link
Author

AddictArts commented Mar 22, 2023

Note: for anyone else, don't use helix on the rustlings stuff at least in terms of expecting the +k stuff to work. The format of the repo and exercises is the issue. Is there a workaround?

Note: helix is fine for syntax and editing, just no rust-analyzer support for rustlings repo.

@archseer
Copy link
Member

"nothing works for rust language support"

syntax highlighting? goto definition?

If the language server is installed, try starting helix with the -v flag and checking the log file for LSP related messages.

rust-analyzer specifically can take up to 10-30s easily to fully index the project. rust-analyzer also needs to be in a Cargo.toml workspace and won't work in a random directory with only .rs files.

@gabydd
Copy link
Member

gabydd commented Mar 22, 2023

I think this has to do with the lsp workspaces, as rustlings has multiple cargo projects in one git repository. Should be fixed by #5748

@anthonygedeon
Copy link

I think I just had this issue, helix started working when I added rust-analyzer to my .local/bin which is in my $PATH

@David-Else
Copy link
Contributor

David-Else commented Mar 23, 2023

@AddictArts

Rustlings with rust-analyzer is working fine here, it should work for you.

I am using the version of rust-analyzer supplied with the rust toolchain, I installed it all like this:

    bin_install_folder=/usr/local/bin

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    source "$HOME/.cargo/env"
    rustup component add rust-analyzer
    [ ! -e $bin_install_folder/rust-analyzer ] && sudo ln -s "$(rustup which rust-analyzer)" $bin_install_folder/rust-analyzer # https://github.com/rust-lang/rustup/pull/3022

EDIT: I just checked, from the next version of rustup you won't need to make a symlink rust-lang/rustup#3022 (comment)

@AddictArts
Copy link
Author

AddictArts commented Mar 27, 2023

syntax highlighting? goto definition?
...
rust-analyzer specifically can take up to 10-30s easily to fully index the project. rust-analyzer also needs to be in a Cargo.toml workspace and won't work in a random directory with only .rs files.

Hi @archseer,

There were 2 issues for me. The first is I am not coming from being a recent VIM / NEOVIM user who has seen the rust-analyzer and lsp's working in editor. I didn't know what to look for. Hard to know other than the health check. The docs could help here with examples of what to look for. Hopefully this will make its way someday, certainly this issue could help anyone looking. I finally noticed the lower corner spinner and messages after small config update to show it.

I last heavily used VI in the 90's on RS6000 machines IBM AIX.

The second issue was rustlings, which appears to be my fault and I finally ran the rustlings lsp per docs and help here. It is all working now. Thanks all and thanks @David-Else, indeed I must not have followed rustlings docs closely enough.

@the-mikedavis
Copy link
Member

I'll close this as the problems are resolved. If you have specific ideas for docs improvements, feel free to open issues/PRs for those or edit the Wiki pages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

6 participants