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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM