-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support .rust-project.json
(i.e. hidden)
#17816
Comments
👋 Made a PR, but I will let others decide if they want to have it merged. |
That was quick! Thanks a lot! |
Yeah, we generate it on the fly (or, more precisely, currently the user triggers the generation when they want). It sounds like your feature allows users to (re)generate the JSON file as needed by having Thanks for the suggestion! |
That is correct, yes! I provided a description of why this is handy in bazelbuild/rules_rust#2755 (comment), so that users wouldn't ever need to see the |
Then it sounds great -- I think the file being on-disk is not too bad (especially if hidden; although avoiding the file has other advantages, like being able to use rust-analyzer from a read-only location), but it is true that the regeneration part and the fine-grained possibilities are interesting. We are planning some major changes to the build system soon, so it is the right time to think about this. I see in the manual: "Warning: This format is provisional and subject to change." -- is there an expected timeline for stabilization or a tracking issue to follow or similar (maybe #17537)? Thanks again! |
Sorry for the delay in responding, Miguel. I was supposedly on vacation last week. I also I had a big comment written here, but Chrome crashed and I lost it. Anyways.
I'd appreciate a bit more details about this (there might be an miscommunication here?), but
I'm inclined to make a new tracking issue for announcing changes to non-Cargo build system integrations; a more specialized form of #4604, if you will. #17537 is more of a general architectural improvement that needs to happen to rust-analyzer anyways and it's not specific to non-Cargo build system integrations. I don't have a timeline for stabilization, but I am mostly happy with the design of configuring
Let me know if that is acceptable for Rust for Linux for the time being! |
No need to apologize -- a couple days is a quick reply, even more so in that case! :)
Sorry, I was replying to the "so that users wouldn't ever need to see the .rust-project.json on disk in the first place." part, and what I meant is that, for us, having the file on-disk (like it currently is the case with
Sounds good. I subscribed to those other two, just in case :)
I see, thanks! (I was mainly asking in order to know if we needed to test and/or give feedback quickly before it got frozen.)
So updating the details in the mainline kernel would not be a problem -- I would expect we can keep up with those changes. However, for stable kernels (or even just older, unsupported kernels), I imagine it would eventually happen that you update the format, those few months pass, and then an LTS kernel would not work anymore. For those stable/older kernels, it is not super critical, since development is mostly done in mainline, but I would imagine developers would still want to have support there. So I guess that may force us (and other projects, I would imagine) to maintain a/the tool outside the kernel tree, and ask people to use that instead, at least for older kernels. Or, if at least Does that make sense? And thanks for all the details! |
I appreciate it!
Gotcha, makes sense! I'm also in a position where I'm able to see a lot of different kinds of user behavior with rust-analyzer, and you'd be surprised where people want to open their editor, especially if they're not coming from Rust. rust-analyzer, as of today, is a bit rigid with where it wants to load/index things, but that should change with #17537.
Makes sense! Yeah, rust-analyzer's stability policy is to prefer not breaking users, but accept that it might sometimes happen.
makes sense, thanks for explaining the workflow!
It does, yeah! If you're able to provide a consistent snapshot of the Rust environment at that point in time ( |
If you mean something like a monorepo where everything is pinned, including the toolchain and other third-party code and so on, then no, we don't control developers' toolchains. The kernel supports a minimum version of every tool and developers are expected to bring their own toolchain (typically from their Linux distribution, but also other places).
Do you mean to add the fallback now, or do you mean in general? i.e. if there are backwards incompatible changes to By the way, in my previous message I was assuming Thanks! |
Yes rust-analyzer is generally only compatible with the last couple stable releases of the rust toolchain. There is no "hard limit" on the version range as the incompatability tends to come from the standard library assuming a specific compiler making it next to impossible for r-a to support all toolchains. That problem generally goes away if the users use the toolchain provided rust-analyzer as that should be compatible with the toolchain version itself (at the expense of not having newer features of the rolling rust-analyzer releases). |
Ah, what I meant to ask was what releases of rust-analyzer (the tool) are supported by rust-analyzer (the project). In other words, if rust-analyzer only supports, say, the latest release or e.g. the latest month of releases (currently 2024-07-15, 2024-07-22, 2024-07-29, 2024-08-05 and 2024-08-12) and on top of that |
Ah! That makes a lot of sense. I am completely unaware of how Linux development works.
I meant in general, but I'd like to step back a bit. While the documentation of
Generally, only the latest stable release, but we can probably start versioning the Do you mind sharing what change you needed to make in terms of |
Yeah, I mentioned it mainly due to the recent change we needed (please see below).
That sounds very reasonable.
It is this commit: Rust-for-Linux/linux@fe99216 And, of course, if you find anything that could be improved, that would be nice to know! Thanks! |
Very soon after we requested it [1], `rust-analyzer` added support for `.rust-project.json` [2], i.e. the hidden variant of `.rust-project.json`. While this is only a (tiny) issue for kernel developers that use Rust (i.e. so far a very small number compared to the total), the file is not really something most kernel developers need to see, care or modify while working, so it is not really needed to show it by default in listings. It also follows the pattern of other files that are not directly related to the project (unlike e.g. a `Kconfig` file). Thus migrate to it. Cc: Ali Bektas <bektasali@protonmail.com> Cc: Lukas Wirth <lukastw97@gmail.com> Link: rust-lang/rust-analyzer#17816 [1] Link: rust-lang/rust-analyzer#17818 [2] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
In the Linux kernel, we use rust-analyzer with a
rust-project.json
file.However, it appears that there is no support for a hidden version of that configuration file, i.e.
.rust-project.json
, which means it is very visible when listing the root directory of the kernel sources (though only when generated, since the file is not committed into the repository and thus only visible when using rust-analyzer).While this is only an issue for kernel developers that use Rust (i.e. so far a very small number compared to the total), since the file is normally not there, the file is not really something most kernel developers need to see, care or modify while working, so it is not really needed to show it in listings, and so a hidden
.rust-project.json
file would be better. I guess for other projects that may be the case as well.This would follow other files like
.clang-format
,.gitignore
,.gitattributes
,.mailmap
,.rustfmt.toml
, etc. where configuration is not directly related to the project (say, aKconfig
file) but to tooling.The text was updated successfully, but these errors were encountered: