- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When using shift-control-f to search an entire solution, is it possible to ignore comments?
Also, where is shift-control-f located on the pull down menu of Visual Studio 2012?
Thanks,
Brian
Brevard, NC
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Edit > Find and Replace > Find in Files is the menu item. I am not sure if it's possible to exclude comments, but you can search for references or definitions of identifiers if the advanced text editor features are enabled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply, Steve.
My VS 2012 doesn't have a Find and Replace item anywhere I could find on the Edit menu. It has Find Symbol (Alt-F12), Quick Find (Ctrl+F) and Quick Replace (Ctrl+H).
How do I know whether or not I have "advanced text editor features" enabled? I tried the Alt-F12 command, but trying this with a known variable name didn't seem to do anything.
Thanks,
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see Edit > Find and Replace in my VS2012. This is a standard VS feature.
The advanced features need to be enabled under Tools > Options > Text Editor > Fortran > Advanced. Set all values to True except for "Disable Database".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My VS 2012 is version 11.0.50527.1 RTMREL
I sure can't find Find and Replace, but since shift-ctrl-F works, that's not a problem.
Thanks for the tip about turning on the Advanced editor features. That looks like it will be very helpful to me. However, the option for Highlight Matching Tokens doesn't seem to do what it says it's supposed to do. Bummer.
Anyhow, the main thing I was after was to do a find that skips comments. It sure would be a great feature to add. The editor already does color highlighting for commented text, so it already knows what is or isn't a comment.
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is that MS doesn't give us hooks into Find and Replace. Maybe someone can come up with a Regular Expression that does what you want - I am not enough of a regexp expert to be able to do this.
Might it be that VS12 isn't showing you the full menus? I know that some MS tools did that for a while, trying to be "helpful".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have always used the following construct to find things that are not commented:
Wildcard search expression = ^[^C!][^!]+{expression}
I use this a lot looking for WRITE statements which are often debugging statements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the regular expression suggestion. I gave it a try, but it doesn't quite do what I'm looking for. I actually can't tell exactly what it is doing, but it's not finding the lines I want.
For example, to find all lines containing a variable named EIVEC I used ^[^C!][^!]EIVEC but this only returned a small subset of the correct group of lines.
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I have some trouble with this some of the time. If you can be assured that the commented "EIVEC" lines start with a comment statement, you could use
^[^C!].+EIVEC
and ask it to search for whole words with regular expressions. This works for me because I uniformly comment my "WRITE" lines at the beginning of the line. Unfortunately I am guessing this is not the case with yours.
My only other suggestion is a better editor. My personal choice is SlickEdit.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page