Search code examples
visual-studioideincremental-search

Search hidden text with incremental search


In Visual Stuido 2005 (C# .NET), is it possible to search through hidden text with the incremental search (Ctrl+I)? In the Find an Replace window I have the checkbox "Search hidden text" checked. But that doesn't seam to apply to the incremental search.


Solution

  • This isn't the behaviour in VS2010 - searching for hidden text uncollapses regions automatically, so you might consider an upgrade :).

    In any case, why not use the shortcut Ctrl-M, Ctrl-L which "Toggles all previously marked hidden text sections between hidden and display states" before and after you use incremental search?

    To be able to do this in one keystroke, create a macro (From Tools->Macros) with the following code:

    Sub OutlineAndIncrementalSearch()

        DTE.ExecuteCommand("Edit.ToggleAllOutlining")
        DTE.ExecuteCommand("Edit.IncrementalSearch")
    End Sub
    

    And bind this macro to Ctrl+I instead of the normal incremental search command.