Enter-tainer / typst-preview

[DEPRECATED] Use tinymist instead

Home Page:https://Enter-tainer.github.io/typst-preview/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

the newest version doesn't preview

VadimBim opened this issue · comments

Hi ! I am writing my master thesis using vscode and preview extension. The preview extension v0.10.8 works fine, but the latest v0.10.10 gives this error:

typst-preview server log(Output Panel -> typst-preview):

[2024-03-15T08:52:28Z INFO  typst_preview] Arguments: CliArguments {
        preview: PreviewArgs {
            data_plane_host: "127.0.0.1:0",
            control_plane_host: "127.0.0.1:0",
            enable_partial_rendering: true,
            invert_colors: "never",
        },
        preview_mode: Document,
        static_file_host: "127.0.0.1:0",
        dont_open_in_browser: true,
        font_paths: [],
        root: Some(
            "/home/vadim/Development/thesis-template-typst",
        ),
        input: "/home/vadim/Development/thesis-template-typst/thesis.typ",
    }
[2024-03-15T08:52:28Z INFO  typst_preview] Previewer: typst actor spawned
[2024-03-15T08:52:28Z DEBUG typst_preview::actor::typst] TypstActor: waiting for message
[2024-03-15T08:52:28Z INFO  typst_preview] Control plane server listening on: 127.0.0.1:42193
[2024-03-15T08:52:28Z INFO  typst_preview] Data plane server listening on: 127.0.0.1:44095
[2024-03-15T08:52:28Z DEBUG typst_ts_compiler::service::watch] start watching files...
[2024-03-15T08:52:28Z DEBUG typst_ts_compiler::service::compile] CompileActor: initialized
[2024-03-15T08:52:28Z DEBUG typst_ts_compiler::service::compile] CompileActor: fs event incoming None
[2024-03-15T08:52:28Z INFO  typst_ts_compiler::service::diag::console] /thesis.typ: compiling ...
    
[2024-03-15T08:52:28Z INFO  typst_preview] Static file server listening on: 127.0.0.1:42177
[2024-03-15T08:52:28Z INFO  typst_preview] Peer address: 127.0.0.1:48604
[2024-03-15T08:52:28Z INFO  typst_preview] New WebSocket connection: 127.0.0.1:48604
[2024-03-15T08:52:28Z DEBUG typst_preview::actor::editor] EditorActor: received message from editor: SyncMemoryFiles []
[2024-03-15T08:52:28Z DEBUG typst_preview::actor::typst] TypstActor: processing SYNC memory files: []
[2024-03-15T08:52:28Z INFO  typst_ts_compiler::service::diag::console] /thesis.typ: Compilation failed after 39.847359ms
    
error: document set rules must appear before any content
  ┌─ /home/vadim/Development/thesis-template-typst/thesis_typ/disclaimer.typ:7:2
  │
7 │   set document(title: title, author: author)  
  │   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[2024-03-15T08:52:28Z DEBUG typst_ts_compiler::service::compile] CompileActor: memory event incoming
[2024-03-15T08:52:28Z INFO  typst_ts_compiler::service::diag::console] /thesis.typ: compiling ...
    
[2024-03-15T08:52:28Z INFO  typst_ts_compiler::service::diag::console] /thesis.typ: Compilation failed after 1.124062ms
    
error: document set rules must appear before any content
  ┌─ /home/vadim/Development/thesis-template-typst/thesis_typ/disclaimer.typ:7:2
  │
7 │   set document(title: title, author: author)  
  │   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[2024-03-15T08:52:28Z DEBUG typst_ts_compiler::service::compile] CompileActor: fs event incoming Some(Update(FileChangeSet { removes: [], inserts: [("/home/vadim/Development/thesis-template-typst/thesis.typ", FileSnapshot { mtime: SystemTime { tv_sec: 1710488746, tv_nsec: 637273249 }, content: FileContent { len: 15322 } }), ("/home/vadim/Development/thesis-template-typst/thesis_template.typ", FileSnapshot { mtime: SystemTime { tv_sec: 1710413325, tv_nsec: 481753237 }, content: FileContent { len: 2409 } }), ("/home/vadim/Development/thesis-template-typst/common/titlepage.typ", FileSnapshot { mtime: SystemTime { tv_sec: 1709551576, tv_nsec: 197967753 }, content: FileContent { len: 1292 } }), ("/home/vadim/Development/thesis-template-typst/thesis_typ/disclaimer.typ", FileSnapshot { mtime: SystemTime { tv_sec: 1709541291, tv_nsec: 619120375 }, content: FileContent { len: 759 } }), ("/home/vadim/Development/thesis-template-typst/thesis_typ/acknowledgement.typ", FileSnapshot { mtime: SystemTime { tv_sec: 1709541246, tv_nsec: 150354332 }, content: FileContent { len: 455 } }), ("/home/vadim/Development/thesis-template-typst/thesis_typ/abstract_en.typ", FileSnapshot { mtime: SystemTime { tv_sec: 1709541246, tv_nsec: 150354332 }, content: FileContent { len: 840 } }), ("/home/vadim/Development/thesis-template-typst/common/metadata.typ", FileSnapshot { mtime: SystemTime { tv_sec: 1709541291, tv_nsec: 611120236 }, content: FileContent { len: 256 } }), ("/home/vadim/.cache/typst/packages/preview/lovelace/0.2.0/typst.toml", FileSnapshot { mtime: SystemTime { tv_sec: 1709472324, tv_nsec: 0 }, content: FileContent { len: 451 } }), ("/home/vadim/.cache/typst/packages/preview/lovelace/0.2.0/lib.typ", FileSnapshot { mtime: SystemTime { tv_sec: 1709472324, tv_nsec: 0 }, content: FileContent { len: 6267 } }), ("/home/vadim/Development/thesis-template-typst/figures/antet_L.JPG", FileSnapshot { mtime: SystemTime { tv_sec: 1709541291, tv_nsec: 615120305 }, content: FileContent { len: 120590 } }), ("/home/vadim/Development/thesis-template-typst/figures/eli_ifin_logo.jpeg", FileSnapshot { mtime: SystemTime { tv_sec: 1689061108, tv_nsec: 454451743 }, content: FileContent { len: 7541 } }), ("/home/vadim/Development/thesis-template-typst/figures/marginalization.png", FileSnapshot { mtime: SystemTime { tv_sec: 1709807676, tv_nsec: 825853936 }, content: FileContent { len: 24533 } }), ("/home/vadim/Development/thesis-template-typst/figures/samples_1_1.png", FileSnapshot { mtime: SystemTime { tv_sec: 1710165710, tv_nsec: 288300715 }, content: FileContent { len: 106799 } }), ("/home/vadim/Development/thesis-template-typst/figures/samples_1,4_0,2.png", FileSnapshot { mtime: SystemTime { tv_sec: 1710165862, tv_nsec: 685864997 }, content: FileContent { len: 145453 } }), ("/home/vadim/Development/thesis-template-typst/figures/se_times_linear.png", FileSnapshot { mtime: SystemTime { tv_sec: 1710231973, tv_nsec: 173389357 }, content: FileContent { len: 85407 } }), ("/home/vadim/Development/thesis-template-typst/figures/acq_funcs.jpg", FileSnapshot { mtime: SystemTime { tv_sec: 1709635082, tv_nsec: 579594675 }, content: FileContent { len: 818657 } }), ("/home/vadim/Development/thesis-template-typst/figures/expected_improvement_mc.png", FileSnapshot { mtime: SystemTime { tv_sec: 1710416837, tv_nsec: 293984243 }, content: FileContent { len: 117703 } }), ("/home/vadim/Development/thesis-template-typst/thesis_typ/appendix.typ", FileSnapshot { mtime: SystemTime { tv_sec: 1710486130, tv_nsec: 184375085 }, content: FileContent { len: 1892 } }), ("/home/vadim/Development/thesis-template-typst/thesis.bib", FileSnapshot { mtime: SystemTime { tv_sec: 1710418896, tv_nsec: 72288164 }, content: FileContent { len: 3943 } })] }))
[2024-03-15T08:52:28Z INFO  typst_ts_compiler::service::diag::console] /thesis.typ: compiling ...
    
[2024-03-15T08:52:28Z INFO  typst_ts_compiler::service::diag::console] /thesis.typ: Compilation failed after 519.584µs
    
error: document set rules must appear before any content
  ┌─ /home/vadim/Development/thesis-template-typst/thesis_typ/disclaimer.typ:7:2
  │
7 │   set document(title: title, author: author)  
  │   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[2024-03-15T08:52:30Z INFO  typst_preview] Peer address: 127.0.0.1:59346
[2024-03-15T08:52:30Z INFO  typst_preview] New WebSocket connection: 127.0.0.1:59346
[2024-03-15T08:52:30Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message
[2024-03-15T08:52:30Z DEBUG typst_preview::actor::render] RenderActor: waiting for message
[2024-03-15T08:52:30Z DEBUG typst_preview::actor::render] RenderActor: has_full_render: true
[2024-03-15T08:52:30Z DEBUG typst_preview::actor::render] OutlineRenderActor: received message: RenderFullLatest
[2024-03-15T08:52:30Z INFO  typst_preview::actor::render] OutlineRenderActor: document is not ready
[2024-03-15T08:52:30Z INFO  typst_preview::actor::render] RenderActor: document is not ready
[2024-03-15T08:52:30Z DEBUG typst_preview::actor::render] RenderActor: waiting for message
[2024-03-15T08:52:30Z DEBUG typst_preview::actor::render] OutlineRenderActor: waiting for message

typst-preview client log(Help -> Toggle Developer Tools -> Console):

INFO Started local extension host with pid 18197.
3log.ts:427  WARN Overlapping semantic tokens detected at lineNumber 39, column 1
log.ts:417  INFO [perf] Render performance baseline is 206ms
log.ts:427  WARN Overlapping semantic tokens detected at lineNumber 39, column 1
console.ts:137 [Extension Host] watch editor changes
console.ts:137 [Extension Host] getCliPath resolving /home/vadim/.vscode/extensions/mgt19937.typst-preview-0.10.10-linux-x64/out/typst-preview 
console.ts:137 [Extension Host] Watching /home/vadim/Development/thesis-template-typst/thesis.typ for changes
console.ts:137 [Extension Host] [2024-03-15T08:52:28Z INFO  typst_preview] Previewer: typst actor spawned
[2024-03-15T08:52:28Z DEBUG typst_preview::actor::typst] TypstActor: waiting for message
[2024-03-15T08:52:28Z INFO  typst_preview] Control plane server listening on: 127.0.0.1:42193
[2024-03-15T08:52:28Z INFO  typst_preview] Data plane server listening on: 127.0.0.1:44095
[2024-03-15T08:52:28Z DEBUG typst_ts_compiler::service::watch] start watching files...

console.ts:137 [Extension Host] [2024-03-15T08:52:28Z INFO  typst_preview] Static file server listening on: 127.0.0.1:42177

console.ts:137 [Extension Host] Launched server, data plane port:44095, control plane port:42193, static file port:42177
webviewElement.ts:511 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
mountTo @ webviewElement.ts:511
console.ts:137 [Extension Host] recv syncEditorChanges request
console.ts:137 [Extension Host] killed preview services
console.ts:137 [Extension Host] child process exited with code null

Package/Software version:

VSCode version(Help -> About):

Version: 1.87.2
Commit: 863d2581ecda6849923a2118d93a088b0745d9d6
Date: 2024-03-08T15:14:59.643Z
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Linux x64 6.5.0-21-generic

You may stay at 0.10.8. 0.10.9 and 0.10.10 updates to typst 0.11.0-rc1 and there are a lot of breaking changes. You may see full changelog here: https://staging.typst.app/docs/changelog/

But what's interesting is that https://github.com/typst/typst/blame/23ec13718f0a56bad72db3ae48af552c9ae0a098/crates/typst/src/realize/mod.rs#L210 comes from 1 year ago. I guess you've found a regression in typst 0.11.0-rc1? I suggest you make a MWE and submit a issue in typst/typst repo. They currently fix regression bugs at a very high priority.

thesis-template-typst on ub-refactor
❯ ~/Downloads/typst-aarch64-apple-darwin/typst compile ./thesis.typ
error: document set rules must appear before any content
  ┌─ thesis_typ/disclaimer.typ:7:2
  │
7 │   set document(title: title, author: author)
  │   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I can confirm this also happens with official cli