IntelliJ-Rust nightly released!


#1

Hi!

I’m glad to announce the first nightly build of IntelliJ-Rust plugin. You can grab it here.

It is really far from being complete, but it is already quite usable! My single most favorite feature is “go to symbol” (Ctrl+Alt+Shift+N), which allows you to quickly navigate to any item in the local crate or in a dependency (standard library is not yet supported because it’s a bit of a hassle to download its source code). We also have “go to definition” for local crate (Ctrl+B), file overview (Ctrl+F12) and a simple completion.

There is also a number of small, but neat things. For example, a quick fix to create a module file if you have mod foo;, but no foo.rs, or context sensitive snippets (f and pf expand to field definition if you are inside a struct).

On the technical side of things, the plugin is implemented in Kotlin, which is a real breath of fresh air in the Java world. We do not use Racer and we likely won’t be a heavy user of the upcoming RLS. Following the good old IDEA tradition, we have implemented our own parser and symbol resolver. There is no type inferencer yet, but it is on the roadmap! It’s a ton of work, but it allows us to readily reuse IDEA’s powerful indexing frameworks.

And we have some relatively easy and more involved up for grab issues. Contributions are welcome :slight_smile:


#2

Hello @matklad

Please may I ask you to describe how to setup the ide after installing the plugin successfully. For example, where to setup the rust source directory and other important setting for best user experience.

Thank you.

Michael


#3

Hello!

We have some docs here. If there is something missing in there, please file an issue!

After you’ve installed plugin and a pretty recent Cargo, you can import your project (Ctrl+Shift+A > Import project), just point the dialog to your Cargo.toml file. Plugin should automatically pick the path to Cargo, but you can specify it manually if it is not in PATH. That’s basically it :wink:

I will add some screenshots to the docs shortly. Done!


#4

Thanks for your answer.

Just a question: From your point of view makes it any difference to run the plugin on Windows (Windows 10)?

Michael


#5

The plugin is tested on windows, so it should work.

But I haven’t tried it on windows myself, so I guess there might be some hiccups, especially with importing projects.


#6

I am also somewhat new to IntelliJ(I’ve used it before but because it is a very configurable IDE, that makes it hard to navigate through all of those options unless you use it pretty often) and I’ve had to fiddle with it a bit before getting it to work for me.

@matklad I think there are a few more points here:

  • How to set-up the SDK.
  • How to set-up the compilation from the IDE(I still haven’t figured how to make this work properly, what I currently do is “Edit configurations” -> set an external application that runs “cargo build” from ProjectFileDir -> then I press to compile, let it complain that I didn’t set a module(which cannot be set) and press “Continue anyway” after which I just rerun with “Ctrl + F5” or the button).

#7

How to set-up the SDK.
How to set-up the compilation from the IDE

We’ve merged this functionality only tonight, so it’s not surprising your we unable to figure it out =)

Will update docs later today.


#8

Sorry to bother you again, but I just want to mention I have still problems too.

Code copletion is not working at all and I think I have to tell the IDE where to find the rust source code???

As well go to symbol: It is ignoring my own rust files.


Thanks for any hint.

Michael


#9

This is a first nightly build and, as I said, it’s really far from being complete :slightly_smiling:

Code completion is currently limited to local variables and items. That is, it won’t work for struct fields and “member functions”. There is Alt+/ for simple text-based completion though.

Go to symbols is for navigating to items (functions, structs, traits, modules). It is not supposed for local variables.

I have to tell the IDE where to find the rust source code

No, we are using cargo metadata command to learn about project structure and dependencies.


#10

@matklad I feel bad for jumping with the issues before thanking you guys for the great work you did and do.

I really like the work you are doing!
I think this is the only proper IDE integration with that extensive test suite you guys developed.

This already turned into my IDE(with your plugins) of choice for Rust development. I can do for the moment without code-completion.

I sincerely appreciate that you guys do this work, this helps the entire community in a very considerable way.

If you could make these components swapable(so these can be swapped with other implementations) please consider doing this.
First thing that came to my mind when I saw this message is QtCreator and KDevelop in the C++ world.
Both of these IDEs had their own parsers and now they came to a moment where they just can’t compete and keep up with the changes in the language and the information that a compiler can offer.
Both[1, 2] are switching to new code models based on Clang.

Here is what one of KDevelop developers said: “from a maintenance point of view this is a blessing. We can actually concentrate on making our IDE shine instead of playing catchup with the compiler.


#11

Updated the docs: https://github.com/intellij-rust/intellij-rust/blob/master/doc/QuickStart.md

Please note that you’ll have to update your Kotlin plugin for this to work.


#12

Yeeeey!!! Thanks!

It asks me every day to update so I just update(oh, nvm, I update the plugin, not Kotlin plugin)…

Update: Yep, I installed IntelliJ 16 Preview and it now works beautifully.