Because of all the sub-directories my code typically lives in, whenever I do a Find In File for something, the code gets run off the screen because the results window has wasted so much valuable real estate by repeating the long file path for every object in my solution. More often than not, they are in the same parent directory, or I don't really care where there from.
Is there an option to shorten the path name to perhaps just the file?
Also, the Display File Names Only option in the Find in Files dialog does not do this, it only omits the code from the result.
You can change the VS search result formatting by changing the registry.
According to the article Customize how Find in Files results are displayed in the Find Results Window:
Open up RegEdit
Go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Find
Add a new string called Find result format with a value of $f$e($l,$c):$t\r\n
DANGER: This involves hacking the Registry so use this tip at your own risk!
Further, here's the syntax to use if you'd like to customize the string further:
Files
$p - path
$f - filename
$v - drive/unc share
$d - dir
$n - name
$e - .ext
Location
$l - line
$c - col
$x - end col if on first line, else end of first line
$L - span end line
$C - span end col
Text
$0 - matched text
$t - text of first line
$s - summary of hit
$T - text of spanned lines
Char
\n - newline
\s - space
\t - tab
\\ - slash
\$ - $
Things are different on Visual Studio 2017. You won't find the registry keys for Visual Studio 2017 anymore as Visual Studio 2017 now stores registry keys in a private binary file under %VsAppDataFolder%\privateregistry.bin.
However, according to 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 bar
Select File > Load Hive...
Load the privateregistry.bin file from %localappdata%\Microsoft\VisualStudio\15.0_[instanceid]{RootSuffix}\privateregistry.bin. The RootSuffix for a normal VS installation will be blank. This is mostly used for the experimental instance
Name the key whatever you want (e.g. "VS2017") when prompted
From there, you should be able to view the entries just like any normal registry.
Customise it according to accepted answer's suggestions.
Important! Once you're finished, you need to make sure that you "Unload" the private registry, by selecting the "root" key ("VS2017" in this example) and selecting File > Unload Hive . If you don't do this, VS won't be able to read the privateregistry.bin file when it runs, causing major problems.
Update:
It also works on Visual Studio 2019 (version 16.0) too.
There is an option you can select "Find results table".
Then you can do a Ctrl+ALL and copy the tab delimited results to a spreadsheet such as Excel. Then you can see only the code instead of file names.
Related
We are using Visual Studio (2017) in a project (one solution) with two different configuration types: DynamicLinkLibrary and Makefile. The Makefile configuration is controlled by the maekfile of a third party compiler (Greenhills for Embedded Applications), DynamicLinkLibrary of course runs Visual Studio internally. The Makefile configuration uses the elements of the Visual Studio NMake template, for the compiler call itself there are these command lines, in which a batch file is called with transfer parameters
$(ProjectDir)..\mm.bat PLL02#$(MSBuildProjectName) bin_comp 3 LIBYES 2 /F DIAGNO
mm.bat is the batch control with seven parameters for the Greenhills compiler.
In case of a compiler error in our source code, detected by the third-party compiler, we would now like to activate a comfortable ErrorParser, which loads the corresponding source code file by double-clicking on the erroneous line in the VisualStudio output window into the source code editor window of Visual Stuido and automatically places the cursor there on the erroneous line of code. If Eclipse is used as our second IDE for our Makefile project, this works very well via a Regex control ('Regex Error Parser'). However, this does not work in Visual Studio. Is it even possible to do this directly from the output window? Does anyone have any advice here? Roughly speaking, is it at all possible to trigger an action from the Visual Studio output window by double-clicking (in the sense that the clicked line is 'read' by the output window for further processing; the further processing should ultimately display the erroneous source code line).
Best Regards, Roger
P.S.
Here is shown, what I like to know:
Situation in error case
I don't believe that you can make VSS understand other formats than its own.
But there is another way that works.
Format the error output of your compiler into the VSS format and put it out in the output window off VSS.
The VSS Error format ist:
d:\MyProg\main\Sourcefiles\myModul\src\myFile.c(2426): error C2039:
Maybe you have a format like this from your compiler to change to the VSS format:
d:\/MyProg\main\Sourcefiles/myModul/src/myFile.c", line 2426: error #136:
struct "_Ts_braketest" has no field "braketest_stepx"
S_btest.braketest_stepx = 2520;
^
The stream editor sed does a good job for such a task.
For a simple way you can format step by step with a command file for sed.
command file socToVss.sed:
s,\\/,\\,g #replace \/ to \ (delimiter , to prevent escaping slash)
s,\/,\\,g #replace / to \ (delimiter , to prevent escaping slash)
s/\"//g #replace " to nothing
s/c,[[:space:]]line[[:space:]]/c(/g #formating line number
s/\(([0-9]*\):/\1):/g #formating line number
s/\(error[[:space:]]\)#\([0-9]*\)/\1C\2/g #formating error number
Example for your makefile to use the sed command file to format the errors from errors.txt to errorsVssFormat.txt and type ist out:
make 2> errors.txt
sed -f socToVss.sed errors.txt > errorsVssFormat.txt
type errorsVssFormat.txt
You can use the Open Source GNU utilities for Win32
[http://unxutils.sourceforge.net/]
Good luck with your job ;-)
I need to rename 80k files in multiple folders & subfolders in the same directory. I have been trying to use ren but have been unsuccessful; I get an incorrect syntax error.
My old name looks like this:
c:/users/alice/BiDIR_DOCS_2017_Nov08020423\Company,LLC##NA##7967425.00##7967425.00\Company LLC A and A - Aug2017.pdf BiDIR_DOCS_2017_Nov08020423\Company, LLC##NA##7967425.00##7967425.00\document_# (x.y.z)-test~.pdf
and my new name looks like this:
c:/users/alice/BiDIR_DOCS_2017_Nov08020423\Company,LLC##NA##7967425.00##7967425.00\Company LLC A and A - Aug2017.pdf BiDIR_DOCS_2017_Nov08020423\Company, LLC##NA##7967425.00##7967425.00\system, a old name~ ` to # system b document (xyz)-test.pdf
I have the existing directory print in one column of Excel and in the next column what I want the directory print to be.
I'm not sure if I'm starting my ren command at the right hierarchy of my directory, or if I need quotation marks to keep the spaces and symbols in my new name.
I have tried improvising and testing on my own without success and I cannot find an article online on point.
Try FAR (find and replace) - it a free utility that works well.
http://findandreplace.sourceforge.net/
I know that using ctrl+shift+f we can find the text in folder we want and simple ctrl+f will find the text in a opened file or we can right folder and click on a option Find in Folder... to search the text
I am looking for, how can I find the file in a Folder/Project.
You can use the Goto Anything feature (Ctrl+P on Windows and Linux, Cmd+P on macOS) and type the name of the file you're looking for. If there are multiple hits, you can select the appropriate file using cursor keys. It also supports powerful operators, that let you jump to specific parts inside a file.
Examples:
file.js opens that file
:100 jumps to line 100 in current file
file.js:100 jumps to line 100 in file.js
#loadFile lists all files with classes/functions named loadFile (shortcut: Ctrl+R, Cmd+R on macOS)
file.js#loadFile jumps to a loadFile() in file.js
This can be done using:
Windows: Ctrl + P
Mac: Cmd + P
It works much like ItelliJ's Shift - 2 times, with a faster and accurate prediction.
I've got a few old sourcesafe repositories which I want to delete. Before deleting them, I want to get the latest version of all code out recursively and then archive this code.
Various projects within the repositories have "working code" folders set which means that when I recursively get everything, code goes everywhere.
I'm trying to find a way to clear all working folders from a repository.
I've tried:
googling
looking through Tools->Options
looking at the "set working folder" dialog
looking at the "get multiple" dialog (but not closely enough - see answer below)
looking into the behind-the-scenes file structures for anything obvious I could nuke
Alternatively, if there's a way of backing the code of the repository up which frees it from requiring sourcesafe to view, that would also be good.
<Edit>Although the below actually does what I stated I wanted, there is an easier way to accomplish getting the latest version of code in the structure it appears in in the repository, which is to tick the "Build Tree (override working folders)" in the "Get Multiple" dialog.</Edit>
OK, worked it out. In the sourcesafe file structure, there is a folder called "users", within this will be your windows username, within this will be a ss.ini file.
Editing ss.ini to remove any entries which are in square brackets (and the text immediately under these sections) got rid of all working folder information for me. Note: It may also have lost some other information, but this is of no concern to me as I need only to get the latest version of code.
Example extract of file:
... more file above here ...
Preview_Rect (TQPC0137) = 321, 215, 703, 524, 1024, 768
Viewer_Font (TQPC0222) = Courier, 10, 400,, 0
Dft_Report_Type = 2
PrjFilesRpt_IncFiles = Yes
PrjFilesRpt_NamesOnly = No
... remove these sections below ...
[$/TQ/LRI/DataCaptureTest]
Dir (PC0137) = C:\PROJECT\DATACAPTURETEST
[$/AutoReference]
Dir (PC0137) = G:\WORKING CODE VBNET\TEST
[$/]
Dir (PC0222) = C:\WORKING CODE
Dir (PC0204) = G:\WORKING CODE VBNET\BOB
Dir (PC0118) = G:\WORKING CODE VBNET\BOB
Dir (PC0137) = G:\WORKING CODE VBNET\BOB
Dir (PC0168) = G:\WORKING CODE VBNET\BOB
... more file after this (but, in my instances, all the same type of stuff ...
I read through the docs and used the commands outlined however for some reason I dont seem to be getting any symbols, just a series of "unknowns" in the function column of the summary table for everything except the topmost set of the app I was trying to debug.... I set the enviromental variable to the microsoft server and the direcories containg the pdb's for the app. I also made sure to select the "Load Symbols" item before bringing up the summary table.
Arcording to the info I was reading it should take some time for the tabl to display while it loads the symbols, however for me the table displayed almost instantly and only the top most items in sprite.exe->sprite.exe had function names, the othe rows for function were either blank or "unknown"
Im using Vista SP1.
This is the batch file I used. Did I do anything that would prevent the sybols being loaded?
REM start profiler
xperf -on PROC_THREAD+LOADER+INTERRUPT+DPC+PROFILE^
-stackwalk profile -minbuffers 16 -maxbuffers 1024 -flushtimer 0^
-f tmp.etl
REM run the app we want to profile
sprite.exe
REM stop
xperf -d profile.etl
REM set symbol path
set _NT_SYMBOL_PATH = ^
C:\Projects\C++\fl lib\bin;^ REM dlls
C:\Projects\C++\fl lib\samples\bin;^ REM main exe
SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
REM display profile
xperf profile.etl
What version of dbghelp.dll is it using? I've had trouble getting PDB symbols working with kernrate and other utilities when using the version of dbghelp.dll that is installed in %SystemRoot%\system32.
You may need to copy dbghelp.dll and symsrv.dll from a recent version of Debugging Tools for Windows into a directory where XPerf can find it.
Also, you need to remove the space before the '=', or else you're defining the "_NT_SYMBOL_PATH " variable (including the trailing space in the name).
Including comments at the end of a line is not going to work either. A line continuation character such as '^' typically needs to be the last character on the line. When I ran that statement (on XP), I ended up with "_NT_SYMBOL_PATH " equal to " C:\Projects\C++\fl lib\bin; REM dlls" and an error about the next line.
Try setting the
TRACE_FORMAT_SEARCH_PATH
environment variable. If that doesn't work, you may have to manually extract the TMF files from your PDBs using TracePdb.exe (or at least use a regular path instead of a SYM* path). This is by far the most annoying part of using ETL traces / XPerf