I Dream of Kate

Previous - I Dream of Geany
Next - Download the Source Code for "sl"

The previous lesson took a brief look at Geany, an Integrated Development Environment (IDE) that is easy to install on Debian and to configure for use with our Rust projects. This lesson takes a quick look at Kate. If you have KDE/Plasma installed, you already have the editor Kate installed, along with the terminal emulator Konsole. Otherwise, it's easy to install them:

$ sudo apt install kate konsole

Kate is a text editor, but it's also a light-weight IDE. Konsole is the terminal emulator it uses as an integrated terminal.

When you open Kate, you should see something like this:

Kate window

Clicking on "Terminal" at the bottom of the window will toggle the Konsole window on or off:

Kate window with Konsole

To begin a new project named "greet" in the directory "~/projects/RUST/greet", click in the Konsole window and cd to the ~/project/RUST directory, and run $ cargo new greet. Then, in the main Kate window, click on the "Open File..." button (or the "Open" icon on the menu bar, or the "File / Open" menu, or press Ctrl-O), and open "~/projects/RUST/greet/src/main.rs". The file will open for editing, and you'll probably see a pop-up asking if you want to start the LSP (the Language Server Protocol) server; select "Yes". This is a plug-in to Kate that makes Kate aware of Rust features.

Kate window with greet project

When you opened "main.rs", whether or not you started the LSP, you'll notice that the right-hand bottom corner filled with some information, including the information that this is a Rust file. As you can see, Kate is already more Rust-aware than is Geany.

You may also notice a dimly-flashing "Output" button on the left-hand bottom corner. Click on it to see what it's trying to tell you. In my case, it's telling me that the 'rust-analyzer' is not installed. D'oh!

So I used "rustup"to see if it was installed:

westk@westk-22181:~/projects/RUST/greet/src$ rustup component list | grep rust-analyzer
rust-analyzer-x86_64-unknown-linux-gnu

Well, there it is, but it is not marked as "installed". So...

westk@westk-22181:~/projects/RUST/greet/src$ rustup component add rust-analyzer
info: downloading component 'rust-analyzer'
info: installing component 'rust-analyzer'
westk@westk-22181:~/projects/RUST/greet/src$ rustup component list | grep rust-analyzer
rust-analyzer-x86_64-unknown-linux-gnu (installed)

That's better! Now, just go to the "LSP Client" menu and select "Restart All LSP Servers", and now my "Output" window indicates that the server has started.

If you get your Kate settings messed up, and want to return to the defaults, just exit out of Kate, and delete your "~/.config/kate*" and "~/.local/share/kate*" directories/files.

Hopefully this little tutorial will get you started using Kate as a Rust IDE.