13 Tweets 1 reads Mar 15, 2023
5 VS Code Productivity Hacks that everyone should know about ✨
a thread 🧡
➑️ Use GitHub Copilot
GitHub copilot is a VS Code extension that helps you write clean and better code just based on comments. It’s practically an AI Pair Programmer.
➑️ Try to use the command palette
Command palette is one of the best features of VS Code. It’s a mini search engine like Google. All the settings, commands, functions, scripts can be accessed from the command palette directly.
You need to press Ctrl+ shift + p to access it directly or you can press Ctrl + p and then start typing your command.
Just type > and then type the rest of your command further.
➑️ Moving code
The classical move for moving the code in a file would be to cut the code selection and hit enter in the following place where you want to add the code and then paste the code. Well, this approach is flawless, but it is time-consuming.
The better to do that would be using the Alt + Up Arrow or Down Arrow key. You can now move your piece of code between blocks and of code easily. This comes very handy when you are trying to clean up or refactor your codebase.
➑️ Use regular expression in find/replace
Let’s assume that you have thousands of records in your .csv file. Now you have to replace some text. Here is when regular expressions come to your rescue if you are familiar with them. Using regex in find and replace is very beneficial
while locating sequences that are hard to find using the basic find and replace.
You can bring up this dialog box by pressing Ctrl + h and once you toggle the * you can write the regular expressions in the find and replace box directly.
So instead of writing a tiery script for finding and replacing specific texts, you can directly do it just by using regular expressions.
➑️ Code Refactoring
Code Refactoring may feel very boring to do at some times, but from now on, you can do it in a jiffy. You have to select the required text/name that you want to refactor and press Fn + F2
Now, a small pop up box will appear mostly beneath the selected text.
Now type the new text and hit enter. Voila, your code is now refactored in all the files that it is present. Now you may feel that you have to go to each and every file to save it. But you don’t need to do it. Just open the command palette and search for Save all files
In two steps, you can refactor your code effortlessly and efficiently.
✨ So these were some VS Code Productivity Hacks from our side! What are your favorite hacks? Share it in the comment section! πŸ‘‡

Loading suggestions...