코딩Coding/LLDB&GDB_TheGNU_Project_Debugger

Notes on Rust IDEs: CLion vs Rust Analyzer

내인생PLUS 2022. 2. 22. 15:58
728x90

https://www.reddit.com/r/rust/comments/ry0phj/notes_on_rust_ides_clion_vs_rust_analyzer/?utm_source=share&utm_medium=ios_app&utm_name=iossmf

Notes on Rust IDEs: CLion vs Rust Analyzer

I spent the past couple months comparing the CLion IDE (intellij-rust plugin with experimental features enabled) and rust-analyzer for Visual...

www.reddit.com




Notes on Rust IDEs: CLion vs Rust Analyzer

I spent the past couple months comparing the CLion IDE (intellij-rust plugin with experimental features enabled) and rust-analyzer for Visual Studio Code, and these are my notes on both IDEs.

Overall, both of these tools are extremely impressive, and I’d be very happy using either one. They both execute on the basic IDE features quite well, to the extent that I can’t imagine writing Rust without a tool like this (writing my own use statements?!). I do think the reliability is still lower than e.g. a Java or C# IDE, things sometimes just break down and stop working for a bit, but I’ve had no really major problems.

**Autocomplete**

- Both tools do a good job of typeahead suggestions. CLion has some heuristics to suggest your most frequent completions, which I like.
- CLion also shows inline documentation for the completion item you currently have selected while you type, which is super helpful. I miss this feature frequently with Rust Analyzer.
- CLion is not able to autocomplete module imports, e.g. if you type `module::function()` it will not auto-complete `function()` if `module` is not in scope. Rust Analyzer handles this correctly.
- Both tools handle importing custom proc-macro-generated types properly! Procedural macro support in general is really good.

**Compiler Errors & Checking**

- Both tools do a good job of highlighting errors and showing warnings as you type. Both can integrate clippy and rustfmt.
- CLion cannot detect compilation errors in other files and highlight the file names in red – you need to build the project and go through errors one at a time. This is incredibly annoying and is the biggest problem with CLion today.

**Hover Tooltips:**

- Rust Analyzer seems to do some kind of asynchronous fetch for documentation on hover. This fails for me frequently for standard library items (you get stuck at “Loading”)
- Rust Analyzer has some weird conflict between showing docs & error messages on hover. Frequently I hover over something with an error and the documentation pushes the error message out of view.
- CLion can only anchor tooltips on the top-left, so you can’t read them if you’re hovering something on the right side of the screen.

**Rustdoc**

- Both tools let you hover over links in Rustdoc to see their definition, which I really like
- Clicking links within rustdoc tooltips doesn’t work for me with Rust Analyzer, it tries to pull up invalid links in the browser. CLion can navigate between doc pages inline in the tooltip, which is really nice
- Rust Analyzer currently does not support all of Rustdoc syntax, e.g. [Self::foo] type links do not work

**Debugger**

- The debugger in CLion is more polished. You can display variables, jump around stack frames, evaluate simple expressions, and inspect the inner state of values
- That being said, VSCode using CodeLLDB is more competitive than I expected. Hovering over a variable to see its value often works, and you can do a lot of the same inspection of values.

**IDE Features**

- CLion prompts you to add new files to `lib.rs` when you create them. Love this feature.
- Both tools handle Rename refactoring pretty well, including module renames!
- CLion “move” refactoring to put something in a different module is super useful and seems pretty reliable
- Rust Analyzer seems better at creating code snippets. For example it once gave me a nice `PartialOrd` implementation automatically!
- I really like how Rust Analyzer underlines mutation method calls to make them stand out. CLion underlines mutable *variables*, which is not as helpful
- VSCode is obviously more popular in the Rust ecosystem, e.g. I was able to find highlighting modes for my Justfile and Insta snapshot test files

**Testing**

- I love how testing works in CLion, you can just click the button next to a test case to run it. I don’t think this is possible in Rust Analyzer?
- **Edit:** I am mistaken, there is a popup on hover for this in VSCode. It's quite small text that's sort of hard to notice, in my defense.
- Debugging tests in CLion is also great, being able to run a single test under the debugger with one click and immediately start hitting breakpoints is amazing





다른 글 보기
Rust VsCode extensions 정리

Rust Tutorial ❤️한글Rust Programming Languages-RoadMap로드맵 -
https://economiceco.tistory.com/m/12879

Rust Tutorial ❤️한글Rust Programming Languages-RoadMap로드맵

온라인 스승님의 한글 Rust 강의 Easy Rust https://youtube.com/playlist?list=PLfllocyHVgsSJf1zO6k6o3SX2mbZjAqYE Easy Rust Korean / 한국어판 www.youtube.com ★★Rust Toturial 로드맵 (Road Map)첫시작!-..

economiceco.tistory.com









반응형