Vscode Tips

4 years ago vscode

Range Finder in VS Code

Visual Studio Code’s "Find in Selection" feature allows you to limit searches or replacements to a specific part of your document. To use this, highlight the text range you want, open the search bar, and select the Find in Selection button.

Find in selection

While this feature might not feel essential for simple searches, it becomes incredibly useful for replacing text within a specific range. By narrowing the scope, you can make precise replacements without affecting the entire document.

One limitation is that VS Code doesn’t visually indicate the selected search range by default, which can be disorienting. To add a clear background highlight for your selection range, adjust your settings with the following code:

"editor.findRangeHighlightBackground": "#ffffff18"

This adds a subtle white background with high transparency to the selected range. Adjust the colour to match your theme for better visibility.

Other Posts