Open pedrosousa opened 3 months ago
Ah yes i haven’t tested on Windows. I’ll look into this today, should be easy to fix.
@pedrosousa I published 0.2.3, let me know if that fixes it.
Hi @mk12 Thank you for the quick turnaround.
Most commands work now! 🎉
The only thing still broken (apparently) is the Show Diff
command. I get this error (changed the paths and the commit hash, but kept all the slashes as in the original message):
The editor could not be opened due to an unexpected error:
Unable to resolve filesystem provider with relative file path
'git:c:\gitrepos\repo\folder/folder2/file.md?{"ref":"617bd3da26cb4bac839a135781f483bb~","path":"c:\\gitrepos\\repo\\folder/folder2/file.md"}'
@pedrosousa Ah I see what I missed. Let me know if 0.2.4 fixed it 🤞
There's some progress (slashes are consistent), but I still get an error:
The editor could not be opened due to an unexpected error:
Unable to resolve filesystem provider with relative file path
'git:c:\gitrepos\repo\folder\folder2\file.md?{"ref":"617bd3da26cb4bac839a135781f483bb~","path":"c:\\gitrepos\\repo\\folder\\folder2\\file.md"}'
Is the git:
prefix expected in the relative file path? I'm asking because I have no clue...
Yes, git:
is the URI scheme VS Code uses to show files from git. The problem is I'm not sure how it's formatted on Windows — it might be backslashes in the main path but forward slashes in the "path" JSON field, for example. I've created a debug-windows
branch with a modified version of the extension. Could you try following these steps?
git clone https://github.com/mk12/vscode-better-git-line-blame
cd vscode-better-git-line-blame
git checkout debug-windows
code
CLI, you can also go in the Extensions pane, click the three dots, click "Install from VSIX...", and choose that file.
code --install-extension better-git-line-blame-DEBUG-WINDOWS.vsix --force
Quick update: I couldn't find the time to try this just yet, but I plan to do so.
Here are the logs:
2024-04-26 12:08:33.409 [info] git API initialized with 1 repo(s)
2024-04-26 12:08:33.409 [info] adding git repo: c:\code\repo
2024-04-26 12:08:33.410 [info] blamed 0 initial file(s)
2024-04-26 12:08:41.345 [info] loading blame: c:\code\repo\main\app\views\order\edit.tpl
2024-04-26 12:10:04.950 [info] NOTE: logging debug info for windows instead of showing diff
2024-04-26 12:10:04.950 [info] active editor URI: file:///c%3A/code/repo/main/app/views/order/edit.tpl
2024-04-26 12:10:13.679 [info] NOTE: logging debug info for windows instead of showing diff
2024-04-26 12:10:13.681 [info] active editor URI: file:///c%3A/code/repo/main/app/views/order/edit.tpl
Since I mostly use the inline diff view instead of the split view (with left and right editors), I also checked the logs for this particular layout -- I can confirm that the active editor URI was the same as above.
Let me know if you need any additional testing from my side.
Thanks! Hmm, I was hoping it would give the special git URI, but it's not.
I just pushed a new change to the debug-windows
branch. Can you repeat steps 1-5 above (not 6-9) and then try using "Show Diff" command? If it works, my theory was right and I'll publish the change. If not, let me know if there's any logs.
I just tried reproducing the steps but could not find the logs ...
Anyways I tried show diff
on the debug-windows
branch and the behaviour is the same:
The editor could not be opened due to an unexpected error: Unable to resolve filesystem provider with relative file path 'git:d:\git\vscode-better-git-line-blame\TODO.md?{"ref":"968a77c4a152c485e7df8cdba6672eede2fb0b5f~","path":"d:\\git\\vscode-better-git-line-blame\\TODO.md"}'
Unfortunately I don't think me trying to fix it by trial and error like this is going to work, not having access to a Windows machine myself. It's too bad the VS Code git URL format isn't documented. I'm going to need a contributor on Windows to figure out the correct format and make a pull request.
There's some issue around path separators that causes the extension not to work properly in VS Code running on Windows. The path separator depends on the OS – on Windows it must be
\
(backslash).Example log of when the blame operation fails: