-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
rust: Store absolute paths in rust-project.json #11467
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
rust: Store absolute paths in rust-project.json #11467
Conversation
See also rust-lang/rust-analyzer#14168 |
the changes themselves look good to me. Thanks for looking at this, and especially taking the issue upstream :) I (unfortunately, because I find With the pathlib -> os.path changes this is r-b from me |
Codecov Report
@@ Coverage Diff @@
## master #11467 +/- ##
==========================================
+ Coverage 67.08% 68.79% +1.70%
==========================================
Files 418 209 -209
Lines 90828 45480 -45348
Branches 20177 9415 -10762
==========================================
- Hits 60936 31289 -29647
+ Misses 25209 11775 -13434
+ Partials 4683 2416 -2267
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Completely agree. I was all aboard the |
43db0f1
to
3152685
Compare
Updated but don't merge this yet. The problem right now is that if you run meson from inside the build directory it writes the correct path, if you run it from the source directory it won't (and will put a path relative to the source directory). |
I think this should be fixed directly in |
3152685
to
76d4e61
Compare
This should work fine. For the proc macro dylib path this should be unnecessary as it seems to generate an absolute path already. |
e4d6ab7
to
c0e8ba6
Compare
Also fixed the proc-macro handling there in another commit. That was completely broken but now the |
|
As meson requires source_dir!=build_dir and stores the rust-project.json inside the build directory, while software like rust-analyzer expects it at the root of the source directory, manual steps are needed for making them work together. One option, as described in the documentation, is per project configuration. Another option, that works correctly with compile-commands.json and clangd, is to store a symlink to the file in the build directory at the root of the source directory. As currently rust-project.json stores paths relative to the location of the file itself and rust-analyzer does not resolve symlinks, this does not work. To solve this, store absolute paths in rust-project.json as is already done in compile_commands.json for the directory.
The proc-macro code was not running at all because of a missing dash in the crate type, and the proc macro dylib path was not generated as a path but including the `-o ` commandline parameter prefix.
c0e8ba6
to
fcefc36
Compare
Works here now but for some of the test cases rust-analyzer doesn't find dependencies (before and after my changes). |
As meson requires source_dir!=build_dir and stores the rust-project.json inside the build directory, while software like rust-analyzer expects it at the root of the source directory, manual steps are needed for making them work together.
One option, as described in the documentation, is per project configuration. Another option, that works correctly with compile-commands.json and clangd, is to store a symlink to the file in the build directory at the root of the source directory.
As currently rust-project.json stores paths relative to the location of the file itself and rust-analyzer does not resolve symlinks, this does not work.
To solve this, store absolute paths in rust-project.json as is already done in compile_commands.json for the directory.
rust-analyzer PR to resolve symlinks: rust-lang/rust-analyzer#14168
CC @dcbaker