Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count found strings in Visual Studio Code

When you search for a string in Visual Studio Code with Ctrl-F it doesn't display number of occurrences.

Is it possible to find out somehow?

On the other hand it displays a number of hits next to a filename when you search all files with Ctrl-Shift-F.

like image 218
Miloš Stanić Avatar asked Feb 20 '16 10:02

Miloš Stanić


People also ask

How do you count code lines in Visual Studio code?

Press F1 to open Command Pallete. Search for Vscode counter : count lines in directory. Select the directory for which you want to count. Press enter and you have all the statistics.

How do you find all occurrences of a word in VS Code?

Ctrl+D selects the word at the cursor, or the next occurrence of the current selection. Tip: You can also add more cursors with Ctrl+Shift+L, which will add a selection at each occurrence of the current selected text.

How do I grep code in Visual Studio?

VS Code allows you to quickly search over all files in the currently-opened folder. Press Ctrl+Shift+F and enter in your search term.


1 Answers

I had the same problem as csonuryilmaz mentioned in the comment to this answer, I needed the exact count of the string, even if it is 19999+. I ended up opening the file in Notepad++, there you can count all occurences when searching for a string.

Maybe not the best solution if you want/have to use only Visual Studio Code, but for my problem this was a good enough workaround.

like image 186
RedJohn Avatar answered Oct 06 '22 09:10

RedJohn