microsoft / vscode-pull-request-github

GitHub Pull Requests for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github
MIT License
2.3k stars 575 forks source link

File can't be opened, redirects me to browser #5827

Closed levani-k closed 2 months ago

levani-k commented 6 months ago

I have latest version and when trying to open a file this pupop is displayed and it can't open file localy and redirects me to browser, no more error is shown.

image
AkashKumarSingh11032001 commented 6 months ago

Hi @levani-k, is it possible to share the sample .tsx file, it would be helpful to reproduce this issue locally, Thanks

zbjornson commented 6 months ago

This happens for me also on a somewhat regular basis. I can't share an example file because it's closed-source, but it seems to happen for larger diffs (one right now is +3k/-3k).

Are there limits or criteria when this happens?

https://github.com/microsoft/vscode-pull-request-github/blob/9520aa5e8d52ebda5ec09989cb734059d3bb37fc/src/commands.ts#L270

alexr00 commented 6 months ago

I just made a fix for this in March. Can you install the pre-release version of the extension and see if you still see the issue there?

yfengBTI commented 3 months ago

I am still seeing this issue with the pre-release version v0.91.2024062808. Is this connected to the "Large diffs are not rendered by default" message from website?

alexr00 commented 3 months ago

@yfengBTI do you also get the "Large diffs are not rendered by default" message when you try to open the same file on the website?

yfengBTI commented 3 months ago

@yfengBTI do you also get the "Large diffs are not rendered by default" message when you try to open the same file on the website?

OK, I've narrowed it down, there seem to be two thresholds on the number of diffs.

One threshold will prompt the GitHub PR site to show Large diffs are not rendered by default, but you can click on Load diff to try to force it to open. This threshold doesn't show up with VS Code.

But if the number of diffs is over a higher threshold, then clicking on Load diff on the site will show a message like this: image And these are the file diffs that cannot be opened in VS Code as well with the message ... can't be opened locally. Do you want to open it on GitHub?

Hope it helps

alexr00 commented 3 months ago

It does help, thank you. I'll see if I can repro.

yfengBTI commented 3 months ago

@yfengBTI do you also get the "Large diffs are not rendered by default" message when you try to open the same file on the website?

OK, I've narrowed it down, there seem to be two thresholds on the number of diffs.

One threshold will prompt the GitHub PR site to show Large diffs are not rendered by default, but you can click on Load diff to try to force it to open. This threshold doesn't show up with VS Code.

But if the number of diffs is over a higher threshold, then clicking on Load diff on the site will show a message like this: image And these are the file diffs that cannot be opened in VS Code as well with the message ... can't be opened locally. Do you want to open it on GitHub?

FYI, I've encountered one file that can be opened on the GitHub site after clicking Load diff but still cannot be opened in VS Code. So maybe the VS Code extension threshold is between the prompt for Load diff and the full stop, or it's something else entirely. For reference, the file was changed from 31 KB with windows CRLF EOL to 35 KB with a mix of CRLF and LF EOL. There are a total of 23 differences.

alexr00 commented 2 months ago

Got a repro 👍

meganrogge commented 2 months ago

@alexr00 what was the repro?

alexr00 commented 2 months ago

To verify:

  1. Push a file to a repo that has only one empty line
  2. Make a PR where you change the contents of the file to checker.ts
  3. Checkout the default branch.
  4. In the Pull Requests view, expand the PR you created in 2 and open the diff of the file that you changed. Verify that the diff shows.