Rust初步(三):使用atom搭配racer进行rust编程

在rust.cc社区中有一个关于rust编辑器的讨论(话说很多人要学一个新语言,都会立即考虑编辑器的问题,包括我在内),主要关注的是,智能提示(这个真的太重要了)。大家讨论下来有几个选择

1. eclipse

2. vs code(我用过,目前支持语言高亮显示,但没有智能提示,还是不顺手)

3.emacs (GNU的创始人作品,再次向开源致敬)

4.SolidOak (我用过,体验很不好)

5.atom (我最后选用了这个工具,是GitHub出品的,据说VS Code也是基于atom做的实现),配合racer做智能提示,还有linter-rust 做语法检查。整体使用体验是:很好,很强大

最终的效果如下

image

首先肯定是要先安装atom,可以通过 https://atom.io/

image

然后,按照下面的帮助进行安装配置

https://atom.io/packages/racer

  1. Ensure you have the Atom package language-rust installed and active.  安装一个package(language-rust),这里又有一个有意思的package manager:apm ,参考 https://atom.io/packages/language-rust

image

  1. Ensure you have Racer properly installed.  然后安装racer,参考 https://github.com/phildawes/racer,有意思的是整个工具本来就是用rust写的,所以你可以下载源代码(使用git)后,使用cargo build 进行编译即可

image

  1. Ensure you have a copy of the rustc source code extracted on your disk. 需要下载rustc的源代码,并且解压缩到本地磁盘。参考 https://www.rust-lang.org/install.htmlhttps://github.com/rust-lang/rust 

我是直接用git获取了 https://github.com/rust-lang/rust  然后保存到本地一个目录,例如

image

  1. Install this package via Atom's package manager: 通过命令或者配置工具安装racer
    • go to Preferences > Packages, search for racer, and install it
    • OR use the command line apm install racer).

最后,要进行一些配置

image

原文地址:https://www.cnblogs.com/chenxizhang/p/4759921.html