Shorten Filepath Name search results

Because of all the subdirectories in which my code usually lives, whenever I do something in Find In File, the code is launched from the screen because the results window lost so many valuable real estate objects, repeating the long file path for each object in my decision. Most often they are in the same parent directory, or I don’t care where they are.

Is it possible to shorten the path name to possibly just a file?

Unnecessarily long

In addition, the Display File Names Only option in the Find in Files dialog box does not do this, it only omits the code from the result.

Find in Files Dialog

+11
source share
3 answers

You can change the formatting of VS search results by changing the registry.

According to the article " Configuring the display of search results in files in the search results window" :

  1. Open RegEdit
  2. Go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Find
  3. Add a new line called Find result format with the value $f$e($l,$c):$t\r\n

DANGER : This includes hacking the registry, so use this advice at your own risk!

Further, the syntax is used here if you want to further customize the line:

files

  • $p is the way
  • $f - file name
  • $v - disk / unc share
  • $d - dir
  • $n - name
  • $e -.ext

Location

  • $l - line
  • $c - col
  • $x - the end of the column, if in the first row, otherwise the end of the first row
  • $L - end of line
  • $C - end of range range

Text

  • $0 - matched text
  • $t - text of the first line
  • $s - hit summary
  • $T - the text of the stretched lines

char

  • \n - line feed
  • \s - space
  • \t - tab
  • \\ - slash
  • \$ - $
+9
source

In Visual Studio 2017, everything is different. You will no longer find the registry keys for Visual Studio 2017, because Visual Studio 2017 now stores the %VsAppDataFolder%\privateregistry.bin registry in a private binary file in the %VsAppDataFolder%\privateregistry.bin .

However, from this link , there is still a way to find and modify registry keys for Visual Studio 2017.

  • Close Visual Studio 2017
  • Open regedit
  • Select HKEY_LOCAL_MACHINE from the left pane.
  • Choose File> Download Hive ...
  • Download the privateregistry.bin file from %localappdata%\Microsoft\VisualStudio\15.0_[instanceid]{RootSuffix}\privateregistry.bin . RootSuffix for a typical VS installation will be empty. This is mainly used for an experimental example.
  • Name the key as you want (for example, "VS2017") when prompted
  • From there, you can view the entries, as in any other ordinary registry.
  • Configure it according to the accepted answer suggestions.
  • Important! When you are done, you need to make sure that you have “unloaded” the private registry by selecting the “root” key (in this example, “VS2017”) and choosing “File”> “Unload Hive”. If you do not, VS will not be able to read the privateregistry.bin file with privateregistry.bin , which will cause serious problems.

Update: this also works on Visual Studio 2019 (version 16.0) too.

+5
source

There is an option that you can select "Find Results Table". You can then do Ctrl + ALL and copy tab delimited results to a spreadsheet such as Excel. Then you can only see the code instead of the file names.

enter image description here

+1
source

Source: https://habr.com/ru/post/946276/


All Articles