Preview onType not working
Describe the bug
When previewing any typst file in VS Code, the preview changes only on save, even though "tinymist.preview.refresh": "onType" is set. Compiling to pdf on type via "tinymist.exportPdf": "onType" works without issue. I have attached logs where I inserted a single character into a file I had opened a preview for.
If this issue should rather be submitted to https://github.com/Enter-tainer/typst-preview, I can of course close this and move over there. Package/Software version:
VSCode version(Help -> About):
Version: 1.94.0
Commit: d78a74bcdfad14d5d3b1b782f87255d802b57511
Date: 2024-10-02T13:08:12.626Z
Electron: 30.5.1
ElectronBuildId: 10262041
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Linux x64 6.6.54
tinymist extension version: v0.11.0. Get it by tinymist --version in terminal.
tinymist
Build Timestamp: 1980-01-01T00:00:00.000000000Z
Build Git Describe: VERGEN_IDEMPOTENT_OUTPUT
Commit SHA: VERGEN_IDEMPOTENT_OUTPUT
Commit Date: None
Commit Branch: None
Cargo Target Triple: x86_64-unknown-linux-gnu
Typst Version: 0.11.1
Typst Source: git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist-v0.11.1-2#314749ea26ac3f62622bc3b3c30d3a7d6a457a74
Logs:
tinymist server log(Output Panel -> tinymist):
[2024-10-28T19:51:23Z INFO sync_lsp] notifying textDocument/didChange - at Instant { tv_sec: 6171, tv_nsec: 380352646 }
[2024-10-28T19:51:23Z INFO sync_lsp] notifing textDocument/didChange succeeded in 86.29µs
[2024-10-28T19:51:23Z INFO tinymist::actor::editor] received status request(primary) Compiling
[2024-10-28T19:51:23Z INFO tinymist::actor::editor] received diagnostics from primary:625: diag(Some(0))
[2024-10-28T19:51:23Z INFO tinymist::actor::editor] received status request(primary) CompileSuccess
[2024-10-28T19:51:23Z INFO tinymist::task::cache] CacheEvictTask: evict cache in 13.715µs
[2024-10-28T19:51:23Z INFO sync_lsp] handling workspace/executeCommand - (2082) at Instant { tv_sec: 6171, tv_nsec: 381842579 }
[2024-10-28T19:51:23Z INFO sync_lsp] handled workspace/executeCommand - (2082) in 23.39µs
[2024-10-28T19:51:23Z DEBUG typst_preview::actor::editor] EditorActor: received message from editor: ChangeCursorPositionRequest { filepath: "/mnt/data/OneDrive/Education/Studium/Mathematik/Geometry of Manifolds/Homework/Sheet 01/Test.typ", line: 2, character: 21 }
[2024-10-28T19:51:23Z DEBUG typst_preview::actor::typst] TypstActor: processing src2doc: ChangeCursorPositionRequest { filepath: "/mnt/data/OneDrive/Education/Studium/Mathematik/Geometry of Manifolds/Homework/Sheet 01/Test.typ", line: 2, character: 21 }
[2024-10-28T19:51:23Z INFO typst_preview::actor::render] RenderActor: changing cursor position: SourceSpanOffset { span: Span(437605627854845), offset: 21 }
[2024-10-28T19:51:23Z DEBUG typst_preview::actor::render] OutlineRenderActor: received message: ChangeCursorPosition(SourceSpanOffset { span: Span(437605627854845), offset: 21 })
[2024-10-28T19:51:23Z DEBUG typst_preview::actor::render] OutlineRenderActor: sending outline
[2024-10-28T19:51:23Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message
[2024-10-28T19:51:23Z INFO typst_preview::actor::render] RenderActor: resolved element paths: Ok([[ElementPoint { kind: 4, index: 0, fingerprint: "" }, ElementPoint { kind: 1, index: 0, fingerprint: "" }, ElementPoint { kind: 0, index: 1, fingerprint: "" }, ElementPoint { kind: 5, index: 18, fingerprint: "" }]])
[2024-10-28T19:51:23Z DEBUG typst_preview::actor::render] RenderActor: has_full_render: false
[2024-10-28T19:51:23Z DEBUG typst_preview::actor::render] RenderActor: waiting for message
[2024-10-28T19:51:23Z INFO sync_lsp] handling textDocument/completion - (2083) at Instant { tv_sec: 6171, tv_nsec: 388297160 }
[2024-10-28T19:51:23Z INFO tinymist_query::upstream::complete] continue after completing type
[2024-10-28T19:51:23Z INFO sync_lsp] handled textDocument/completion - (2083) in 137.81µs
[2024-10-28T19:51:23Z INFO sync_lsp] handling textDocument/foldingRange - (2084) at Instant { tv_sec: 6171, tv_nsec: 581496710 }
[2024-10-28T19:51:23Z INFO tinymist_query::syntax::lexical_hierarchy] lexical hierarchy analysis took 7.654µs
[2024-10-28T19:51:23Z INFO sync_lsp] handled textDocument/foldingRange - (2084) in 73.59µs
[2024-10-28T19:51:23Z INFO sync_lsp] handling textDocument/codeAction - (2085) at Instant { tv_sec: 6171, tv_nsec: 641366115 }
[2024-10-28T19:51:23Z INFO sync_lsp] handling textDocument/codeLens - (2086) at Instant { tv_sec: 6171, tv_nsec: 641466091 }
[2024-10-28T19:51:23Z INFO sync_lsp] handled textDocument/codeAction - (2085) in 141.87µs
[2024-10-28T19:51:23Z INFO sync_lsp] handled textDocument/codeLens - (2086) in 102.11µs
[2024-10-28T19:51:23Z INFO sync_lsp] handling textDocument/semanticTokens/full/delta - (2087) at Instant { tv_sec: 6171, tv_nsec: 692745671 }
[2024-10-28T19:51:23Z INFO sync_lsp] handled textDocument/semanticTokens/full/delta - (2087) in 72.06µs
[2024-10-28T19:51:23Z INFO sync_lsp] handling textDocument/documentSymbol - (2088) at Instant { tv_sec: 6171, tv_nsec: 747081269 }
[2024-10-28T19:51:23Z INFO tinymist_query::syntax::lexical_hierarchy] lexical hierarchy analysis took 12.924µs
[2024-10-28T19:51:23Z INFO sync_lsp] handled textDocument/documentSymbol - (2088) in 119.25µs
[2024-10-28T19:51:23Z INFO sync_lsp] handling textDocument/documentSymbol - (2089) at Instant { tv_sec: 6171, tv_nsec: 747209948 }
[2024-10-28T19:51:23Z INFO tinymist_query::syntax::lexical_hierarchy] lexical hierarchy analysis took 1.002µs
[2024-10-28T19:51:23Z INFO sync_lsp] handled textDocument/documentSymbol - (2089) in 17.87µs
[2024-10-28T19:51:24Z INFO sync_lsp] handling textDocument/documentColor - (2090) at Instant { tv_sec: 6172, tv_nsec: 384248373 }
[2024-10-28T19:51:24Z INFO sync_lsp] handled textDocument/documentColor - (2090) in 94.74µs
tinymist client log(Help -> Toggle Developer Tools -> Console):
VM59:5763 batch 2 messages
VM59:5784 recv cursor-paths 169
VM59:5817 cursor-paths [Array(4)]
VM59:5784 recv diff-v1 196
VM59:1387 render_in_window with partial rendering enabled window 1.1057513914656771 0 1.1038316256040102 608.1632653061224 605.9517625231911 , patch scale 518
VM59:1251 svg post check cursorPaths [Array(4)]
VM59:997 {kind: 1, index: 0, fingerprint: ''} [Array(3)]
VM59:997 {kind: 0, index: 1, fingerprint: ''} (2) [Array(3), Array(3)]
VM59:1258 svg post check cursorPaths leaf (2) [g.typst-text, 18]
VM59:368 parse 0.00 ms, rerender 1.50 ms, total 1.50 ms
VM59:1830 updateCanvas start
VM59:1870 updateCanvas done 0
Additional context Add any other context about the problem here.
Currently I'm just using "files.autoSave": "afterDelay" with "files.autoSaveDelay": 1 as a workaround and I'm mostly fine with that, but normally I like having e.g. format on save enabled and then only save when I actually want that to apply, so I'd love any help debugging the issue here.
When previewing any typst file in VS Code, the preview changes only on type, even though "tinymist.preview.refresh": "onType" is set.
Hi, I'm not sure if I understand your situation correctly. Do you mean it only changes on save?
Another thing is that your tinymist seems to be outdated: latest --version should look like this:
tinymist
Build Timestamp: 2024-10-19T17:12:03.217404000Z
Build Git Describe: v0.12.0
Commit SHA: 4437b3bffb5f01f06bd64e4e424480ba72a88619
Commit Date: None
Commit Branch: None
Cargo Target Triple: aarch64-apple-darwin
Typst Version: 0.12.0
Typst Source: git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist-v0.12.0#58426a90a7ef721738a01be09793d33e55eb75a9
Yes exactly, it only changes on save. I just updated tinymist to
tinymist
Build Timestamp: 1980-01-01T00:00:00.000000000Z
Build Git Describe: VERGEN_IDEMPOTENT_OUTPUT
Commit SHA: VERGEN_IDEMPOTENT_OUTPUT
Commit Date: None
Commit Branch: None
Cargo Target Triple: x86_64-unknown-linux-gnu
Typst Version: 0.12.0
Typst Source: git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist-v0.12.0#58426a90a7ef721738a01be09793d33e55eb75a9
and the behavior is the same.
Do the things change in new releases?
Hi. On Mac I am having the same issue.
I am using the latest (homebrew) release with typst version 0.13.0
Do the things change in new releases?
I tested everything again with the following version and got the same behavior, is that the version you meant?
> tinymist --version
tinymist
Build Timestamp: 1980-01-01T00:00:00.000000000Z
Build Git Describe: VERGEN_IDEMPOTENT_OUTPUT
Commit SHA: VERGEN_IDEMPOTENT_OUTPUT
Commit Date: None
Commit Branch: None
Cargo Target Triple: x86_64-unknown-linux-gnu
Typst Version: 0.13.0
Typst Source: git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist/v0.13.2#c5347fc5772c436dfb5dc3e43fa3fa088ac54f8e
You could attach the full log (don't truncate it), which contains information about version, updated configuration and preview events. Some people sent me their full log, and I found they misconfigured tinymist.preview.refresh to onSave.
Hi, sorry for the delayed reply, I still experience the same behavior. Attached below you can find the full (tinymist) log.
Interestingly enough, PDF export on type works perfectly. The tinymist configuration seems to show that preview is configured to be onType, but for some reason the PreviewCliArgs have refresh_style: OnSave.
Hi, sorry for the delayed reply, I still experience the same behavior. Attached below you can find the full (tinymist) log.
Interestingly enough, PDF export on type works perfectly. The tinymist configuration seems to show that preview is configured to be
onType, but for some reason thePreviewCliArgshaverefresh_style: OnSave.
Thank you. I haven't looked at it because I'm busy yet, but some valuable information is hopefully included. If I cannot repond before end of this month please ping me again.
If I cannot repond before end of this month please ping me again.
Ping
If I cannot repond before end of this month please ping me again.
Ping
I almost extracted useful info from the log and add a drafted PR, https://github.com/Myriad-Dreamin/tinymist/pull/1807. I will schedule a time to fix it.