Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to 'highlight' code? [duplicate]

I'm currently using Visual Studio 2010 (and also have a copy of Visual Studio 2005 which I'm also happy to use if the functionality is available in it but not '10)

What I'm wondering is if there is any way to highlight pieces of code?

For instance, I'm currently working on an assignment to take a piece of code, and change the stack implementation. It would be really useful if I could highlight the stack implementation specific pieces of code so that it's easy for me to just glance at the screen and know which pieces need my attention rather than having to visually wade through it.

(I am using comments to highlight the stack implementation specific code - but they get a little lost amidst other comments - and this seems like a better idea.)

like image 537
Eilidh Avatar asked Nov 20 '10 14:11

Eilidh


People also ask

How do I find duplicate codes?

Duplicate code can be hard to find, especially in a large project. But PMD's Copy/Paste Detector (CPD) can find it for you! CPD works with Java, JSP, C/C++, C#, Go, Kotlin, Ruby, Swift and many more languages. It can be used via command-line, or via an Ant task.

How do you highlight duplicates in Vscode?

A very simple VS Code extension to identify duplicated lines. Select lines where you want to list the lines appearring twice or more, press Cmd+Alt+L and it will print bellow the duplicated lines. It doesn't remove the duplicates, a lot of extensions are doing it well already.


1 Answers

You might consider using bookmarks at the start of a section you are interested in, or on a specific line. While this does not highlight the lines of code, it does provide a visual indicator in the left margin.

If you use the AllMargins extension, it also appears there. This is a handy way to quickly see if there any bookmarks in the current document, and also helps since the bookmark icon on the left will not appear in collapsed regions.

alt text

By using bookmarks, you can also use the bookmarks window to quickly navigate to the code you are interested in:

alt text

like image 89
Jeff Ogata Avatar answered Nov 09 '22 13:11

Jeff Ogata