ahrm / sioyek

Sioyek is a PDF viewer with a focus on textbooks and research papers
https://sioyek.info/
GNU General Public License v3.0
6.82k stars 224 forks source link

Inverse search test configuration not working #1123

Closed benfranklin79 closed 1 week ago

benfranklin79 commented 1 week ago

I'm currently trying to debug why Sioyek is not working with Neovim on windows. As a start I've tried adding the following configuration to the prefs_user.config file in order to get a handle on what is being passed back:

inverse_search_command echo "%2 '%1'" >> %USERPROFILE%\sioyek-test.log

This follows a suggestion in https://github.com/lervag/vimtex/issues/2967#issuecomment-2166803063 but adjusted for windows. Nothing is added to the file so I thought I'd make it really simple and try adding

inverse_search_command echo "some text" >> %USERPROFILE%\sioyek-test.log

again nothing. I tested the DOS command on its own echo "some text" >> %USERPROFILE%\sioyek-test.log to make sure it was valid and it successfully wrote to the file. I've also tried adding the configuration into prefs.config with no success. I'm making sure I'm in synctex mode and right clicking a word but it doesn't seem to be generating any output to help with debugging. Hope you can help, thnx.

ahrm commented 1 week ago

Unfortunately sioyek can not handle complex commands like echo "some text" >> %USERPROFILE%\sioyek-test.log. In order to be cross-platform, we use QProcess and we basically split the command string and treat the first part as the name of the command and the rest as arguments. So basically we treat that command as echo with arguments: ['"some', ' text"', '>>', ...] which clearly fails.

As a workaround you can add whatever command you want to run into a batch file. For example sioyeklog.bat:

echo %1 >> sioyeklog.txt

And add the path of this file to PATH, and then configure sioyek like so:

inverse_search_command sioyeklog.bat "%1":%2
benfranklin79 commented 1 week ago

Thanks for help @ahrm, this worked. I'm getting the debug information I need.