Visual Studio - Find in File - Display matching strings - visual-studio

Using Visual Studio 2012.
Trying to use Find in Files to find all strings in code matching a certain string.
E.g. searching for "usp_", matches would include "usp_blah", "usp_test".
Rather than displaying files wherein the matching strings occur in the Find Window 1, I want to see a list of the matching strings
Thanks

The results will show both the file and the line of code that matched
if there are multiple matches in one file there will be a line for each
filname1 ----- line 20 of code with the match line of code
filname2 ----- line 50 of code with the match line of code
i know you said you don't want a list of the files in the find window and i may be pointing out something you already know but figured i would just point that out incase you didn't see it.
i generally pull the find result out and full screen it when i am trying to review the results

Related

Is there a way of sorting indented, multi-line content alphabetically in Visual Studio Code (VSCode)?

I have a very long script that contains a huge list of brand names that is not in alphabetical order. The result of many different people working on it over a few years :) Question - is there a way to re-order lines of code alphabetically in Visual Studio Code (VSCode)? I know this is possible for single lines of code, but is it possible for multi-line blocks of code that have been indented? See attached example - so in this case I would be looking to select all these lines of code and sort by the brand name (acer, acqua, aeg, amazon etc) and retain the nested parts of the code for each. Many thanks in advance if anyone has any ideas or suggestions
Screenshot of code to be sorted
I tried sorting in VSCode, but it only sorts individual lines of code and mixes them together. It does not recognize multiline, nested blocks of code as being one group of code that can be sorted individually
[Assuming you have a json object or could your text into one. Looks very close already - if it isn't json you might consider making a separate file and make it json, so you can use a sorter.]
I see a number of json sorters in the Marketplace: just search for json sort.
This one has 280K+ downloads: Sort JSON Objects
And I see a couple more. There is no built-in way to do what you want, you will need an extension.
I would:
Replace new line + 3x - \n\t\t\t - with an empty string
Sort
Format document (you may need to Change Language Mode first)

Find files of a certain format in Windows Explorer

Wish to load these files using windows explorer:
201809.xlsx
201701.xlsx
201812.xlsx
Exclude others not matching the above format, such as files like:
201809a.xlsx
201809b.xlsx
201812.csv
Basically, recognize anything that's six numbers in a row without any additional characters and ending in .xlsx
The following works in this case
20????.xlsx

Script to remove parts of a filename

I am looking for a way to remove parts of my file names (big folder). I don't want to rename them all but I merely want to have an output of the edited file names in a text document or clipboard.
They all follow the similar pattern. The initial part of my file names are randomized by the system. I am not sure how to proceed in terms of what to use to complete the first part. Here is an example filename:
1231230#p9999_w_e_aa.jpg
I want to extract 9999 part (the part between the #p and the first underscore).
The machine I'm currently working from is running Windows 7.

Using Visual Studio's 'Find', is it possible to exclude specific files from the search?

Let's say i refactored some code in my huge solution, now i want to be sure that there are no occurencies of my old code (including specific words in strings and so one).
Problem is, that i have a huge, automatically built file (imagine something like a 'compiled' app.js), which is allowed to contain string values of my old code.
With the 'Find' functionallity of Visual Studio, is it possible to skip this specific file?
One possible way I could think off is Look at these file types field present in Find and Replace (Shortcut: Ctrl + Shift + F).
You could specify the file types with extensions or/and names. You could use multiple names separated by a semicolon.
Ex: Say you want to search in all XAML files & all CS files starting with A. You would enter this in the Look at these file types field: *.xaml;A*.cs
If you simply want to ensure that your only matches are in that one file, you can check "Display file names only" option in "Find in Files", and verify that there is only that file name in the result pane.

Visual Studio Replace in Files Searches Skipped Matches After Each Replace

In VS Find and Replace > Replace in Files seems to repeatedly search skipped matches before finding new matches.
Perform a Find and Replace in multiple files: File_1, File_2 and File_3
Skip one of the matches on File_1 and proceed to the next file with Find Next
Make some replacements on the next file, File_2, using Replace
After the final replacement on File_2, the Find Next match goes back to previously searched files, File_1 in this case, before going on to matches in File_3
I end up skipping through more and more previously searched files and skipped matches, just to find new matches. The Skip File option doesn't seem to help.
Is there a way to make Find/Replace search all un-searched files before looping back to the previously searched files?
I'm using VS 2012 but I seem to remember the same behavior in 2010.
Update: this is a bug. Please vote for a fix on this Visual Studio UserVoice suggestion.
I never noticed that. You can do a Find in Files, Find All. That way you have a list of all instances and can work your way down the list. Double-click the first one, press Ctrl-H, and replace or skip all matches in that file. Go back to your list and click the first match in the next file.
It will be harder to lose your place this way, but it is still tedious if you have a lot of files/matches to go through.
VS 2013 has the same behavior, in case you were curious. Sorry I don't have a better answer.

Resources