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

Repair rust-analyzer for tonic files #1604

Merged

Conversation

Ngoguey42
Copy link
Contributor

Motivation

In my codebase I have files generated by prost and by tonic. I noticed that rust-analyzer was working fine with files generated by prost but not with files generated by tonic.

Solution

I found out that rust-analyzer doesn't like when a generated file is included with relative path. It only works with absolute path (i.g. when using the OUT_DIR env variable).

I also found out that tonic always calls prost_build::Config.out_dir, which causes prost to always generate includes with relative paths.

My solution was to avoid setting the out_dir in prost when unnecessary.

@LucioFranco LucioFranco added this pull request to the merge queue Jan 25, 2024
Merged via the queue into hyperium:master with commit f714f42 Jan 25, 2024
16 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants