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

Autocomplete doesn't work #129

Open
feribg opened this issue Dec 7, 2023 · 15 comments
Open

Autocomplete doesn't work #129

feribg opened this issue Dec 7, 2023 · 15 comments

Comments

@feribg
Copy link

feribg commented Dec 7, 2023

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
Copy link
Owner

sigmaSd commented Dec 7, 2023

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
Copy link
Author

feribg commented Dec 7, 2023

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

2023-12-07_16-40

@sigmaSd
Copy link
Owner

sigmaSd commented Dec 7, 2023

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
Copy link
Owner

sigmaSd commented Dec 7, 2023

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
Copy link

vsndev3 commented Mar 30, 2024

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
Copy link
Owner

sigmaSd commented Mar 30, 2024

@vsndev3 I pushed a commit that add that feature f74f7a8

@vsndev3
Copy link

vsndev3 commented Mar 30, 2024

@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
Copy link
Owner

sigmaSd commented Mar 30, 2024

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
Copy link
Owner

sigmaSd commented Mar 30, 2024

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

@vsndev3
Copy link

vsndev3 commented Mar 31, 2024

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
Copy link

zinkkkk commented Oct 5, 2024

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
Copy link
Owner

sigmaSd commented Oct 5, 2024

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
Copy link

zinkkkk commented Oct 5, 2024

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
Copy link
Owner

sigmaSd commented Oct 6, 2024

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
Copy link

zinkkkk commented Oct 6, 2024

Cheers can confirm new version has working autocomplete :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants