havarddj / typst-preview.el

Typst live preview minor mode for emacs
GNU General Public License v3.0
45 stars 2 forks source link

Hot-reloading preview stops working after `typst-preview-send-position` #2

Closed m4xxed closed 7 months ago

m4xxed commented 7 months ago

First off, let me say that I already love this package. It just works out of the box (using firefox as browser)!

The issue I found is that after using typst-preview-send-position (which works, the browser moves to the position and pulses shortly), any changes to the document are not updated live anymore. It works after refreshing the browser page, until using the typst-preview-send-position button again.

m4xxed commented 7 months ago

Here are the outputs from *ws-typst-server*:

Before typst-preview-send-position when deleting a word:

[2024-03-22T13:27:08Z DEBUG typst_preview::actor::editor] EditorActor: received message from editor: UpdateMemoryFiles ["/home/user/typst-templates/official-templates/charged-ieee/template/main.typ"]
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::typst] TypstActor: processing UPDATE memory files: ["/home/user/typst-templates/official-templates/charged-ieee/template/main.typ"]
[2024-03-22T13:27:08Z DEBUG typst_ts_compiler::service::compile] CompileActor: memory event incoming
[2024-03-22T13:27:08Z INFO  typst_ts_compiler::service::diag::console] /main.typ: compiling ...

[2024-03-22T13:27:08Z INFO  typst_ts_compiler::service::diag::console] /main.typ: Compilation succeeded in 5.187364ms

[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: received message: RenderIncremental
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] RenderActor: has_full_render: false
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: sending outline
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: received message: RenderIncremental
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: sending outline
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: received message: RenderIncremental
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: received message: RenderIncremental
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: sending outline
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: sending outline
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message
[2024-03-22T13:27:08Z DEBUG typst_preview::actor::render] RenderActor: waiting for message

After typst-preview-send-position:

[2024-03-22T13:28:23Z DEBUG typst_preview::actor::editor] EditorActor: received message from editor: SrcToDocJumpRequest { filepath: "/home/user/typst-templates/official-templates/charged-ieee/template/main.typ", line: 35, character: 3 }
[2024-03-22T13:28:23Z DEBUG typst_preview::actor::typst] TypstActor: processing src2doc: SrcToDocJumpRequest { filepath: "/home/user/typst-templates/official-templates/charged-ieee/template/main.typ", line: 35, character: 3 }
[2024-03-22T13:28:23Z DEBUG typst_ts_compiler::service::compile] CompileActor: execute task

After deleting word:

[2024-03-22T13:28:47Z DEBUG typst_preview::actor::editor] EditorActor: received message from editor: UpdateMemoryFiles ["/home/user/typst-templates/official-templates/charged-ieee/template/main.typ"]
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::typst] TypstActor: processing UPDATE memory files: ["/home/user/typst-templates/official-templates/charged-ieee/template/main.typ"]
[2024-03-22T13:28:47Z DEBUG typst_ts_compiler::service::compile] CompileActor: memory event incoming
[2024-03-22T13:28:47Z INFO  typst_ts_compiler::service::diag::console] /main.typ: compiling ...

[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] RenderActor: has_full_render: false
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: received message: RenderIncremental
[2024-03-22T13:28:47Z INFO  typst_ts_compiler::service::diag::console] /main.typ: Compilation succeeded in 6.327091ms

[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: received message: RenderIncremental
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: sending outline
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: sending outline
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: received message: RenderIncremental
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: received message: RenderIncremental
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: sending outline
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: sending outline
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message
[2024-03-22T13:28:47Z DEBUG typst_preview::actor::render] RenderActor: waiting for message
havarddj commented 7 months ago

Glad you like it!!

It seems like it's an issue with the typst-preview binary itself, I am able to reproduce it both in emacs and with the VS-code extension. I've created an issue in their github repo: https://github.com/Enter-tainer/typst-preview/issues/278

For the time being, I've checked that it works in Chrome, Safari and XWidget. If you've built your emacs with XWidget support, I'd recommend that until the typst-preview experts find a fix!

If you don't mind, I'll close this issue for now and update the readme with some firefox-specific guidelines.

havarddj commented 7 months ago

This should be fixed now, see https://github.com/Enter-tainer/typst-preview/issues/278.