QtCreator and its use as IDE for Rust

So I asked my colleague for a small guide on how to set up QtCreator as an IDE for Rust and post it with his permission. I myself use CLion and later I will write about how things are with it in this field. Moped is not mine. I just posted the announce. (c)

What does a modern programmer need in the first place? Developed abstract thinking? Strong math background? Perhaps stress resistance ??

Of course not! The most important thing is a good IDE.

image

If you, too, trying to overpower Rust, sad, looking at areweideyet
- welcome under cat.

So, tired of 100-line template errors and being seduced by the ML-tools of Rasta, I decided to find an editor for it, and not just a simple one, but a golden one. It’s so that the debugging in it is comfortable, and the lighting, and the usual navigation functionality, in general, everything is like in the best houses in Europe.

However, my taste was spoiled by QtCreator , a program familiar to many programmers ++ and at least much loved. So it was decided to turn it into a trolley bus. After all, quite by the way, Language Support has recently been added to it! To work, we need rustup with installed components rls, gdb and the Creator itself.

White loaf


  • First of all, it is worthwhile to disable extra plugins, if you see Creator for the first time - it will be even easier to understand the idea, the main advantage of which is simplicity. There are plugins in Help -> About Plugins, after selecting the right plugins - close and reopen Creator

image

Creater has a lot of useful plugins, but I show only those necessary for Rasta

  • Integration with cargo in the creator, of course not. However, there is a manager of arbitrary projects, which we can use by creating our project through the aforementioned cargo. Go to New -> New File or Project and select the Import Existing Project
  • Then we can choose the location of our project and the necessary files.

image

image

image

  • In the newly-minted project, we are interested in the .files file, which contains all the files included in the project. The contents of the .includes and .config for rasta is useless.

image

Simple devices


  • Now let's set up the environment itself. Go to Tools -> Options -> Kits -> Debuggers, click Add, specify the path to the rust-gdb script.
  • Click on Kits, click Add, set everything up as in the second picture.

image

image

  • Now let's exit the settings and click Projects; Remove Build Steps and Clean Steps by clicking on the cross. Click Add Step -> Custom Process Step and enter cargo build and clean into them, respectively.
  • Switch to run, specify the path to the project output.

image

image

  • Well, now you can use Creator as a development environment. Only here in it there is nothing that we so need. Let's go back to Options, go to the Language Client, click Add and fill in the settings for rls

image

  • Now add the highlight. You can select the highlight for different file types in the Text Editor -> Generic Highlighter by clicking Download Definitions. The rasta lighting present there is rather faded, moreover, half of the colors in it are not forwarded to the editor. Here is my, corrected version of this highlight. Save as rust_1.xml to the generic-highlighter folder.

image

  • In general, it remains only to add a couple of crutches. Go to Environment -> External Tools, where you can add these same tools into the tool. Again, Add, well, like in the pictures. I added rustfmt for the selected region and the restart rls script. Further, the scripts can be conveniently hung on the appropriate shotrk.

image

image

image

image

(Or black)


In general, everything is ready. But, since Our trolley bus from the loaf, there are some complaints:

  1. rls works no worse than in vscode, but in order to perform go to def, you must press F2. Ctrl + click is currently not working due to an unnecessary check in the editor code. If you're a Gentushnik, here's the patch .
  2. AutoComplete works by ctrl + space, click and it will come out.
  3. The backlight is not complete, because I just started reading docks on the plant, but you can easily finish it by yourself.

But why?!


Creator is probably the most convenient ide that I have ever used. Air navigation, excellent integration with gdb, smart interface, and practically does not eat resources:

image

image

EVERYTHING!

Also popular now: