How to Increase Productivity with VS Code

in utopian-io •  7 years ago  (edited)

What Will I Learn?

You will learn Increasing Your Productivity with VS Code

Requirements

Visual Studio Code https://code.visualstudio.com

Difficulty

Intermediate

Tutorial Contents

  1. Using shortcuts
  2. Using NuGet
  3. Don't start your project with Debugging
  4. Using the Clipboard Ring
  5. Using a color scheme
  6. Renaming from Smart Tag
  7. Formatting your code
  8. How to Use Intellisense Completion Mode
  9. How to Improve your 'Publish Website' process
  10. How Use Visual Studio Steroids
  11. Using a Commercial Productivity Tool
  12. Using Versioning and Source Control

Increasing your productivity with Visual Studio Code

Visual Studio is the program that most of the times a .NET developer is working with. This tutorial contains a few tricks and plugins for VS Code that are out there and whose sole purpose is to improve everyday tasks and provide a slicker development experience.  

Using shortcuts

VS is an all-in-one tool. You can develop apps for many different platforms and frameworks. A lot of functionality has been added over the years, so navigating from one feature to another can be time-consuming. Spend some time to learn as many VS shortcuts as you can by going to Tools - Options - Keyboard.

Using NuGet

When we are talking about productivity, managing the external dependencies of a project (installing, updating and removing dlls, script files etc.) can be time consuming. NuGet does an excellent job on saving you tons of time. It also encourages you by browsing the gallery to find libraries that will save you even more time. So, start using it without second thoughts!

Although NuGet has a UI that helps you manage your packages I suggest you to try the console interface. Fast, right to the point and might bring back memories! You can even host your own private NuGet feed via MyGet with your own packages plus the packages from the original feed.

Tip: Press TAB while typing to enable auto-complete

 NOTE

Visual Studio has the option to save and export all of your settings including those that are theme-related by going to Tools -> Import/Export Settings... Before you change your theme save your current settings just in case!

Don't start your project with Debugging

Hitting F5 is a very common task for a developer. Half of those times when you run a project you don't want to debug it, you just need to take a better feeling of what you have developed, or even check out UI changes. Try instead of hitting F5 to press Ctrl + F5 and start your project without debugging. This can vastly reduce the start-up time from 5 to [a lot of] seconds.

Using a shortcut for Build Action

Although this is pretty trivial and probably you already doing that, I am mentioning it nevertheless, because it feels really important. Use F6 or Ctrl + Shift + B to build your project. My personal preference is the second one.

How to Use the Clipboard Ring

Visual Studio has a hidden gem that is called Clipboard ring. You can copy from many different areas of your project (by pressing Ctrl + C) and then you can loop through your copied items by pressing both Ctrl + Shift and tapping V. Every time you press V you see a previous copied entry.

How to Use a color scheme

When a developer spends 8 or more hours every day looking at the screen of VS, it's essential to feel comfortable against the UI. Not everyone agrees that a white background is what's best for the eyes. Changing the default look and feel of VS might be tricky, due to the many options available. Luckily you can choose to apply a preconfigured theme that better fits your needs from StudioStyles.  

A Visual Studio black color theme

 

Renaming from Smart Tag

Smart Tag is a little line that appears when an action is available for that particular piece of code. An action like generating a property that doesn't exists or performing a rename. To activate Smart Tag and see the available actions hit Ctrl + .(dot) . Never do a rename of a class/property/field manually. It's a huuuuuge waste of time. Not all the times VS renaming is perfect but 99.9% of them is a better way that finding references and renaming them using Find and Replace.

How Smart Tag looks like

 

How renaming using a Smart Tag looks like

Renaming in Generated files

Note: If you want to rename a property in a generated code file (like the one Entity Framework is creating when you are using Model-First or Database-First approach) do the following:

  • Open the generated file
  • Rename your target using the Smart Tag.
  • Perform the rename to the file that generated the code file. (This is the *.Edmx in case of the EF)

The code file will then get regenerated with the correct info and if all goes well no compile errors should be met!

Formatting your code

Intending your code especially when you are writing an XML-like language can also be time-consuming. No worries though, there is a shortcut for this: Ctrl + K, Ctrl + D. This shortcut intents your code so that is readable. You can change the format options by going to Tools ( Options ( Text Editor, then choose one of the available languages and go to Formatting. If you are in a team make sure everyone has the same settings otherwise this could get messy.

Using Intellisense Completion Mode

I mostly sure that the naming is correct, but I am certain that if you are doing TDD this could be very useful. By pressing Ctrl + Alt + Space you can toggle whether Intellisense will also autocomplete your word or just display the possible matches without messing with what you are typing. When Completion Mode is off Intellisense is still functional but the first result is not selected and you have to select it manually.

Useful when you are writing Unit Tests about classes, methods or fields that don't exist yet.

NOTE

If you are using a VS add-on it's possible that you need to re-assign that shortcut.

Improving your 'Publish Website' process

If you are using VS for Web Development, then it's essential to assign a shortcut for publishing.

Ctrl + D, Ctrl + F is a handy shortcut, not being used by another task and can be executed single-handed.

Publishing your website can be done either using Web Deploy or using FTP. There are certainly other ways but those are the most popular ones. Web Deploy is faster than FTP and should come first in an ordered by preference list.

Assuming the only option is FTP, then the fastest way to publish your site is by using the "File System" option in the publish window. This option publishes your site to your local disk. Then you can use an external FTP client like Filezilla to upload your files and specifically only those that have changed. Using the FTP option within VS is most of the times reaaaaally slow.  

Available options for publishing your website.

 

Using Visual Studio Steroids

Visual Studio Productivity Power Tools

Visual studio is a great tool but the VS team from Microsoft created a plugin to make it even better. It's called VS Productivity Power Tools and is a must for every developer.

My favorite feature (from a long list): Searchable Add Reference Dialog

 

Visual Studio PowerCommands

Another great plugin (also by Microsoft) is called PowerCommands. This is a set of useful extensions for the Visual Studio adding additional functionality to various areas of the IDE.

Favorite Feature: Open Containing Folder

 

Using a Commercial Productivity Tool

The steroids above are completely free! There are also tools that aren't free and if used properly can massively increase your productivity. I am not here to support one over the other just to let you know that are out there.

A commercial tool doesn't do anything that you can't do manually. It does though automate tasks to help you save time. Ex: When you renaming a class you can also rename the file where the class exists to match the new name.

They do have a performance impact on VS - minor of big is up to you to decide. If your dev environment isn't equipped properly you might ran into some issues.

Some of the most well-known commercial tools are: ReSharper (JetBrains), CodeRush (DevExpress), JustCode (Telerik)

Using Versioning and Source Control

This is not VS specific but it's essential. When a developer writes hundreds of lines of code every day it's statistically impossible for all those lines to be error free. That means the developer needs to perform a lot of changes. The most common technic is to copy the code, paste it below and comment it to keep a backup in case the change doesn't go that well.

This is not the most efficient way of changing things and that's where versioning through a Source Control system is important. Team Foundation Server and SVN are probably the most well-known Source Control Systems but lately I find myself to prefer Distributed Version Control Systems like Git or Mercurial. The reason for that is that I don't have to setup a server somewhere. Instead I get free hosting from the websites above. Certainly a worth looking option for individual developers and small teams.

NOTE

All have VS Extensions so that you can do commits, rollbacks etc. right from within Visual Studio



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Like your contribution, upvote.

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @alv I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

F2 = rename
F3 = find