Favorites.vscode icon indicating copy to clipboard operation
Favorites.vscode copied to clipboard

Unable to bookmark pdf or epub files

Open devgid opened this issue 11 months ago • 5 comments

I have vscode-pdf extension to read pdf files and epub reader extension to read epub files.

When I click the bookmark icon on any of these type of open files (pdf or epub) I get the following error

image

If I right click on the file, copy path and paste the path into the extension's list text file manually, then the bookmark shows in the extension.

devgid avatar Mar 16 '24 17:03 devgid

Will have a look. Txs

oleg-shilo avatar Mar 17 '24 13:03 oleg-shilo

Unfortunately, it's not something that can be fixed. The API design of VSCode has a flaw. It does not allow you to map a document-derived tab (e.g. preview, pdf-renderer) to the file that was used as a source for that tab. As far as VSCode API goes it simply says there is no active editor at the moment:

image

I found this post, which triggered this discussion. The problem was highlighted in 2018 but VSCode team closed it in 2020 without addressing the file name aspect of it. I can't see how we can even have a workaround.

The only thing that I can do is to explain the problem better in the error message: image

oleg-shilo avatar Mar 17 '24 23:03 oleg-shilo

@oleg-shilo Thanks for the explanation. Is it possible to add an "add to favorites" open in the context menu when right clicking on a file. This is how the another favorites extension I tested does it which works with epub and pdf files.

This is the favourite extension https://marketplace.visualstudio.com/items?itemName=kdcro101.favorites and the right context menu: image

devgid avatar Mar 18 '24 17:03 devgid

Definitely. It means that the author of this extension has found a way to overcome this limitation. If indeed it is the case then it can be done even for the existing "add" button. Will have a look.

oleg-shilo avatar Mar 18 '24 22:03 oleg-shilo

Done: Update the extension and you will be able to add the file via the context menu of the tab. 313953125-89b91bae-7267-4ba9-8a01-a80dd49ae110

oleg-shilo avatar Mar 19 '24 07:03 oleg-shilo