lhl2617 / VSLilyPond-PDF-preview

Provides PDF Preview for LilyPond-generated PDFs. Supports point-and-click from PDF to source code.
https://marketplace.visualstudio.com/items?itemName=lhl2617.lilypond-pdf-preview
MIT License
7 stars 8 forks source link

[Bug Report][Windows 10] Both Point-and-Clicks failed when blank space exist on the file path #110

Closed Stevearzh closed 2 years ago

Stevearzh commented 2 years ago

First of all, I want to say thank you.

I'm a newbie for LilyPond, this VSLilyPond plugin really helps me a lot, it is awesome.


I met this problem when I try using VSLilyPond:

  1. When Forward (Score to PDF), the error message is:

    [ERROR]: Error: No valid PDF location can be found from the cursor
  2. When Backward (PDF to Score), the error message is:

    [ERROR]: Error: cannot open file:///e%3A/LilyPond%2520Sheet/test.ly. Detail: Unable to read file 'e:\LilyPond%20Sheet\test.ly' (Error: Unable to resolve nonexistent file 'e:\LilyPond%20Sheet\test.ly')

And it works as expect if I change the folder name from LilyPond Sheet to just LilyPond.

I check the code, maybe we should use decodeURIComponent for fsPath here? https://github.com/lhl2617/VSLilyPond-PDF-preview/blob/master/src/extension/pdf-goto.ts#L86

I'm not familiar with VSCode plugin development, please forgive me if I'm wrong.

lhl2617 commented 2 years ago

Hey @Stevearzh -- thanks for reporting this and also investigating.

I check the code, maybe we should use decodeURIComponent for fsPath here? https://github.com/lhl2617/VSLilyPond-PDF-preview/blob/master/src/extension/pdf-goto.ts#L86

Do you want to try this? :) There is a dev guide here.

Otherwise, I can have a look over the weekend.

Stevearzh commented 2 years ago

@lhl2617 Thanks for the guide, I didn't notice it at the first time.

It takes me a while to configure the development environment on Windows, sorry for that...

And I met another problem when debugging the plugin

image

the pdf viewer is always in loading status, I'm not sure which step I did wrong

lhl2617 commented 2 years ago

@Stevearzh can you try this without any changes off the main branch?

aron-hanowski commented 2 years ago

I was able to fix this by adding decodeURIComponent here (as suggested by @Stevearzh). This should solve the issue for both directions.

lhl2617 commented 2 years ago

Thanks so much @aron-hanowski !

@Stevearzh can you double check if the issue is resolved?

Stevearzh commented 2 years ago

Yes it is resolved. Thank you guys! @aron-hanowski @lhl2617