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

Goto file for include!(...) #5871

Closed
Veetaha opened this issue Aug 25, 2020 · 6 comments · Fixed by #9149
Closed

Goto file for include!(...) #5871

Veetaha opened this issue Aug 25, 2020 · 6 comments · Fixed by #9149
Labels
S-actionable Someone could pick this issue up and work on it right now

Comments

@Veetaha
Copy link
Contributor

Veetaha commented Aug 25, 2020

This is a feature request. I think it should not be hard to get a goto-file (maybe just via goto-definition lsp functionality) for include!(...) expressions and items.
This might work by invoking the goto-definition request on the path string literal expression in include!(<here>). This will greatly simplify navigating to code which resides in OUT_DIR.

As a second step it might be super-awesome if goto-definition requests for symbols defined in include!()ed files navigated the users exactly to the included files source instead of include!(...) expression

@kjeremy
Copy link
Contributor

kjeremy commented Oct 23, 2020

I just ran into this messing with capnproto include!(concat!(env!("OUT_DIR"), "/test_capnp.rs"));

@js2xxx
Copy link

js2xxx commented Nov 8, 2020

Now when I tried Ctrl+Click the items defined in the include!()ed files the cursor only jumped to the end of the current file.
Expecting the exciting feature.

@flodiebold flodiebold added the S-actionable Someone could pick this issue up and work on it right now label Dec 21, 2020
@flodiebold
Copy link
Member

I've opened #6992 for go to definition on items defined in an included file; let's keep this about going to the file by clicking on the path itself.

@theotherphil
Copy link
Contributor

I’ll give this a go if no-one else is already working on it.

@jiacai2050
Copy link

jiacai2050 commented Jan 22, 2023

It seems this feature doesn't work any more.

mod prometheus {
    include!(concat!(env!("OUT_DIR"), "/prometheus.rs"));
}
pub use prometheus::*;

Snippet above include prost-build generated output file, when invoke find definition on type defined in promtheus module, it will go to include!, not actual generated prometheus.rs

rust-analyzer --version
rust-analyzer 0.3.1369-standalone (ff4d55e48 2023-01-15)

@Veetaha
Copy link
Contributor Author

Veetaha commented Jan 22, 2023

I don't think this feature worked with expressions other than the string literal like this include!("...")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants