kaarmu / typst.vim

Vim plugin for Typst
MIT License
281 stars 24 forks source link

TypstWatch command has no effect #84

Closed muroc closed 4 months ago

muroc commented 6 months ago

OS: Windows 10 22H2 Nvim version: v0.9.5 Terminal emulator: Alacritty & Powershell

When using the TypstWatch command, the following line is displayed, but nothing else seems to happen.

Starting: typst  watch --diagnostic-format short 'test.typ' --open

The PDF file does not get updated nor generated if missing, and my PDF viewer does not open.

Running typst watch 'test.typ' --open in the terminal seems to work fine. It's like the command in the editor just isn't getting run for some reason.

I'm not really sure how to troubleshoot this to figure out what my issue is, so any advice would be appreciated.

kaarmu commented 6 months ago

Ah! Thank you for creating the issue. I've only tested TypstWatch once on Windows so this is valuable input.

For Windows, I'm doing this. You can try running that in the terminal, i.e.:

cmd /s /c "typst  watch --diagnostic-format short 'test.typ' --open"

You can also confirm the actual jobstart arguments:

echom l:str
let s:watcher = l:JobStart(l:str, l:options)
muroc commented 6 months ago

Running your command in the terminal produces this error:

error: input file not found (searched at 'test.typ').

However, if I remove the single quotes around test.typ, the command works and the PDF is generated.

cmd /s /c "typst  watch --diagnostic-format short test.typ --open"
muroc commented 6 months ago

Digging into this a little bit more: typing typst watch 'test.typ' into a command prompt gives the error as before, but typing it into Powershell works. It seems like the command prompt just doesn't like the single quotation marks around the file name.

To confirm this, I removed two of the single quotation marks from this line to the following:

\ . " " . expand('%') . ""

With the above change, the TypstWatch command in the plugin seems to function normally.

kaarmu commented 6 months ago

Sorry for late response! Check if branch fix-84 fixes the problem.

muroc commented 6 months ago

Don't worry about it. Thanks for looking into a fix.

I can confirm that the fix-84 works on one of my machines. I won't be able to test on the other one until Monday.

kaarmu commented 4 months ago

Hi @muroc, did you manage to confirm it on windows?

muroc commented 4 months ago

Yes. I have tried it on both the Windows machines that I have access to, and the fix seems to work without issue.

muroc commented 4 months ago

@kaarmu,

Sorry to bug you about this again, but I would like to ask about moving forward. Is there any hope that this fix could be introduced into the main branch, or will this have to remain as a separate branch?

Thanks again for your help on this issue!

kaarmu commented 4 months ago

Oh, sorry! I forgot to actually merge it. Now it's done!