sigmaSd / IRust

Cross Platform Rust Repl
https://crates.io/crates/irust
MIT License
633 stars 34 forks source link

Autocomplete doesn't work #129

Open feribg opened 11 months ago

feribg commented 11 months ago

I have the latest version of irust, rust_analyzer and everything work fine in Helix and VSCode, but the autocomplete doesn't work in irust in kitty or default ubuntu terminal. I have the rust_analyzer config flag set to true. How can that be debugged ?

sigmaSd commented 11 months ago

The completion only work when you press Tab, maybe you're expecting it to show up automatically ? (not currently implemented)

If that's not the case, Just to double check you should have enable_rust_analyzer = true and then you can test with something like std::process::Com<TAB>

Then I guess the second thing to check is does a rust-analyze process gets created when you run irust ? you can check after starting it , in top or similar utility.

If that's the case , I guess the next step to add some dbg! here https://github.com/sigmaSd/IRust/blob/master/crates/irust/src/irust/ra/rust_analyzer.rs

feribg commented 11 months ago

Tried tab and shift and tab but nothing, not just for use statements nothing gets autocomplete at all.

2023-12-07_16-40

sigmaSd commented 11 months ago

That's weird, rust analyzer seem to have spawned so it's an issue in the cominucation for some reason

Can you dbg! completion_request line, character here https://github.com/sigmaSd/IRust/blob/master/crates/irust/src/irust/ra/rust_analyzer.rs#L157 after you press tab (while having some input to complete)

If you're a flatpak user , can you try the flatpak just for testing (link in the readme)

sigmaSd commented 11 months ago

Also you should comment this line out to see if the lsp server is complaining https://github.com/sigmaSd/IRust/blob/master/crates/irust/src/irust/ra/rust_analyzer.rs#L28

vsndev3 commented 8 months ago

Also you should comment this line out to see if the lsp server is complaining https://github.com/sigmaSd/IRust/blob/master/crates/irust/src/irust/ra/rust_analyzer.rs#L28

By this, i could saw the rust-analyzer was not installed and after installing it, completion works.

However unlike evcxr, only the functions are autocompleted and the variables are not auto completed. I see there is an option in rust-analyzer called "rust-analyzer.completion.privateEditable.enable", so I tried setting that in rust_analyzer.rs but still getting filled only with the functions, if it possible to fill the variables on tab?

image

sigmaSd commented 8 months ago

@vsndev3 I pushed a commit that add that feature https://github.com/sigmaSd/IRust/commit/f74f7a8f66ec546a1a9abf231bad14f2c803a2bd

vsndev3 commented 8 months ago

@vsndev3 I pushed a commit that add that feature f74f7a8

Thanks for quick response. However I see the same behavior. In Vscode with rust-analyzer the same struct extends correctly. Any way to print more logs to see output of rust-analyzer?

sigmaSd commented 8 months ago

weird it does work for me image

Just for sanity check make add dbg!(&initialize_request); to make sure you're sending the new parmas

If that doesn't work make I have a small suspicion that a request workspace/didChangeConfiguration is needed, but it works for me without it

sigmaSd commented 8 months ago

you need to redirect stderr to make sense of the output cargo r 2>log

vsndev3 commented 8 months ago

weird it does work for me image

Just for sanity check make add dbg!(&initialize_request); to make sure you're sending the new parmas

If that doesn't work make I have a small suspicion that a request workspace/didChangeConfiguration is needed, but it works for me without it

Thanks, It's working for me also. Seems I have missed clean build.

zinkkkk commented 1 month ago

I also can't get the autocomplete to work.

Using it in windows terminal / powershell.

The readme says the config is at "Win: C:\Users\$USER\AppData\Roaming/irust/config.toml" but there was no config file there at all so i manually made it and fill it with the default config but changed "enable_rust_analyzer = true" and re-run but no change, pressing tab or shift tab does nothing.

sigmaSd commented 1 month ago

Hello, the config should be created by default, so I think you modified the wrong location To get the correct location you can use irust --help it will print the location

You need to enable rust analyzer there like you already tired, also make sure that rust-analyzer binary is in windows PATH system variable, as in you can run rust-analyzer in the cli and it works, so irust can find it

zinkkkk commented 1 month ago

I'm really not looking in the wrong place, i even deleted the whole folder and cargo uninstalled/reinstalled and upon running irust the irust folder appears in /Roaming with irust_prelude and themes folders inside but there is never a config.toml made even after i run "irust --default-config"

Running rust-analyze from console would give "error: Unknown binary 'rust-analyzer.exe' in official toolchain 'nightly-x86_64-pc-windows-msvc'" so i ran "rustup component add rust-analyzer" and it did install, but irust still does not have autocomplete or a config file (i did even search whole system for a config and there isn't any new config.toml files made)

sigmaSd commented 1 month ago

I seem to have broken that in a recent release, I pushed a new version 1.71.25 can you test that one

Make sure to run irust, then close it, then enable rust analyzer in the generated config.toml

I think you already made sure rust-analyzer works in the cli, so in theory it should be enough, when you hit tab you should see suggestions now,

If it still doesn't work check the task manger when irust is running to see if it did spawn rust-analzer

zinkkkk commented 1 month ago

Cheers can confirm new version has working autocomplete :)