Is there a way to highlight the currently active c

2019-02-16 16:23发布

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 to always be highlighted while you are coding inside of it? That way, as I'm hopping between methods and classes, whatever block I'm currently working on would be highlighted to help my eyes quickly focus.

Is there an option within Visual Studio for this? If not, are there any plugins that do this?

enter image description here

4条回答
Viruses.
2楼-- · 2019-02-16 16:47

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

查看更多
淡お忘
3楼-- · 2019-02-16 16:50

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.

查看更多
一纸荒年 Trace。
4楼-- · 2019-02-16 16:55

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

查看更多
Ridiculous、
5楼-- · 2019-02-16 16:56

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

查看更多
登录 后发表回答