Giter Site home page Giter Site logo

kdev-rust's Introduction

kdev-rust

This is plugin for KDevelop that adds support for Rust language.

In future this plugin will probably use Rust Language Server, but at this moment it uses its own tool called rustc2duchain.

Disclaimer

  • This is early experminent. Expect bugs and severe limitations.
  • This is not an "official" KDevelop plugin. I chose the name kdev-rust to follow the pattern of naming KDevelop plugins but there may be different official kdev-rust plugin in the future.

Prerequisites

rustc2duchain

This plugin uses the rustc2duchain tool to parse and analyze Rust code. You need to have the tool installed to get proper Rust support. Follow instructions in rustc2duchain README.

Mime type for text/rust

Your system needs to recognize *.rs files as text/rust mime type, otherwise KDevelop won't activate this plugin for them. On linux you need your shared-mime-info package to be at least version 1.5.

Build dependencies

You need cmake and a c++ compiler. You need Qt5, KDE5 and KDevPlatform development packages. If you are missing some dependency, cmake will tell you.

Build and installation

From source

This plugin uses regular cmake build. You can build and install for example using these commands:

git clone https://github.com/michalsrb/kdev-rust.git
cd kdev-rust

mkdir build
cd build

cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
make

make install

You should see this file installed to your system (the exact path may vary):

/usr/lib64/qt5/plugins/kdevplatform/24/kdevrustlanguagesupport.so

Linux packages

I am going regularly package kdev-rust in OpenSUSE Build Service. You may find package for your distribution in there: Search kdev-rust at build.opensuse.org.

Configuration

In KDevelop navigate to Settings -> Configure KDevelop -> Plugins and enable Rust Support plugin.

If you installed the rustc2duchain tool into your rustup's nightly bin directory the plugin should work out of the box. Otherwise you have to configure paths to it:

In KDevelop, navigate to Settings -> Configure KDevelop -> Rust Language Support.

  • Set path to rustc2duchain binary. For example:

    /home/michal/projects/rustc2duchain/target/release/rustc2duchain
    
  • Set path to directory with rust libraries. This is the directory that contains files like librustc-<hash>.so and libstd-<hash>.rlib. For example:

    /home/michal/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib
    

Usage

If you open a .rs file you should see the code rainbow-highlighted, there should be content in Outline toolview, you can use code browser etc. Errors and warnings should be visible in Problems toolview. If there is some problem running the rustc2duchain tool, it will appear in the Problems toolview as well.

kdev-rust's People

Contributors

michalsrb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kdev-rust's Issues

Missing dependency ECM

"~/kdev-rust/build$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
CMake Error at CMakeLists.txt:11 (find_package):
Could not find a package configuration file provided by "ECM" (requested
version 0.0.9) with any of the following names:

ECMConfig.cmake
ecm-config.cmake

Add the installation prefix of "ECM" to CMAKE_PREFIX_PATH or set "ECM_DIR"
to a directory containing one of the above files. If "ECM" provides a
separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred!"

I have no idea what dependency I am missing, can you help me out?

Does not work with latest rust

Just a heads up to anyone thinking about trying this out:

One of the prerequisites; rustc2duchain, doesn't build with recent versions of the rust nightly compiler. As far as I can tell, this means that, unfortunately, the kdev-rust plugin isn't possible to use with a recent version of rust.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.