Monday, January 18, 2010

Searching open documents in Visual Studio

Every now and again, I forget not to use an option that is fundamentally broken in a program. For example, just now, I decided to search 'Open Documents' in VS2008. I have two issues with this option. The first is that if I select it, all of the files that I have open are brought to the foreground as it searches, which both must slow things down a lot ( as surely rendering a screen of text is more work than scanning it for a word ) and leaves me with my documents all out of order from when I started. The second issue is, I just did a search for something that I knew was in an open document and no-where else. The find box, when I stopped the search, contained 10 matches. All the same line of code in the same file. I have 10 documents open, so I expect that means that it found the same match once for every document that it looked at, including the 9 that did not contain this text. One way or another, searching inside open documents only using visual studio is useless, and fundamentally broken. Who turned this code in ? Did someone write a use case that said this was what was supposed to happen ? I mean, I guess anything is possible....

1 comment:

  1. Hi Christian,

    1.
    I had never used "search in open documents", so I tried it now on Visual Studio C# 2008 Express Edition, and it seems to work OK: it does not move or otherwise change the display of documents, and reports as it should.

    2.
    But then I don't think "search in open documents" makes much sense; I want to be sure I see all occurences in either a project or, more often, a solution. I don't want my observations to depend on what happens to be open, as that may lead to wrong conclusions, and is after all not very repeatable/scriptable.

    Cheers

    ReplyDelete