Monthly Archives

2 Articles

Visual Studio Tips

Quick Goto Definition F12 alternative in VSCode

Posted by matteskolin on

These shortcuts require the vim extension is enabled

On my laptop keyboard, stretching my fingers up to the f12 key is a pain. These keys are smaller than the rest of the keys, and are confusing in that in additional to application commands, they also control monitor brightness, sound volume, etc.

In VS Code

gd will also “Go To Definition” just like F12.

Control + O can bring you back to where you were before jumping to definition. This to me is an easier key combination than the VSCode back and forward navigation via Alt + Left Arrow/Right Arrow

Visual Studio Tips

Example settings.json for VS Code

Posted by matteskolin on

Microsoft Documentation on VS Code Settings Here

I thought It would be fun to share my settings.json file. The number of available settings in VS Code is truly staggering. In the documentation above, the default settings example is near three thousand lines long!

On Windows, the settings file is located here:
%APPDATA%\Code\User\settings.json

And on my machine specifically,
C:\Users\matte\AppData\Roaming\Code\User\settings.json

I also save this in my Microsoft OneDrive as a backup and a way for me to quickly setup on new machines.

These settings control many aspects of the IDE as well as extensions.

Below is the settings.json file that I use with comments.

{
    //extension[background] - disables background image
    "background.enabled": false,

    //shows tool bar on left side of screen with buttons for Tests, Solution Explorer, Extensions, Debug, etc.
    "workbench.activityBar.visible": true,

    //default zoom
    "window.zoomLevel": 1.5,

    //very important if you are a vim user. Taking back control of specific control keys as vim takes over many of them
    "vim.handleKeys":{
      "<C-k>":false,
      "<C-a>":false,
      "<C-t>":false,
      "<C-f>":false,
      "<C-c>":false,
      "<C-v>":false,
      "<C-x>":false,
      "<C-y>":false,
      "<C-h>":false,
      "<C-d>":false,
      "<C-b>":false
    },

    //my favorite key binding in vim - this will allow you to type "jk" to exist insert mode, instead of awkwardly reaching for escape key
    "vim.insertModeKeyBindings": [
    {
      "before": ["j", "k"],
      "after": ["<Esc>"]
    }
  ],
  "mssql.connections": [
    {
      "server": "DESKTOP-3CUUUOC",
      "database": "",
      "authenticationType": "Integrated",
      "profileName": "LOCAL_INSTANCE",
      "password": ""
    }
  ],

  //nice setting to hide the wierd code map that is often useless and hard to read
  "editor.minimap.enabled": false,

  "editor.showFoldingControls": "mouseover",
  "editor.folding": true,
  "editor.foldingStrategy": "auto",

  //unbelievable helpful fix for moving mouse through folds
  "vim.foldfix":true, 

  //hide preview
  "workbench.editor.enablePreview": false,
  "[csharp]": {
    "editor.defaultFormatter": "ms-dotnettools.csharp"
  },
  "vssolution.xmlClosingTagSpace": false
}