Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Stop Using Find-and-Replace to Rename Variables

May 26, 2026

We've all been there: you want to rename a variable, so you hit "Ctrl+F" (or "Cmd+F"), type the old name, and replace it across the file. But then you accidentally rename a completely unrelated variable, or worse, a string literal that just happened to contain the same characters. In VS Code, simply put your cursor on the variable and hit "F2".

This triggers the "Rename Symbol" feature. It understands the abstract syntax tree of your code, meaning it will only rename actual references to that specific variable, function, or class, leaving identical-looking strings and comments completely untouched. It's safer, faster, and even works across multiple files in your workspace.