@@lowlevelvirtualman8006 I only use your email to send out valuable information and eventually share courses that I'm in the process of building. Your data will never be sold or shared with advertisers.
Updates for one year later: 1. Rust-analyzer has in now officially become the official plugin (officially). 2. Better TOML is depreciated, replaced with Even Better TOML.
or Neovim with tree-sitter, rust-analyzer, rust-tools, cmp, you get completion, type annotations, and it's easy to add key bindings for rustfmt and "cargo build" or "cargo run"
cargo-edit also seems like a good idea for adding/removing crates from the CLI. Not quite an IDE enhancement, but sort of. cargo install cargo-edit Then: cargo add
I would just add: Activate "format on save" in VS code. For automatic formatting by the rust-analyser. Thanks I use your video for when i change machines
These days I'm neovim with a bunch of plugins that do basically everything vscode does. I still like code for debugging more, however, debugging is often something you can just avoid if you're programming carefully. So, once in a great while when I get too creative for myself, lol.
@@vorrnth8734 Nope. But, while this is convenient, you can do something like this in your Cargo.toml: [dependencies] rand = "~0" // any version < 1.0.0 rand = "~0.7" // any version < 0.8 that is > 0.7.0 rand = "0.*" // any version < 1.0.0 rand = "1.*" // any version less than 1.0.0 < 2.0.0 * by itself doesn't work, so don't do that. :D These will resolve to the highest update that your code supports, and is much better than hardcoding numbers in. (You should NEVER do that. The minor revisions are often security fixes and you want them.)
finally, i couldn't find the answer to why i need visual studio code and what should i do if i don't need it.... also thanks for being on point. (i just started with Rust, lets get rusty)
I just started Rust yesterday(12/04/2024). I'm optimistic about Rust and want to learn more about it, however my other self is thinking about job availability.
Thank you for this. I was a Java developer for over 20 years. Before that COBOL, FORTRAN, Jovial (an Algol derivative), C/C++ and AS/400 RPG (with some Perl and other scripting languages mixed in as needed). I retired from development in 2017 and have been playing guitar in bars and restaurants for fun. However, I have recently been missing programming and have gotten back into it by learning Rust. I used IntelliJ for years and loved it, but looking at VSCode and your tutorial, it seems as though Rust is a VERY interesting language. The tutorial on VSCode is fairly complete, however what extension (if any) do you use for git? In IntelliJ you could see in the IDE what files were added, changed or committed. I used the command line git for the most part, but it might be nice to do it from within VSCode.... Again, thanks. I'm going through your RUclips Tutorials and more and your references on cool projects and some of the Euclid project exercises are next. Hope to have them out on git as I progress.
@@jaromor8808 I used IntelliJ for 15 years and still maintain a Subscription to all of them. Currently, Rust is not as well supported with its plugin in IntelliJ as it is in VSCode. I think it is a little kludgy…. BUT if it gets better, I will probably switch back. I am very used to IntelliJ, but VSCode is something new to me and I’m enjoying working with it.
I am really interested in the Tabnine plugin and will probably install it before I restart learning Rust yet again. One thing I have been thinking about lately is if it would be good to start learning testing immediately after getting to the "Hello world!" stage and follow more of a test driven method from the start to make it my normal way to approach Rust. The same for Doc comments with example tests as soon as possible in the process. Anyone know of a test driven design tutorial that would be good for someone who still fights the borrow checker and lifetimes often?
Tabnine is really good and useful, and theres a video about visual representation of rust lifetime and borrow checker: ruclips.net/video/8M0QfLUDaaA/видео.html
Had most of those extensions. Didn't know about crates and Tabnine though. The Microsoft Learn - "Take your first steps with Rust" course has a module on automated tests, including documentation tests. But the course as a whole is not test driven. Still, you might find it useful.
If you're on Linux and get a bootstrap error for rust-analyzer, saying it can't execute "rust-analyzer-x86_64-unknown-linux-gnu --version", make sure the binary has the executable flag set. This wasn't the case for me after installing the vscode plugin and I had to manually run chmod +x on the file. The exact path (and error) you can find in the output window of vscode
my problem with rust analyzer is that even on good hardware it gets too slow on large projects, like taking 5 seconds after saving to get auto completion and other things
I have the same setup except for Tabnine. How well does your setup work for you? For me it's not always the most stable experience, sometimes rust-analyzer just gives up or breaks in some other way. But that's not my main issue. That is reserved for code completion just breaking down for what feels like every other thing I write. And I often can't tell the reasons. Like, if I don't end my line with a semicolon it breaks the completion quite reliably. But even with that semicolon if often breaks. Sometimes it can complete attributes, sometime that dot breaks the analysis of the entire file. It doesn't just fail for attributes, it also often fails to complete plain variables in my code. The moment I finished what I was writing the analysis says it chdcks all out, but it doesn't offer any help along the way because in that moment it's hopelessly broken. I'd really love to know the reasons this happens, if I can do something against it. I wonder if Tabnine helps there, I guess I'll try. Because that is QUITE annoying for me, it means I have to consult the official documentation far more often than I'm used to, which breaks my flow. I guess one part of it is the general complexity of Rust code interpretation. Which I'm not ALWAYS a fan of. I LOVE type inference, but I'm not sure it's a good idea to have a later push into a vector determine the type of the elements. Type-inference should be limited to the statement and the stuff above (and with "statement" I include method chaining and closure argument inference, that's great). Maybe I am just too used to how Typescript does it, but I have thought about it, and I don't think I am strongly biased by that. To have a directed "flow of type information" makes things just a whole lot more predictable. The way it is one can have partially circular dependencies, thats super hard to reason about. And when the compiler decides it's too much for it, the things are already at a complexity that most coders are hopelessly lost. If you have a system that isn't perfect, and may require manual help, one should think strongly where one makes the system stops. Looking eg at Lifetimes. In that case the Rust designers were much more careful how far they were willing to go. They could've done more, but they didn't, it wasn't worth it, because it would've made for a very hard curve of understanding. I think when it comes to type inference the Rust designers overdid it a bit. It's not that hard to write Vec::::new() instead of Vec::new() every now and then but it makes things much easier both for the reader of that code, as well as the Rust compiler.
@@user-gl9yo8rz8k I think he means, when your test fails, how do you plan to find the reason without debugging? Short of formal verification, debugging is essential for complex code, btrees for example.
Unfortunately rust-analyser gives me the following error (so I will currently switch back to the other VSCode Rust extension that was working better - "rust-lang.rust"): --- rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file r:\workspace\aoc-2021\aoc-2021-18a\Cargo.toml Caused by: 0: Failed to parse edition 2021 1: invalid edition: "2021"
I've seen rust-analyzer display the same message via the Corrosion plugin for Eclipse. Very annoying, but closing and reopening the editor window has always worked for me.
Rust is one of the best languages for targeting Wasm imo. Now, Wasm itself is great in the browser if you have a use for more low-level code in your app. But if your app is more server-focused, you could probably simplify things by sticking to JS on the client. On the server-side you can go with pretty much anything and the choice will be domain/integration-specific, but Rust is a great choice there as well, very fast, very safe, and great dev-exp.
i have problem with rust-analyzer, it shows me this : [ERROR rust_analyzer::main_loop] FetchWorkspaceError: rust-analyzer failed to load workspace: Failed to load the project at ... Thank you
after using extension you described I for some time found them all good except for last extension, tabnine. I wouldnt recommend it. there are times when it is useful but not for me
I had been using rust-analzyer and it was working perfectly and all of a sudden it no longer infers any types even if I explicitly type. Everything is represented by unknown and I cant find a fix for the life of me. Any suggestions are greatly appreciated. Ive restarted vscode, uninstalled and reinstalled rust-analyzer, switched to the pre-release and more. I havent been able to find the answer through the rust discord either
is there any way to get the DEBUG/RUN buttons from vs code to work? I find it uncomfortable that I have to go to the main file and main function every time I want to start debugging
I installed the rust-analyzer plugin and sadly, the inlay type annotations are not visible. They are enabled in the config though... Am I missing something?
📝 Get your *FREE Rust cheat sheet* : www.letsgetrusty.com/cheatsheet
To be honest it looks quite suspicious how you want to get our emails ;0
@@lowlevelvirtualman8006 I only use your email to send out valuable information and eventually share courses that I'm in the process of building. Your data will never be sold or shared with advertisers.
@@lowlevelvirtualman8006 Yeah Im also doubt tit, because this mailing may contain the Rust lang virus! 🤔
and what its for crate search's?
You're basically my Rust mentor. Thanks for everything fren, keep it up!
lol, i agree
agreed, bogdon is a legend
Updates for one year later: 1. Rust-analyzer has in now officially become the official plugin (officially). 2. Better TOML is depreciated, replaced with Even Better TOML.
You're good 👍
3:51 Crates extension is very handy ! Also , Error Lens and Tabnine ! Thanks so much 🙏🏻👍🏻 !
Absolutely fantastic, thank you! I'm teaching myself Rust and now I feel like I have a great environment to do that in.
Fancy seeing you here. Miss your videos.
or Neovim with tree-sitter, rust-analyzer, rust-tools, cmp, you get completion, type annotations, and it's easy to add key bindings for rustfmt and "cargo build" or "cargo run"
I am new Rust. Thank you for the VSCode Setup, I really needed something like this!
Damn, nice overview. Didn't know about the last two extensions: TabNine AI and Error Lens. Installed right away! Good stuff. Good stuff. Thank you.
cargo-edit also seems like a good idea for adding/removing crates from the CLI. Not quite an IDE enhancement, but sort of.
cargo install cargo-edit
Then: cargo add
oh neat!
I would just add: Activate "format on save" in VS code. For automatic formatting by the rust-analyser. Thanks I use your video for when i change machines
Great timing, just made a fresh install of my OS and was downloading vscode when i got this notification 🔥👍
i like how slow you are and how you take time to explain i really like that thank you
Thanks for showing specific tools, and showing what they do!
thanks i am getting started with rust from C/C++ and this helped me a lot thank you
Man, you are being extremely helpful. Well done 👏
These days I'm neovim with a bunch of plugins that do basically everything vscode does. I still like code for debugging more, however, debugging is often something you can just avoid if you're programming carefully. So, once in a great while when I get too creative for myself, lol.
Is there something Like the crate extension for neovim?
@@vorrnth8734 Nope. But, while this is convenient, you can do something like this in your Cargo.toml:
[dependencies]
rand = "~0" // any version < 1.0.0
rand = "~0.7" // any version < 0.8 that is > 0.7.0
rand = "0.*" // any version < 1.0.0
rand = "1.*" // any version less than 1.0.0 < 2.0.0
* by itself doesn't work, so don't do that. :D These will resolve to the highest update that your code supports, and is much better than hardcoding numbers in. (You should NEVER do that. The minor revisions are often security fixes and you want them.)
@@mindmaster064 thanks for the info
finally, i couldn't find the answer to why i need visual studio code and what should i do if i don't need it.... also thanks for being on point. (i just started with Rust, lets get rusty)
Even better toml
I just started Rust yesterday(12/04/2024). I'm optimistic about Rust and want to learn more about it, however my other self is thinking about job availability.
jeez dude, your eyes better 2 years ago
in your recent video you look like Neo without any sleep
Thank you for this. I was a Java developer for over 20 years. Before that COBOL, FORTRAN, Jovial (an Algol derivative), C/C++ and AS/400 RPG (with some Perl and other scripting languages mixed in as needed). I retired from development in 2017 and have been playing guitar in bars and restaurants for fun. However, I have recently been missing programming and have gotten back into it by learning Rust. I used IntelliJ for years and loved it, but looking at VSCode and your tutorial, it seems as though Rust is a VERY interesting language. The tutorial on VSCode is fairly complete, however what extension (if any) do you use for git? In IntelliJ you could see in the IDE what files were added, changed or committed. I used the command line git for the most part, but it might be nice to do it from within VSCode....
Again, thanks. I'm going through your RUclips Tutorials and more and your references on cool projects and some of the Euclid project exercises are next. Hope to have them out on git as I progress.
VS Code has Git baked in, but you may want to install the GitLens Extension or GitKraken
Funny how that works. I retired from tech, played bass in bar bands, it's fun but have missed tech and am learning rust now as a hobby.
why not use Idea or CLion?
@@jaromor8808 I used IntelliJ for 15 years and still maintain a Subscription to all of them. Currently, Rust is not as well supported with its plugin in IntelliJ as it is in VSCode. I think it is a little kludgy…. BUT if it gets better, I will probably switch back. I am very used to IntelliJ, but VSCode is something new to me and I’m enjoying working with it.
Now RustRover released which is a fully featured Rust IDE from JetBrains. Its free for now too@@stephenmcconnell7868
I installed rust-analyzer in my vsc but I can see the type annotations?
Help.
Thank you! Very useful 👍
Error Lens is a live saver. Thanks!
I am really interested in the Tabnine plugin and will probably install it before I restart learning Rust yet again.
One thing I have been thinking about lately is if it would be good to start learning testing immediately after getting to the "Hello world!" stage and follow more of a test driven method from the start to make it my normal way to approach Rust. The same for Doc comments with example tests as soon as possible in the process. Anyone know of a test driven design tutorial that would be good for someone who still fights the borrow checker and lifetimes often?
Tabnine is really good and useful, and theres a video about visual representation of rust lifetime and borrow checker: ruclips.net/video/8M0QfLUDaaA/видео.html
Had most of those extensions. Didn't know about crates and Tabnine though.
The Microsoft Learn - "Take your first steps with Rust" course has a module on automated tests, including documentation tests. But the course as a whole is not test driven. Still, you might find it useful.
If you're on Linux and get a bootstrap error for rust-analyzer, saying it can't execute "rust-analyzer-x86_64-unknown-linux-gnu --version", make sure the binary has the executable flag set. This wasn't the case for me after installing the vscode plugin and I had to manually run chmod +x on the file. The exact path (and error) you can find in the output window of vscode
thx!
Thanks so much
was very helpful
it's awesome to have that.
I learned to write rust without a debugger )))
Now I know what ext to install
my problem with rust analyzer is that even on good hardware it gets too slow on large projects, like taking 5 seconds after saving to get auto completion and other things
Great video! Thank you
спасибо большое, Богдан
I have the same setup except for Tabnine.
How well does your setup work for you? For me it's not always the most stable experience, sometimes rust-analyzer just gives up or breaks in some other way.
But that's not my main issue. That is reserved for code completion just breaking down for what feels like every other thing I write. And I often can't tell the reasons.
Like, if I don't end my line with a semicolon it breaks the completion quite reliably. But even with that semicolon if often breaks. Sometimes it can complete attributes, sometime that dot breaks the analysis of the entire file.
It doesn't just fail for attributes, it also often fails to complete plain variables in my code.
The moment I finished what I was writing the analysis says it chdcks all out, but it doesn't offer any help along the way because in that moment it's hopelessly broken.
I'd really love to know the reasons this happens, if I can do something against it. I wonder if Tabnine helps there, I guess I'll try. Because that is QUITE annoying for me, it means I have to consult the official documentation far more often than I'm used to, which breaks my flow.
I guess one part of it is the general complexity of Rust code interpretation. Which I'm not ALWAYS a fan of.
I LOVE type inference, but I'm not sure it's a good idea to have a later push into a vector determine the type of the elements. Type-inference should be limited to the statement and the stuff above (and with "statement" I include method chaining and closure argument inference, that's great).
Maybe I am just too used to how Typescript does it, but I have thought about it, and I don't think I am strongly biased by that. To have a directed "flow of type information" makes things just a whole lot more predictable. The way it is one can have partially circular dependencies, thats super hard to reason about. And when the compiler decides it's too much for it, the things are already at a complexity that most coders are hopelessly lost.
If you have a system that isn't perfect, and may require manual help, one should think strongly where one makes the system stops. Looking eg at Lifetimes. In that case the Rust designers were much more careful how far they were willing to go. They could've done more, but they didn't, it wasn't worth it, because it would've made for a very hard curve of understanding.
I think when it comes to type inference the Rust designers overdid it a bit.
It's not that hard to write Vec::::new() instead of Vec::new() every now and then but it makes things much easier both for the reader of that code, as well as the Rust compiler.
Thanks for the tips! Awesome job ❤
What's the difference between:
> RUST-analyzer vs Cross-RUST-Analyzer
> Better-TOML vs Even-better-TOML
?????
Great video again, thanks for the tabnine idea.
Borrow checker + lifetimes + unittest = no debugger needed.
@pm4rcin If you need to debug tests or write tests for tests, then you are doing something wrong.
@@user-gl9yo8rz8k I think he means, when your test fails, how do you plan to find the reason without debugging? Short of formal verification, debugging is essential for complex code, btrees for example.
Extremely helpful. Thanks
Amazing tips, thank you !!!
great thanks for super awesome content!
Me sits down to set up and ide on steam deck forgets keyboard.
In another state
Thank you! So helpful.
It is helpful video for rusty.
Thank you.
let’s go for vim setup 😉
Are you kidding? Emacs all the way! ;)
I use it. Its nice. I don't know if there is ai completion tho.
@@philstubblefield ahah, don’t go that way 🤣🤣
Binge watching all your videos right now. This one was especially useful. What's the song at the end called? I like it
Love your content!
I had the exact same plugins except for error lense and tabnine. I use Copilot usually.
bro don't, most prolly it'll destroy ur coding skills...
Thanks bro!
Please can you create a video on rust and wasm we need to get into web development so bad
Very useful thanks
Unfortunately rust-analyser gives me the following error (so I will currently switch back to the other VSCode Rust extension that was working better - "rust-lang.rust"):
---
rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file r:\workspace\aoc-2021\aoc-2021-18a\Cargo.toml
Caused by:
0: Failed to parse edition 2021
1: invalid edition: "2021"
I've seen rust-analyzer display the same message via the Corrosion plugin for Eclipse. Very annoying, but closing and reopening the editor window has always worked for me.
I will try this... thanks.
Please make a serde and/or serde-json tutorial! After that you could do protobuff !!
I use Rider Plugin for Rust.
muy bueno, gracias
Learned C/C++, now learning JS for frontend, will it a good choice for Backend to pick up Rust and webassembly?
Can use JavaScript/Ts for the backend as well or Java
Rust is one of the best languages for targeting Wasm imo. Now, Wasm itself is great in the browser if you have a use for more low-level code in your app. But if your app is more server-focused, you could probably simplify things by sticking to JS on the client. On the server-side you can go with pretty much anything and the choice will be domain/integration-specific, but Rust is a great choice there as well, very fast, very safe, and great dev-exp.
Which one feels the most comfortable to you? I second using JS or TS, or Java if you want a syntax closer to C.
i have problem with rust-analyzer, it shows me this : [ERROR rust_analyzer::main_loop] FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to load the project at ...
Thank you
I use Linux vim which works everywhere.
I can't find rust-analyzer on the plugin marketplace. Is it still a thing?
Hello bogdan, for a beginner in rust, what type of setup would you recommend, vscode or clion one?
Could you do a video on how you debug Rust programs with CodeLLDB in VS Code?
after using extension you described I for some time found them all good except for last extension, tabnine. I wouldnt recommend it. there are times when it is useful but not for me
You 🤟🏽😎🎸!
N E O V I M - all what you need
0:40 - I was suprised you left intellij IDE for probably whole night to hide indexing prompt
vscode - rust-analyzer, codeLLDB, better toml, crates, error lense, tabnine
I came here hoping for how to setup for visual studio, instead I got visual studio code. really let me down man
can tabnine and copilot work together or I have to choose one ?
I had been using rust-analzyer and it was working perfectly and all of a sudden it no longer infers any types even if I explicitly type. Everything is represented by unknown and I cant find a fix for the life of me. Any suggestions are greatly appreciated. Ive restarted vscode, uninstalled and reinstalled rust-analyzer, switched to the pre-release and more. I havent been able to find the answer through the rust discord either
Is that last version of rust cheat sheet, or you gona improve it?
What do you think of Rust Syntax extension in VScode?
is there any way to get the DEBUG/RUN buttons from vs code to work? I find it uncomfortable that I have to go to the main file and main function every time I want to start debugging
How is rust-analyzer so fast for you? There is at least. 1-2 second delay on my system for suggestions to show up
👍
rust-analyzer or intellij rust?
Hello, I had the most of the extensions but can you give more explanations about tabnine ?
It’s AI powered auto complete. Check out the extension page for more details.
I use neovim
BING BONG!
Aye yooo!
I installed the rust-analyzer plugin and sadly, the inlay type annotations are not visible. They are enabled in the config though... Am I missing something?
After installing rust-analyzer you will be prompted to install the language server. Did you do that? Do you see the Run/Debug annotations?
@@letsgetrusty no :( no debug|run and no prompt as well:-( can I trigger it manually?
@Ziad Ghalleb just wondering if you’re also on a macOS ?
By default it only works on Cargo projects.
What about sublime text editor with tabnine with rust addon ?
Sure that's another options. I'm not familiar with sublime.
Tabnine is like a joke.
Which consume all your memory.
Neo vim is better btw
1. vim
Imagine being taught about Rust by a person named Bogdan.
Copilot 😎
1. i clicked because of title
2. i see rust
3. i see vscode
4. im trying to see if its joke to show up vim
5. i do not see vim
6. i close this vid
:(
🤮🤢