6 ms·
This might seem silly but I'm struggling to get into rust because the vscode plugin for it is sometimes too buggy (but the progress on it is awesome and devs de
by Waterluvian 8y ago
This might seem silly but I'm struggling to get into rust because the vscode plugin for it is sometimes too buggy (but the progress on it is awesome and devs deserve a round of applause). I use vscode for 4 or 5 other languages every week and don't want to maintain multiple text editors/IDEs.
What do people usually do in these cases? Surely I'm not alone.
- ahmedalsudani 8y agoWhy get hung up on one tool? Just write Rust code as if it were plain text. It's a statically typed language, so the compiler will check your code before running it, and your can run rust fmt to fix formatting. Maybe one day you can shun the darkness and embrace emacs ;) all your problems disappear on that day
- Waterluvian 8y agoA massively important tool I use for learning a language and libraries is autocomplete. Emacs takes a day to master? Awesome!
- always_good 8y agoWell, that's always an option, so it isn't really advice. It's already what you have to do when the tooling support is bad. It's the poorest when an editor can instead inline its output of static analysis. Integration has a lot of benefits like tell you the inference of intermediate types. "Don't care about good integration" isn't really advice. It's like people who brag about syntax highlighting. The 99.9% rest of us consider it a good tool that improves our workflow.
- ahmedalsudani 8y agoNo dispute integration is nice, but it is not working properly from what my parent comment was saying. Your options are to wait for it to improve, fix it yourself, or change your tools/workflow. Some people seem to have had an allergic reaction to my comment. Maybe it's the emacs mention, which was tongue in cheek. Oh well ¯\_(ツ)_/¯ I'll leave it as it is... for this is a righteous battle!
- always_good 8y agoI don't see a righteous battle. You mentioned Emacs as a solution which has a Rust plugin that has problems like most other Rust tooling. Yes, Rust's tooling landscape is immature and still a work in progress. Obviously you can just forgo editor integration all together. But you can do that in any editor.
- guscost 8y agoThe fancy tools can check your code as you write it and highlight problems inline so you don't have to switch context in order to fix them. This saves time in any language, but static analysis with Rust is unusually powerful so tightening that feedback loop pays serious dividends (when it works). I'm not saying emacs and vim aren't really cool technologies. But why would a person who cares about optimizing keystrokes and crafting macros dismiss a tool that optimizes debugging and refactoring? I spend a heck of a lot more time staring at code than I do typing it, and if the reverse is true for you then you're some kind of savant and/or (more likely) you're writing too much code and reading too little of it.
- IshKebab 8y agoRobust autocomplete is probably the most important tool for a language there is though. It's a shame that Rust doesn't have it and I'm slightly concerned that in never will - type inference means in lots of places there simply isn't enough information to do autocomplete properly.
- Matthias247 8y agoYou can use the Intellij plugin, which fares a little bit better in some cases, but also struggles with some scenarios. All in all IDE support is a work-in-progress for Rust. It's definitely a lot better than 2 years ago, but still has a long way to go. It's currently maybe the only thing which isn't that great regarding tooling in Rust. Other features, like cargo and crates.io, feel however miles ahead of C++.
- Waterluvian 8y agoOh interesting. Am I right to read into your comment that this is more of a Rust problem rather than a Rust plugin for vscode problem?
- timClicks 8y agoNo, it's a tooling problem. Rust is a static language with a good type system.
- Matthias247 8y agoIt's more of a "not yet implemented" thing than a non-solvable problem. However a thing that needs to be considered is that building good IDE support for Rust is a very hard task, since it's a pretty complicated language (e.g. with all the type interference, traits, automatic dereferencing and conversions going on). Another fact is that the rustc compiler hasn't been built for supporting these kinds of use-cases right from the start, as e.g. the typescript and kotlin compilers have in my understanding. That means the IDE tooling can't directly query the compiler, but must duplicate some of the parsing and interference logic.
- branko_d 8y agoAnother good example of "compiler as a service" is the Roslyn compiler for C# (and also written in C#). What is interesting is that Roslyn was a complete rewrite compared to the original C# compiler (which was written in C++ and couldn't power an IDE, so the tools like Resharper had to implement their own compiler front-end, essentially). IIRC, the ability to evolve the language was also a factor. It seems that as the language matures, there comes a point where tooling (and further evolvability!) becomes important enough to justify the huge undertaking of rewriting the entire compiler. I wonder when will Rust reach that phase...
- bvinc 8y agoI use vscode with the rust (rls) extension. It's not perfect. Sometimes when I edit cargo files it gets stuck and isn't recompiling my code. When that happens, I just ctrl-shift-p and select "reload window" and it's fixed in a couple seconds. It's not ideal, but it gets the job done and it's better than manually compiling my code.
- Waterluvian 8y agoI've found that autocomplete is pretty janky. It often doesn't work or is incomplete. Have you been having better luck?
- staticassertion 8y agoI highly recommend the intellij plugin. If you use clion you also get debugger support, I believe. Autocomplete works well. Macro support is improving all the time, and is pretty solid. Performance needs more work, but is generally acceptable.
- sidcool 8y agoAlso try TabNine autocompletion for Rust. It's quite good.
- YuukiRey 8y agoI write Rust in `neovim` and I don't use any kind of linter that's integrated into the editor. I also have Visual Studio Code installed and setup and here's the thing: Rust (and also Haskell to a lesser degree) can have pretty long error messages but they are also informative. Some of them even have this sort of ASCII art showing you exactly where something was moved and then borrowed and so on. If you only use VSC you might not even be aware of those errors since the formatting of error window popups is pretty poor. So I simply open a new tmux pane and run a file watcher (`entr`) which runs `cargo check` (and in other windows also clippy and test) and it works perfectly. Since VSC has an excellent integrated terminal which you can split and have multiple tabs you could just do that in VSC itself. Frankly, I don't know any editor that displays live linting (and compiler feedback) in a way that I find useful but of course your YMMV. I've only used Intellij IDEA, VSC and neovim though and I write JS (professionally) and now Rust and Haskell for fun.