DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • An Introduction to Type Safety in JavaScript With Prisma
  • Alexa Skill With Local DynamoDB
  • Alexa Skill With Python
  • Alexa Skill With Node.js

Trending

  • Can You Run a MariaDB Cluster on a $150 Kubernetes Lab? I Gave It a Shot
  • Building a Real-Time Audio Transcription System With OpenAI’s Realtime API
  • AI Speaks for the World... But Whose Humanity Does It Learn From?
  • Using Java Stream Gatherers To Improve Stateful Operations
  1. DZone
  2. Coding
  3. Tools
  4. 10 Tricks Every Developer Should Know in Visual Studio Code

10 Tricks Every Developer Should Know in Visual Studio Code

Begin your journey to becoming a power user with VS Code.

By 
Hari Prasath user avatar
Hari Prasath
·
Sep. 19, 19 · Presentation
Likes (8)
Comment
Save
Tweet
Share
76.3K Views

Join the DZone community and get the full member experience.

Join For Free

graffiti-in-art-studio-with-lighting-equipment

Customize VS Code for your own needs

Visual Studio Code is a fundamental programming tool for editing the source code of computer programs. It is developed by Microsoft for working in Windows, Linux, and Mac operating systems. This application is free and open source for both private and commercial use.

Here is a list of 10 tricks every developer should know in Visual Studio Code.

You may also like: C# Interactive in Visual Studio.

Command Palette

The Command Palette allows you to access various available commands just by typing a keyword instead of navigating through menus.

The Command Palette can be opened with the key combination Ctrl+Shift+P. You can then type relevant keywords to see a list of commands in the drop-down window.

Command Palette

Command Palette

Zen Mode

Zen Mode is a distraction-free view. All the extra toolboxes and bars in your window will be removed, allowing you to completely focus on your code.

Jump to and from Zen mode by selecting View > Appearance > Toggle Zen Mode.

Also, you can center-align your code in Zen Mode to experience a view like a document editor. Jump in and out of the centered layout by selecting View > Appearance > Toggle Centered Layout.

Centered Code in Zen Mode

Centered Code in Zen Mode

Split View

If you’re good at multitasking, and you are working on two different files of the same project simultaneously, or need to check the difference between two files, then go to the split view.

The split view can be customized based on your preferences, whether you like to lay out files vertically or horizontally.

You can achieve the split view by selecting View > Editor Layout > Split Up.

Comparing Files in Split View

Comparing Files in Split View

Tag wrapping

Emmet is a plugin that saves time and improves developer productivity by helping you type less but generate more code.

Emmet allows you to get the corresponding tags from the abbreviated code you are typing. You can see an example in the following screenshot. Check out this list of all the pre-supported tag wraps in Emmet.

Tag Wrapping Using Emmet

Tag Wrapping Using Emmet

Git Integration

Visual Studio Code comes with Git integration that allows you to commit, pull, and push your code changes to a remote Git repository.

Open a file in a Visual Studio Code that belongs to a Git repository. The editor will show the difference between the working copy and the current file in a remote repository. This won’t work without an internet connection; one is required to stay connected with the Git repository.

Check out this cheat sheet for all the Git commands.

Code Difference between Working Copy and Code Base

Code Difference between Working Copy and Code Base

New themes and plugins

VS Code lets you apply a theme to the syntax highlighting of text in the editor based on your preferences. You can find many themes in the VS Marketplace that are absolutely free.

List of Themes for VS Code

List of Themes for VS Code

Also, VS Code has a rich plugin API, which allows users to create awesome plugins. Some of the most popular plugins are:

  • Settings Sync: The most common settings plugin. It allows you to sync your VS Code installations on different devices.
  • Docker: Developing with Docker can sometimes mean running complex Docker commands and monitoring them. Installing this Docker extension adds some helpful Docker tools, such as generating Docker files, Docker file IntelliSense, and even monitoring.

Command Line in VS Code

VS Code comes with an integrated command-line terminal. On Windows, this terminal shows up as the Command Prompt. On Mac and Linux, it shows up as a Bash prompt. Either way, the terminal starts off in the current project’s working directory if one is loaded, or from your home folder if no project is loaded.

The command line interface lets you control how you launch the editor. You can open files, install extensions, change the display languages, and output diagnostics through its options.

It also supports the ability to have multiple, separate terminals. Just click the + icon at the top right to spawn more terminal instances or click the trash can icon to close the current terminal.

Command Line in VS Code

Command Line in VS Code

Edit Multiple Lines Simultaneously

Just copying and pasting code is a bit old fashioned. In VS Code, you can edit multiple lines by adding cursors to different locations. This is very useful if you are going to use the same code on different lines. Instead of copying and pasting the code in all places, you can hold Alt and click to add a cursor in the places you want to type or edit the code. After adding cursors, edit the code to see the changes in the places where the cursors were added.

Editing Multiple Lines Simultaneously

Editing Multiple Lines Simultaneously

Exclude Folders

You can use the exclude folder option to remove unwanted folders like node_modules or others you don’t want to open in Visual Studio Code.

To exclude a folder, go to File > Preferences, and search for file.exclude in the search settings. You can add the pattern of the folder you don’t want Visual Studio Code to open.

Excluding Folder

Excluding Folder

Go to Definition

While programming or scripting, you’ll often run into a variable or method that you don’t recognize. You could spend several minutes searching for the right file, or you could hold Command (on Mac) or Ctrl (on Windows) and click the variable or method name. VS Code will then take you to its definition.

Or, you could just hold Command (on Mac) or Ctrl (on Windows) and hover the pointer over the variable or method to see an inline definition at the position of the cursor.

Inspecting a Variable in a Pop-up

Inspecting a Variable in a Pop-up

Conclusion

I hope you have enjoyed learning some new tricks in making effective use of Visual Studio Code. Know a trick in VS Code and feel it would be helpful for others? Share it as a comment below. We will add it in another blog.

Happy coding!


Related Articles

  • Visual Studio Code for Java: The Ultimate Guide 2019. 
Visual Studio Code code style

Published at DZone with permission of Hari Prasath. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • An Introduction to Type Safety in JavaScript With Prisma
  • Alexa Skill With Local DynamoDB
  • Alexa Skill With Python
  • Alexa Skill With Node.js

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!