Table of Contents
How to work on Visual Studio
An open-source integrated development environment (IDE) or editor for a well-known programming language is called Visual Studio.
It works with Windows, Linux, and macOS.
Features of Visual Studio:
- Debugging
- Included GitHub support
- Syntax highlight
- Extend plugin support
- Inbuilt Debug Support
- Git Plugin
- SSH integration
- Terminal
- Code Snippets
- Code refactoring
VScode – Autosave
Typically, editors offer Auto-Save for a file. To save the changes, use the VSCode Auto Save option.
When an editor loses focus or a file or editor is closed, the Auto Save feature automatically saves the modifications.
How can the Visual Studio Code editor automatically store code?
First Step:
1.Click on Manage > Settings on the left-hand menu, then put “auto save” into the search field.
It offers the following choices. Files: Auto Save: afterDelay – uses the delay argument to automatically save any unsaved changes. Files: “Auto Save” Save the changes after a delay of 1000 milliseconds.
2.The second method is to use the File Menu’s autosave option.
The steps to enable the Auto Save are as follows:
- File>Auto Save
- It is automatically checked and turned on.
- These alterations are permanently recorded and applied to the editor. Project-specific settings, third ways
- Under a project, create a folder called.vscode.
- Make a file called settings.json.
- Add the following configuration to the setttings.json file.
- To make modifications, restart VSCode.
Encoding
There are numerous ways we may accomplish this.
- To the opened file, change the encoding.
- In VSCode, update the encoding permanently and globally.
How to alter the encoding for a file that is open in VS Code?
In Visual Studio Code, open the file, The following option is hidden if the file is not open.
1.The Visual Studio code’s bottom bar contains the UTF-8 text.
2.You will see two choices after clicking the UTF-8 label, as shown below.
Choose one of the available choices.
- Reopen with Encoding: The chosen encoding is used to reopen the file.
- Save with Encoding – The chosen encoding is used to save the file. You can select one of the choices listed above.
3.A further popup asking you to choose an encoding from each encoding list occurs.
4.The file will now be opened or saved using the chosen encoding.
Installation of VScode
A popular editor and IDE for several programming languages is called Visual Studio Code.
It is compatible with Windows, Mac, and Linux.
Installing VSCode on the Ubuntu desktop
The following terminal command
sudo snap install code --classic
Ubuntu users should remove Visual Studio Code
Word Wrap
With the word wrap option in the editor window, you may set a maximum width for the text content on a row.
Duplicate Rows
Different techniques for adding and removing duplicate lines or rows in Visual Studio Code.It offers numerous options for adding and removing duplicate lines and rows from a text file that has been opened in VSCode.
How do I replicate a line in Visual Studio Code?
A duplicate line can be made in a variety of ways.
1.Copying and pasting To duplicate the lines, simply use the standard copy and paste method. Use the command below to first pick the line that you wish to duplicate. Use Ctrl + C to copy, and Ctrl + V to paste.
2.built-in copy line up and down functionality
3.Select “Copy Line Up” or “Copy Line Down” from the Selection Menu.
Shortcut command usage
1.Shift + Alt + Down and Shift + Alt + Up on Windows
2.Using Linux, press the keys Ctrl + Shift + Alt + Down and Ctrl + Shift + Alt + Up.
With File > Preferences > Keyboard Shortcuts selected, the shortcut commands Shift + Option + Down key and Shift + Option + Up key
VSCODE search techniques for one or more files.
There are various methods for searching files. Symbol search is used
Use the short cut below to navigate to Symbol Search.
1.In Windows, press Ctrl + Shift + O; in Mac OS, press Cmd + Shift + O.
2.The Symbol Search popup appears.
3.Type string into the search box that begins with @. String names for methods, classes, interfaces, and variables
Vertical Ruler
Editors use vertical rulers to draw a visible vertical line for a specific character width that is known. A vertical line indicates that there are more characters after this line.
Vertical Rulers in VSCode
The steps to add vertical rulers are as follows.
1.Select Files > Preferences > Settings to access.
The Settings window is displayed.
2.In the search settings, enter “Rulers” or “editor.rulers.”
3.Select Edit under Settings.
json
Also Read :VS Code
In Visual Studio Code, how to fold and unfold each section of code
To do it, use the shortcut instructions shown below.
the Visual Studio code window
Open a java code file, for instance.
Fold
1.Ctrl + Shift + [shift + + in Windows and Linux] + [unfold in MacOS
2.In MacOS, shift + +] is equivalent to Ctrl + Shift +] in Windows and Linux.
3.Ctrl + Shift + Alt + [shift + + Alt + in Windows and Linux] [unfold in MacOS All
4.Windows users press Ctrl + Shift + Alt +] while Linux users press shift + + Alt +]
Hide Files
1.the Visual Studio code window
2.To change settings, select File > Preferences.
3.entered “files:exclude” in the search settings after opening the settings page
4.omit Section, select “Add Pattern” from the menu.
5.The input box is enabled, and a folder or file name is entered there. To save it, select Ok.
6.You can add directories, files, or regular expressions to the text field to indicate the file’s path.
Multiple lines in Visual Studio Code are joined
1.Activate VSCode Editor.
2.Choose the text or a number of lines that you want to merge.
3.Ctrl + Shift + P will launch the Command Palette.
4.It launches a pop-up window. Join the lines to choose it.
5.It combines several lines into one line.
Also Read: Know About Eclipse