Productivity: shortcuts, snippets, refactoring

Hands on the keyboard

The fastest return on investment in learning an IDE comes from shortcuts and safe refactorings. The mouse slows you down; after a few days of deliberate shortcut use you write noticeably faster and tire less.

Shortcuts worth knowing off the bat

ActionVisual StudioVS Code
Quick file searchCtrl+,Ctrl+P
Command paletteCtrl+QCtrl+Shift+P
Go to definitionF12F12
Find all referencesShift+F12Shift+F12
RenameCtrl+R, RF2
Multi-cursorAlt+clickAlt+click
Select next occurrenceCtrl+D
Move line up/downAlt+↑/↓Alt+↑/↓
CommentCtrl+K, CCtrl+/

Tip: Don't learn them all at once. Pick 3 shortcuts a week and use them deliberately until they become a habit. After a month you'll have a dozen or so "in your fingers".

Snippets — stop retyping templates

Snippets expand a shortcut into a ready-made block of code. VS Code lets you add your own in a user file (palette → Snippets: Configure Snippets):

{
  "React component": {
    "prefix": "rfc",
    "body": [
      "export default function ${1:Component}() {",
      "  return (",
      "    <div>$0</div>",
      "  );",
      "}"
    ],
    "description": "Funkcyjny komponent React"
  }
}

Typing rfc and Tab generates the whole component, and $1/$0 are the spots you jump between with Tab. In Visual Studio, Code Snippets work the same way (e.g. prop + Tab + Tab for a C# property).

Refactoring — safe changes

IDE refactoring is safer than "find and replace" because it works at the symbol level, not the text level.

  • Rename (F2 / Ctrl+R,R) — renames a variable/method across all usages, including in other files. It won't accidentally touch a similar string inside a string literal.
  • Extract Method / Function — select a fragment and extract it into a separate method. The IDE figures out the parameters itself.
  • Quick Fix (Ctrl+. ) — the lightbulb suggests importing a missing type, removing an unused variable, adding await, and so on.
// Select these two lines -> Ctrl+. -> Extract Method
var net = price / 1.23m;
var rounded = Math.Round(net, 2);

Code navigation

F12 (Go to Definition) and Shift+F12 (Find All References) are the basics of reading someone else's code. Go to Symbol (Ctrl+T in VS Code) jumps to any class or function in the project by name.

Summary

Three pillars of pace: shortcuts (hands on the keyboard), snippets (zero retyping of templates) and IDE refactorings (safe, symbol-level changes). Adopt them gradually, and after a month you'll work noticeably faster.