vscode-comment-anchors icon indicating copy to clipboard operation
vscode-comment-anchors copied to clipboard

Duplicate in workspace

Open danilort opened this issue 2 years ago • 6 comments

INFO

CommentAnchors v1.9.6 (also beta 1.10.0) VSCODE v1.63.2 OS: Windows 10

Description

In the "Workspace Anchors" section I often see duplicates. It's not a big problem, but creates a bit of confusion.

immagine

Very strange.

danilort avatar Dec 29 '21 18:12 danilort

I have observed the same in Epic anchors. Suddenly, without a pattern I have noticed, duplicate entries for the same anchor are under Epics.

bretonics avatar Mar 10 '22 14:03 bretonics

I am having this problem as well. On version 1.10.1 and VS code version 1.73.1.

I don't know if this is the cause, but I noticed that there is a slight difference in the path of the double entries. One starts with lowercase drive letter /c:/ and the other starts with an uppercase drive letter /C:/.

CryReaper avatar Nov 10 '22 04:11 CryReaper

I also noticed I was only seeing duplicates when a file with anchors was open in the open editors window.

CryReaper avatar Nov 10 '22 16:11 CryReaper

just discovered this extension and LOVE it so much. wish I knew about it sooner. I have this issue as well. Hopefully these repro notes will help @danilort fix: settings.json:

  "commentAnchors.tags.anchors": {
    "ANCHOR": {
      "scope": "workspace"
    }
  }

the issue is then triggered by:

  • having the workspace anchors panel open & scanning started
  • having several working links to other files like so (this is a .js file):
    //TODO: Remove/refactor all below this (legacy matching methods)
    // this is used by:
    // LINK ./foo.js#runSomething
    // which is used by:
    // LINK ../node_server/controllers/bar1.js#runFoo1
    // LINK ../node_server/controllers/bar2.js#doFoo2
    // LINK ../node_server/controllers/bar3.js#seeFoo3
    
  • when I make a change to the file and save it, that's when the issue happens
  • note that in the screenshot, the same anchors are repeated over and over

comment_anchors_issue

kboudy avatar Dec 31 '22 16:12 kboudy

Seems to only happen with a file with link to Anchor. If the same file has a link to a line number it doesn't duplicate the entries. The duplicate entries will also start showing up if you just focus another tab and switch back to the tab that has the link to the anchor. The actual link to anchor will only jump to the top of the file not the anchor line. Not sure if its related.

mfcoxo avatar Jun 13 '23 11:06 mfcoxo

The issue seems to be that by calling the getAnchors in linkProvider.ts with a newly created fileUri its triggering an add to the cache since the keys are Uri objects @JordanDi123

mfcoxo avatar Jun 15 '23 20:06 mfcoxo