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

cannot jump to code generated by tonic grpc #5799

Closed
0x8f701 opened this issue Aug 18, 2020 · 17 comments
Closed

cannot jump to code generated by tonic grpc #5799

0x8f701 opened this issue Aug 18, 2020 · 17 comments
Labels
E-unknown It's unclear if the issue is E-hard or E-easy without digging in S-unactionable Issue requires feedback, design decisions or is blocked on other work

Comments

@0x8f701
Copy link

0x8f701 commented Aug 18, 2020

Hi, I found it's impossible to jump to code generated by tonic, is it unimplemented ?

@bjorn3
Copy link
Member

bjorn3 commented Aug 18, 2020

Did you enable rust-analyzer.cargo.loadOutDirsFromCheck?

@0x8f701
Copy link
Author

0x8f701 commented Aug 18, 2020

hi @bjorn3 I just enabled it but it still doesn't work, I'm using coc-rust-analyzer + coc.nvim + rust-analyzer

@Ameobea
Copy link
Contributor

Ameobea commented Oct 13, 2020

Fwiw enabling rust-analyzer.cargo.loadOutDirsFromCheck fixed this issue for me in VS Code

@lnicola
Copy link
Member

lnicola commented Oct 13, 2020

Are you using nightly? If so, can you try with a new rust-analyzer?

Also, how did you enable the setting?

@Ameobea
Copy link
Contributor

Ameobea commented Oct 13, 2020

@lnicola -

Are you using nightly?

Yes, I'm currently using rustc 1.49.0-nightly (a1dfd2490 2020-10-05)

If so, can you try with a new rust-analyzer?

I'm using the latest master, built fresh a couple of hours ago with cargo xtask install

Also, how did you enable the setting?

I just added this line to my VS Code settings.json:

"rust-analyzer.cargo.loadOutDirsFromCheck": true,

@lnicola
Copy link
Member

lnicola commented Oct 13, 2020

Sorry, I was asking @GopherJ since for you it already works.

@0x8f701
Copy link
Author

0x8f701 commented Oct 13, 2020

Hi all, thanks for your replies, I confirm that I'm using nightly but I'm not using VSCode, I use vim + coc.nvim + coc-rust-analyzer

@inicola is it a problem on coc-rust-analyzer side?

You can see all my config at: https://github.com/GopherJ/cfg/tree/master/coc

@lnicola
Copy link
Member

lnicola commented Oct 13, 2020

It's hard to tell, but if you're using proc macros with a nightly rustc newer than 1.45, you'll need a rust-analyzer that includes #5651, otherwise it will crash.

It's unlikely, but it could also be a coc-rust-analyzer issue.

@matklad matklad added E-unknown It's unclear if the issue is E-hard or E-easy without digging in S-unactionable Issue requires feedback, design decisions or is blocked on other work labels Oct 15, 2020
@matklad
Copy link
Member

matklad commented Oct 15, 2020

needs a minimal reproducible examble to become actionable. THe action would be to check with vs code if i works.

@0x8f701
Copy link
Author

0x8f701 commented Oct 15, 2020

Hi @matklad thanks for your reply, I should have done it :) sorry.

I confirm it's more a pb on coc.nvim + coc-rust-analyzer because it works perfectly in Vscode but not with coc.nvim + coc-rust-analyzer

@lnicola
Copy link
Member

lnicola commented Oct 16, 2020

Closing for now, we can reopen or file a new bug if we're doing anything wrong.

@lnicola lnicola closed this as completed Oct 16, 2020
@lnicola lnicola reopened this Oct 27, 2020
@lnicola
Copy link
Member

lnicola commented Oct 27, 2020

CC #3767 -- I think?

@lgln
Copy link

lgln commented Apr 30, 2021

I have the same issuse, is there some progress?

@flodiebold
Copy link
Member

@lgln can you give a minimal reproduction of the issue?

@lgln
Copy link

lgln commented May 6, 2021

use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;

pub mod hello_world {
tonic::include_proto!("helloworld");
}

i want to find definition of "GreeterClient" in line 1, the cursor just jump to "tonic::include_proto!(" in line 5

my rust-analyzer is v0.2.583, my config in settings.json:

"rust-analyzer.cargo.runBuildScripts": true, 
"rust-analyzer.lruCapacity": 1024, 
"rust-analyzer.procMacro.enable": true,

@shikhar
Copy link

shikhar commented Jul 29, 2021

It is easy to repro with https://github.com/shikhar/bazel-tonic/tree/4a27fbf7fe15a26804a3eb5eb3f7b62dafa9fba4

Generated code is included in lib.rs, and symbols from generated code are used in client.rs and server.rs. Trying to jump to definition from those symbols takes you to the include in lib.rs, instead of the generated source file.

@flodiebold
Copy link
Member

This seems like a duplicate of #3767.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-unknown It's unclear if the issue is E-hard or E-easy without digging in S-unactionable Issue requires feedback, design decisions or is blocked on other work
Projects
None yet
Development

No branches or pull requests

8 participants