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 Rust in IntelliJ & CLion #71

Open
mguillemot-tel opened this issue Nov 19, 2018 · 7 comments
Open

Support for Rust in IntelliJ & CLion #71

mguillemot-tel opened this issue Nov 19, 2018 · 7 comments

Comments

@mguillemot-tel
Copy link

Since the Rust plugin is now officially supported by JetBrains for IntelliJ and CLion, it would be super-nice to have EnvFile support for the Cargo commands added by this plugin.

@evanjs
Copy link

evanjs commented Sep 28, 2019

Was going to answer @ashald's question re CLion support, but I figured it'd be more appropriate to answer it here


I am very interested in utilizing this for my Rust projects with CLion.

I use NixOS, and in the past, I have used nix-shell to import required development libraries, though I now use direnv to automatically load and cache any dependencies when entering project directories.

Unfortunately, this means that, while I often use CLion for development, I cannot simply stick to the run configurations within CLion, as the direnv environments are not loaded, and I must sometimes, for example, build the project first in a terminal (with the loaded direnv environment or nix-shell dependencies), after which it can be run or watched from CLion.

To illustrate the frequency of linking native libraries in Rust apps, the best example I can think of is anything with network connectivity, which typically needs openssl, which needs pkgconfig when building Rust apps, etc...

On NixOS, this means that any Rust app that needs network access must first be built in an environment such as nix-shell -p openssl.dev pkgconfig, etc (libraries are not available on a system level/scope by default).


TL;DR - I'd like to integrate direnv and similar env-loaders with my Rust projects via CLion, and this plugin looks like it might help.

@evanjs
Copy link

evanjs commented Dec 5, 2019

I am now using lorri, but things works largely the same as direnv on the client side, e.g. with the direnv plugin for emacs, lorri seems to work flawlessly.

I still have to open a terminal and navigate to a direnv/lorri enabled directory and launch my IDE from there if I want to utilize these environments in CLion, however.

Are there any particular blockers that can be investigated or work that can be done to further this issue?

After investigating WebStorm compatability, I started to wonder if there are any issues for CLion like there are for the node.js plugin, or other items that can be investigated/others might be able to help with.

@pkral78
Copy link

pkral78 commented Feb 26, 2020

I still have to open a terminal and navigate to a direnv/lorri enabled directory and launch my IDE from there if I want to utilize these environments in CLion, however.

But it is then impossible to open multiple CLion project with different environments at same time right ?

@evanjs
Copy link

evanjs commented Feb 27, 2020

I still have to open a terminal and navigate to a direnv/lorri enabled directory and launch my IDE from there if I want to utilize these environments in CLion, however.

But it is then impossible to open multiple CLion project with different environments at same time right ?

Correct; I’m then locked to one ENV per instance of the program, and it might even launch with the wrong project loaded, etc.

@kurtbuilds
Copy link

I figured out a workaround that appears to work seamlessly.

I built a cargo subcommand that loads dotenv files: https://crates.io/crates/cargo-dotenv

I then configured the cargo commands in IntelliJ to use that subcommand.

cargo install cargo-dotenv
image

@SimenB
Copy link

SimenB commented Nov 21, 2023

Support for RustRover would be great as well 👍

The above plugin works, but still 😀

@SimenB
Copy link

SimenB commented Nov 23, 2023

It works for run configurations, but not debug ones 🙁

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

No branches or pull requests

5 participants