Is there a way to highlight the currently active code block in Visual Studio 2010?

后端 未结 4 460
陌清茗
陌清茗 2021-01-04 22:12

In Visual Studio 2010, if you hover your mouse over the little [-] minus sign, it will highlight that block of code for you. My question is, is there a way for this block t

相关标签:
4条回答
  • 2021-01-04 22:40

    Resharper has some options for this, one will let you outline the braces you are currently in and I think the other lets you highlight the current line

    0 讨论(0)
  • 2021-01-04 22:43

    ReSharper is nice, but if you're also looking for something for all kinds of languages, there is Visual Assist X, which also does nice highlighting.
    It, too, has the option to highlight matching braces in your current block:

    Braces highlighting

    Then you have a line highlighter, either as a simple frame:

    Line highlighting (frame)

    Or as a good looking background:

    Line highlighting (background)

    Sadly, there is no option in it to enable a real "block" highlighting like hovering over the [-] button does. :| I also looked for, but didn't find such an option within the Visual Studio options.

    0 讨论(0)
  • 2021-01-04 22:49

    Highlight everything you want your eyes to focus on and press ctrl+H.

    Or, highlight everything you DON"T want and right click "Outlining" then select "Hide Selection." The short cut for that is ctrl+M

    0 讨论(0)
  • 2021-01-04 22:52

    This can be done using bookmarks. The out-of-the-box configuration of bookmarks does not highlight, however this can be changed easily:

    bookmark without highlight

    Go to Tools – Options – Environment – Fonts and Colors. Under Display Items, select Bookmark. Now change the background color to something, like red. Then go to Tools – Options – Text Editor – General and uncheck Indicator Margin.

    bookmark with highlight

    PS Bookmarks can be found in the Text Editor toolbar PS2: To quickly set bookmarks use Ctrl+k+k, but beware of Ctrl+k+l which will wipe out all your bookmarks, it happened to me once!

    Adapted from: http://blogs.msdn.com/b/saraford/archive/2007/09/05/did-you-know-how-to-change-a-bookmark-color.aspx

    0 讨论(0)
提交回复
热议问题