CommentLinks icon indicating copy to clipboard operation
CommentLinks copied to clipboard

[Epic] Highlight/Show places being linked to?

Open michael-hawker opened this issue 3 years ago • 1 comments

Preface: This would probably be a big issue to solve in terms of performance and requiring some sort of cache per project or something...?

Problem Statement:

Sometimes when creating links, they're actually meant to be bi-directional. It can be useful to know that two pieces of code are linked for instance.

Breakdown

Using comment links for this can be handy when that code is across multiple languages or configuration files, etc... However, keeping comment links in sync can be cumbersome, it can also be hard if you're linking to something like json where comments aren't always supported easily. In these cases linking back is impossible.

Sometimes too, the main part of code is usually worked on and discovered first, and the other 'unknown' part is rarely worked on (or maybe generated), so linking back doesn't make as much sense to keep in sync or isn't possible (code generation).

Experience

In these cases, it'd be handy to see the link button (or some other highlight) appear over places that are being linked to from other comment links.

Maybe in the gutter margin area?

image

It'd have a tooltip which has the details of where the link came from and what the comment was on that line (maybe abbreviated for the file portion).

Clicking on it would take you to that place where the comment link was of course.

If there are multiple places linking to the same spot, they'd show up in a list in the Tooltip and clicking on the button would pop-up a dropdown to offer the selection of which file/location to go to.

Challenges

This of course would require crawling every file in the solution/folder to know they exist, and may be tricky with text matches to keep track of. Thus some sort of caching mechanism would probably be required if this were to work to keep up-to-date with changes to files and not constantly be trying to read every file of the solution.

Thoughts?

(Came about from scenario which lead to #38 issue.)

michael-hawker avatar May 11 '22 19:05 michael-hawker

It seems like a useful and reasonable request. I have some other extensions that do rely on crawling the file system to annotate files but this has some performance issues and VS occasionally flags this as the cause of hangs. Once I work out how to update them so they work "out of process" I can look at this.

mrlacey avatar May 12 '22 10:05 mrlacey