caponetto / vscode-diff-viewer

A simple VS Code extension to easily visualize git diff files.
https://marketplace.visualstudio.com/items?itemName=caponetto.vscode-diff-viewer&ssr=false#overview
MIT License
41 stars 5 forks source link

"Loading …" never gets replaced with content #83

Closed ELLIOTTCABLE closed 1 year ago

ELLIOTTCABLE commented 1 year ago

I'm just getting this when attempting to open a git diff of my staged changes:

Screenshot 2023-06-27 at 2 46 28 PM

I don't think there's any related errors in the developer console. If it's related (and I find it often is, with extensions), I'm on VScode-Remote over SSH.

caponetto commented 1 year ago

Hi @ELLIOTTCABLE, does it work when you try that on a local VS Code?

scfrazer commented 1 year ago

I'm seeing the same thing using remote-through-ssh. It works fine locally

scfrazer commented 1 year ago

More info: I don't see any problems in the logs, but if I start the developer tools and try to open a diff file, it shows: image This does not happen when run locally. No idea why it's trying to find Django -- or why it fails -- since I don't use that or have any extensions that explicitly do. I mean to say I don't have any Django extensions installed, but it could be some other extension.

scfrazer commented 1 year ago

Sorry for spamming comments, but: This issue looks like it might be the same thing, and was fixed just three days ago. Maybe just need to pick up a newer version of diff2html?

caponetto commented 1 year ago

Hi @scfrazer, no problems, thanks for the pointers. :) I have updated the version of diff2html to the one that includes that fix (PR https://github.com/caponetto/vscode-diff-viewer/pull/86). Could you please give it a try and let me know? The vsix is available to be downloaded here, in the Artifacts section.

scfrazer commented 1 year ago

Hi @scfrazer, no problems, thanks for the pointers. :) I have updated the version of diff2html to the one that includes that fix (PR #86). Could you please give it a try and let me know? The vsix is available to be downloaded here, in the Artifacts section.

Shoot, that didn't fix it.

I'm pretty sure it's not a remote vs. local problem. I have seen it work remotely even before trying the new vsix. What I work on locally (mostly Typescript) vs. what I work on remotely (mostly SystemVerilog/Python) is very different. I'm guessing it's some other extension that is causing the issue, either by simply existing or maybe by the order they are loaded or activated. I don't have a reliable way to reproduce the passing/failing behaviors yet to test any sort of a fix. I'll try to figure something out, maybe disabling all extensions then bisecting until I find a problem.

jacekkopecky commented 1 year ago

@scfrazer does that diff file load OK in some circumstances and not in others?

If it never loads properly, you could try subsetting the file to identify which part of it triggers the issue.

scfrazer commented 1 year ago

@scfrazer does that diff file load OK in some circumstances and not in others?

If it never loads properly, you could try subsetting the file to identify which part of it triggers the issue.

You're right, it may be the diff file itself. I tried disabling everything except vscode-diff-viewer and it still won't load. Let me try playing with the diff file and see if I can figure out the issue

scfrazer commented 1 year ago

Okay I found it. I am using Jinja template files and that is messing up diff2html. When I look in that repo, I see that it sets the file mode to Django for Jinja templates. I don't know if the person who originally started this thread is using Jinja or maybe another format that diff2html doesn't support, but as far as I'm concerned this is not your issue. Thanks for the help!

scfrazer commented 1 year ago

Again sorry for spamming comments :) A quick look at the diff2html lib shows that there is a "full" and "slim" version. The slim version leaves out syntax highlighting for some file types, Django being one of them. You are using the slim version, would you be willing to switch to the "full" version of diff2html? Granted diff2html should gracefully handle non-existent syntax highlighting file types, and I'll probably comment just that in diff2html if I can figure out where it is happening.

caponetto commented 1 year ago

Hi @scfrazer. Not a problem switching to the full version. Would you mind making this change locally to see if it resolves for you? PR is welcome :)

scfrazer commented 1 year ago

I opened an issue in diff2html and the maintainer just replied. He gave some suggestions I can try first, and if that isn't working out try the non-slim version. I'll open a PR once I figure something out.

scfrazer commented 1 year ago

@caponetto , after some back-and-forth with the diff2html maintainer, there is a new version that handles this situation properly. I just made a PR to pick up the new diff2html, which I tested locally and it works: #88

caponetto commented 1 year ago

Thanks for the PR @scfrazer! The fix will be included in the next release (1.4.2).