alefragnani / vscode-bookmarks

Bookmarks Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks
GNU General Public License v3.0
1.65k stars 161 forks source link

[BUG] - Does not work with `jrieken.vscode-memfs` FileSystemProvider sample extension #645

Closed gjsjohnmurray closed 9 months ago

gjsjohnmurray commented 10 months ago

Environment/version

Steps to reproduce

  1. Install the jrieken.vscode-memfs extension, which is a packaged version of https://github.com/microsoft/vscode-extension-samples/tree/main/fsprovider-sample
  2. Follow that extension's README steps:
    • Begin with no folder or workspace open.
    • From Command Palette run MemFS: Setup Workspace then MemFS: Create Files
  3. In Explorer view browse the tree and open one of the files.
  4. Try to set a bookmark on a line in the file.

:bug: See this is the Extension Host channel of the Output tab on Panel:

2023-09-04 17:39:27.011 [error] Error: [UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")
    at m (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:72:31884)
    at new S (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:72:32792)
    at new r (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:72:34430)
    at r.with (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:72:33219)
    at t.getFileUri (c:\Users\JohnM\.vscode\extensions\alefragnani.bookmarks-13.4.1\dist\extension-node.js:1:70274)
    at u.getFileUri (c:\Users\JohnM\.vscode\extensions\alefragnani.bookmarks-13.4.1\dist\extension-node.js:1:45215)
    at u.addBookmark (c:\Users\JohnM\.vscode\extensions\alefragnani.bookmarks-13.4.1\dist\extension-node.js:1:42456)
    at c:\Users\JohnM\.vscode\extensions\alefragnani.bookmarks-13.4.1\dist\extension-node.js:1:42077
    at new Promise (<anonymous>)
    at u.toggle (c:\Users\JohnM\.vscode\extensions\alefragnani.bookmarks-13.4.1\dist\extension-node.js:1:41640)
    at V (c:\Users\JohnM\.vscode\extensions\alefragnani.bookmarks-13.4.1\dist\extension-node.js:1:125422)
    at c:\Users\JohnM\.vscode\extensions\alefragnani.bookmarks-13.4.1\dist\extension-node.js:1:27973
    at a.h (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:102:77777)
    at a.$executeContributedCommand (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:102:78637)
    at t.N (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:7983)
    at t.M (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:7749)
    at t.H (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:6830)
    at t.G (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:5906)
    at r.value (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:4736)
    at f.w (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:63:1902)
    at f.fire (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:63:2119)
    at y.fire (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:79:13931)
    at r.value (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:130:30355)
    at f.w (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:63:1902)
    at f.fire (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:63:2119)
    at y.fire (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:79:13931)
    at MessagePortMain.<anonymous> (c:\Users\JohnM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:130:28635)
    at MessagePortMain.emit (node:events:513:28)
    at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:367)

I would also like to use your Bookmarks extension with files served by the FileSystemProvider in intersystems-community.vscode-objectscript, which I help maintain. It doesn't work properly there either. I can set a bookmark in a file, and the bookmark appears in the gutter, but the file node in the Bookmarks Explorer tree shows no descendants.

I'm hoping that if you fix the above error when handling a file from jrieken.vscode-memfs you might also see the "no descendants" issue and be able to fix it too.

gjsjohnmurray commented 10 months ago

If #523 happens I could investigate and maybe offer a PR. Any news on that?

gjsjohnmurray commented 9 months ago

@alefragnani any thoughts about this bug and/or my offer to investigate / fix it once you make all the source public?

alefragnani commented 9 months ago

Hi @gjsjohnmurray ,

First of all, sorry for the late reply.

As we discussed, I'll take a look on memfs support ultil the weekend, and let you know.

BTW, based on the log you provided, you are using the desktop version of VS Code, right? No Codespaces, vscode.dev or similar.

Hope this helps

gjsjohnmurray commented 9 months ago

you are using the desktop version of VS Code, right?

Right. Thanks for planning to investigate.

alefragnani commented 9 months ago

The same error was raised here https://github.com/microsoft/vscode/issues/172788, an fixed with https://github.com/microsoft/vscode/pull/172848.

This happens because MemFS workspace has its path as a single slash too. And it failed while derivating a new Uri here.

return workspaceFolder.uri.with({
        path: `${prefix}/${file.path}`
    });

image

But, it looks promissing...

image

gjsjohnmurray commented 9 months ago

@alefragnani thanks for doing this. Please let me know when there's a VSIX containing the fix, as I am keen to test whether or not Bookmarks now works properly with the FSP of the popular (>50K downloads) extension I help maintain.

alefragnani commented 9 months ago

Hi @gjsjohnmurray,

I just released v13.4.2, which incorporates the fix. Please let me know if it also works on your InterSystems ObjectScript extension.

gjsjohnmurray commented 9 months ago

@alefragnani yes, it now works with that extension. Thanks for the fix.

alefragnani commented 9 months ago

That's great to hear. Thanks for the feedback 👍