Saturday, October 22, 2016

Some of the important shortcuts for Visual Studio Code

Visual studio code is a Great editor for the web development. I have started using it and I’m loving it more and more. For any editor shortcut keys are important you can do lots more without moving to mouse with a shortcut. In this blog post, we are going to learn about shortcuts for Visual Studio Code.

Ctrl + P:  Goto File, You can move to any file of open solution/folder in Visual Studio code.
Ctrl + Shift + O : Goto Symbol, You can move to any function, variable or symbol of the current file.
F12 : Goto Definition – You can move to the definition of symbol or function with this command
Ctrl + G : Goto line, You can move to particular line number
Alt + Left: Navigate  between files goes to the left side of files
Alt+ Right: Navigate between files goes to the right side of files
Alt + F12: Peek definition, You can see preview of code for a function
Ctrl + Shift + D: Debug folder or file.
Ctrl + Shift + F: Search in all files.
Ctrl + Shift + H: Replace in all the files
Ctrl + T: Go to symbol in all files
Ctrl + B : Toggle Slider Bar
Ctrl + 1: Focus Left Editor
Ctrl+ 2: Focus Right Editor
F2: Rename symbol and function
Ctrl + Shift + X : Goto Extension Window
Ctrl + J: Toggle Panels
Ctrl + ` : Open terminal in VSCode
Ctrl + Shift + U: Show output Window
Ctrl + Shift + M : Show problems, Where you can see all the problems related to code and warnings.

You can find all the shortcuts of Visual Studio code from the following link.
https://code.visualstudio.com/docs/customization/keybindings

That’s it. Hope you like it. Stay tuned for more!!
Share:

Opening ASP.NET Core Visual studio solution in Visual Studio code

In this blog post, We are going to see how we can open an ASP.NET Core solution in visual studio code.  So what we are waiting for. First, we are going to create an ASP.NET Core web application like below.

ASPNETCoreApplication

Then select web application like below.

ASPNETCoreWebApplication

Now once you created Ok it will create an ASP.NET Core Web Application like below.

SolutionExplorer

Now let’s run that application to make sure that its work fine.

edgeASPNETCoreApplication

Open ASP.NET Core Solution in Visual Studio Code:

For those who don’t know What is Visual Studio code is here is the definition from the Wikipedia.

Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring
It is a cross-platform open source editor for writing code from Microsoft. You can find more information about that from the following links.

https://en.wikipedia.org/wiki/Visual_Studio_Code
https://code.visualstudio.com/

Now we are going to see how we can open the same application with Visual Studio code. But before doing that we need to make sure that the computer have .NET Core installed on your machine and Also make sure that Visual Studio Code C# support is there in Visual Studio code. You can find more about that from the following link.

https://code.visualstudio.com/Docs/languages/csharp
https://code.visualstudio.com/docs/runtimes/dotnet

Since Visual Studio Code is not a full fledge IDE(Integrated Development Environment) like Visual Studio. We need to open the folder which contains the solution and source code. You can do that from Visual Studio Code.

OpenFolderInVisualStudioCode

Then select the src folder of your application like below.

SRCFolderApplicationinVisualStudioCode

Once you click on “Select Folder” it will open source code like below.

SourceCodeInVisualStudioCode


Now when you open any CSharp file on the right bottom you will see a text like installing OmniSharp.  OmniSharp is a set of tooling and editor integrations and Libraries that together creates great IntelliSense and  other tooling support for popular editors like Code, Sublime Text, Brackets, Atom,Emacs and Vim etc. You can find more information about that on the following link.

http://www.omnisharp.net/

Once you click on that text you can also see the progress of installation of Omnisharp libraries in output windows like below.

OmniSharpOutputWindowVisualStudioCode

Once it installed it will automatically select the project which you have in solution. If you have multiple projects then you can click on that and it will ask you to select the project for which you need all IntelliSense .

SelectApplicationInVisualStudioCode

That’s it. Now you have most of the experience that you got in Full Visual Studio and full fledge IntelliSense to all the .NET Features.

VisualStudioCodeExperience

Disclaimer: I have tested it on the windows machine and its works perfectly fine. For macOS and Linux I would expect the same. For further information, you can follow a GitHub Issue which is already created by the community. You can find that GitHub issue at the following link.

https://github.com/OmniSharp/omnisharp-vscode/issues/283

That’s it. It’s very easy to use light weight Visual Studio Code for same development experience like Full Fledge Visual Studio.
Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews