Tips for using Visual Studio Code that dev should know

Tram Ho

Zen Mode

Zen mode is a mode that helps you avoid distractions during the coding process.When turning on Zen Mode, all redundancy such as sidebars or tool boxes are removed, leaving the code screen in the middle to help you focus more. .

You can enable Zen Mode by selecting View> Appearance> Zen Mode

Split View

When you do something that needs to use two or more files at the same time, or simply want to check for changes, similar or different between the two files, switching between tabs is quite annoying, time-consuming, Mistakes sometimes occur.

Visual Code has helped us solve this problem by allowing us to split the screen into 2 or more for multitasking.

You can use Split View by selecting View> Editor Layout> Split up / down / left / right or you can work faster by holding the mouse to drag a tab to split to the right edge of the screen.

Command Palette

The Command Palette gives you access to commands for visual code with just a few keyboard shortcuts.

To open the Command Palette, you need to type Ctrl + Shift + P , then you can type the keywords needed to search commands list commands.

Change JSON Setting

This is a pretty interesting utility of Visual Code, allowing you to edit the default value of the editor or any extentions you have installed.

First access the Command Palette as I said above and select Preferences: Open Default Settings (JSON) . (this is the default setting of VS)

Continue to access the Command Palette and select Preferences: Open Settings (JSON) (This is the editing setting) and drag the tab across the right corner of the screen to easily split the view. ??

As the picture above, I have edited the settings of php-cs-fixer (an extension to help correct the php code convention according to the standard), namely:

  • "php-cs-fixer.onsave": true : automatically adjusts the code to the correct convention when saving
  • "php-cs-fixer.formatHtml": true : option to automatically format code html
  • … etc. and clouds

Keyboard Shortcut

Keyboard shortcuts help us a lot in programming, reduce operation time and create a sense of convenience for users. First, you can access the list of keyboard shortcuts by using the keyboard shortcut Ctrl + K + S ?

Some necessary keyboard shortcuts for developers:

  • Ctrl + Space : This shortcut helps you complete code more quickly, when used, a menu will display to help you complete the piece of code is in progress, very suitable for beginners when not remember the function or “remember mang trough” ?
  • Ctrl +? : Comment the desired line of code or code
  • Ctrl + Shift + F : Search all files
  • Ctrl + D : Search for a file in any text and manipulate it
  • Ctrl + Shift + T : Reopen closed tabs
  • Ctrl + Alt + R : Reload visual code
  • Ctrl + Backspace : Delete the word you just entered, this is a feature you can apply anywhere. ?
  • Ctrl + Shift + Right / Left Arrow : Highlight in units of letters (default is characters)
  • Ctrl + Shift + D : Duplicate the specified line
  • Ctrl + Home : Move the cursor to the beginning of the file
  • Ctrl + End : move the cursor to the end of the file
  • Alt + Up / Down Arrow : Move the line up or down

…. And there are many other useful keyboard shortcuts, but I think that just getting used to the above keys will help dev save a lot of programming time already. ?

summary

Above are my share of some small tips when using VS in programming, if something goes wrong, expect everyone to comment, thank you. (bow) ?

Share the news now

Source : Viblo