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

Support for JetBrains IDEs #1100

Open
mahkoh opened this issue Aug 12, 2024 · 5 comments
Open

Support for JetBrains IDEs #1100

mahkoh opened this issue Aug 12, 2024 · 5 comments
Labels
• misc Related to other topics (e.g. CI).

Comments

@mahkoh
Copy link

mahkoh commented Aug 12, 2024

Without Cargo.toml files, some significant dev exp features are inaccessible. This includes any kind of support for JetBrains IDEs.

This is not a request for crates to be built with cargo.

It might be possible to generate Cargo.toml files automatically. I believe that some files are already being generated for rust-analyzer support. If not, then it might be necessary to maintain such files manually.

@bjorn3
Copy link
Member

bjorn3 commented Aug 12, 2024

AFAIK IntelliJ doesn't have support for a custom sysroot at all. Rust-for-linux uses a custom sysroot. It also doesn't have a way to point directly to arbitrary compiled proc-macros, unlike rust-analyzer. IntelliJ works best with projects that use cargo with a standard project layout. Even the rust compiler itself, which uses cargo, isn't supported by IntelliJ due to the unusual project layout.

Generating Cargo.toml files would be non-trivial as multiple drivers (which need a separate Cargo.toml file) may be present in a single directory. Rust-analyzer supports this just fine with rust-project.json, but cargo doesn't support this.

Cargo.toml files being present may also cause people to attempt to build using cargo (whether intentionally or due to their IDE automatically running cargo build) which does not work. Not the least because rust-for-linux depends on a bunch of env vars and --cfg arguments which can't be set using Cargo.toml. Without those set a lot of code in the kernel crate is configured out, which would likely also break IDE functionality in IntelliJ.

@ojeda
Copy link
Member

ojeda commented Aug 12, 2024

If not, then it might be necessary to maintain such files manually.

No, we can't really commit and maintain Cargo.toml files manually everywhere just for a single IDE.

Generating files on the fly is possible, but even if that happened to work (which as @bjorn3 says, it wouldn't, at least not easily), there is already rust-project.json for that (which is better suited for that purpose too).

JetBrains should support non-Cargo Rust projects, and ideally just add support for rust-project.json, since I would expect that is what most non-Cargo Rust projects already use, and it is harder to justify targets/features for individual IDEs.

@ojeda
Copy link
Member

ojeda commented Aug 16, 2024

@mahkoh Perhaps we could reuse this issue for something like "Support for JetBrains IDEs"? i.e. to track support in general, in whatever form it comes eventually.

@mahkoh
Copy link
Author

mahkoh commented Aug 16, 2024

Sure, that is the primary issue I have.

The issues you mentioned so far sound reasonable and I'm currently out of the office so I cannot investigate them myself.

@ojeda
Copy link
Member

ojeda commented Aug 16, 2024

Sounds good, thanks!

@ojeda ojeda added the • misc Related to other topics (e.g. CI). label Aug 16, 2024
@ojeda ojeda changed the title Add Cargo.toml files Support for JetBrains IDEs Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
• misc Related to other topics (e.g. CI).
Development

No branches or pull requests

3 participants