Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline comments appear in the wrong place #170

Closed
joaomoreno opened this issue Aug 10, 2018 · 5 comments
Closed

Inline comments appear in the wrong place #170

joaomoreno opened this issue Aug 10, 2018 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug github Related to GitHub API

Comments

@joaomoreno
Copy link
Member

  1. Check out a PR (Add useYarn to ICreateVSIXOptions, IPublishOptions, and IPublishVSIXOptions vscode-vsce#279)
  2. Open a file which has changes (api.ts)
  3. Add a few comments here and there (lines 30, 62, 110 of the modified buffer)
  4. Reload the workbench
  5. Open the same file

Comments appear in the wrong place now:

  • If I open app.ts via quick open, the third comment appears on line 1, instead of 110
  • If I open app.ts via the Github Pull Requests view, the third comment appears on line 64
@RMacfarlane RMacfarlane added the bug Issue identified by VS Code Team member as probable bug label Aug 10, 2018
@RMacfarlane
Copy link
Contributor

This seems to be an issue with the GitHub API for getting comments. The position of the third comment is returned incorrectly, the text of the diff line appears twice in the diff, and the position is being reported as the first one instead of the second.

Do you know what version of the extension you were using? I'm seeing it on line 64 when opening via quick open and the tree view

@rebornix rebornix added the github Related to GitHub API label Aug 14, 2018
@joaomoreno
Copy link
Member Author

@RMacfarlane Not sure which version I had... it was the latest at the time. I can't open that PR any more, since it seems the extension only lets me open open ones (which does make sense).

@RMacfarlane
Copy link
Contributor

I contacted GitHub support about this quite a while ago about this and they agreed that the API was returning the incorrect location in this case - I'm going to go ahead and close this issue since I have no way of linking this to an upstream issue and since there've been no other reports of this

@Chris-Petty
Copy link

Chris-Petty commented Jan 8, 2024

Eons later I'm having the same problem I think and perhaps you can try reproduce with this repo/PR: https://github.com/msupply-foundation/open-msupply/pull/2674/files

Hmm maybe not because I sorta fixed it by restarting vscode... anyway. There were some comments here on what was line 75. Now say I update the branch from the base branch as I often do, the lines might get bumped around, but the comments stay behind:

image

After pushing to origin, I have to restart vscode to get the new correct line number (93) for the comments (I don't believe the restart would help without pushing to origin, as github will presumably keep returning 75 as that's correct as far as it knows):

image

At least for my workflow this is pretty common, I assume I'm not the only one! Reopening the file didn't seem to be enough to refresh the comments. Opening the PR description in vscode and clicking "refresh" did not either. I didn't try reloading window rather than restarting, but I assume that'd have worked.

Fix ideas:
(If this is reopened)

  1. Automatically refresh the github comments for open(?) files after pushing or pulling origin (my push was using github desktop, not vscode, so cannot count on a user action. Same goes for CLI users). This would at least save users from remembering to reload their vscode window.
  2. Keep the latest commit hash of when the comments were downloaded. Compare to more recent commits and figure out the correct line the comment should be on. This sorta smells like spaghetti to me 😄. Benefit is that it should work even if you haven't pushed to origin yet. If the comment was on code that was deleted in more recent commits... ⚰️ .

@Andre-Medina
Copy link

I am having this issue as well, after some basic testing it most likely comes from replying to comments earlier in the document and it miss aligns comments later on in the document.

Closing and re-opening the PR changes refreshes the comments and puts them in the correct positions. Same with a full VSC restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug github Related to GitHub API
Projects
None yet
Development

No branches or pull requests

5 participants