How can i make tinymist auto compile a pdf of a file when one of its included files is changed?

Hello,
I’m using VSC with Tinymist and I have this weird bug that whenever I have a file (say chapter.typ) that is being included in another file (say main.typ), if the chapter file is being updated the main file doesn’t recompile.

If i use typst watch main.typ it does recompile when changing the chpater file.

Do you know how to make tinymist recompile wihout having to use the watch command in the terminal?

You have to pin your main.typ file. In VSC open your main.typ then in the menu go to: View → Command Palette… (or ctrl+shift+p), type “Pin” and select “Typst: Pin the Main File to the Currently Open Document”.

I recommend using the build in Tinymist Preview feature, it is faster and this works by default.

1 Like

Thank you that works.
My problem with the built in preview is that is very slow.
Whenever i use it my whole laptop starts freezing and even scrolling and typing starts taking way too much time.

I’m running a lenovo ideapad slim 3i (if it matters)

If compiling with Typst CLI also causes the OS freeze, then it’s probably because the hardware is old?

Another common problem, at least on some Linux setups, is that the OOM killer doesn’t work correctly, and therefore the process that uses a lot of RAM just starves the OS and all other processes don’t have enough RAM to operate normally. Some documents can use 1+ GiB of RAM. Incremental compilations and especially Tinymist LSP server can eat even more. I think I saw not that long ago that Tinymist was using 5+ GiB. Without OOM killer or static/dynamic swap, you can permanently freeze your machine. Happens a lot if you compile with Rust, etc.

You can also use a clean installation of VSCodium, only install Tinymist and see if it improves thing. If the issue is with the editor… use another editor.

I’m using a two year old laptop with pretty good hardware (16GM RAM and i5-13420H cpu) so i dont think the problem the hardware.

I also use windows so i dont think the second option applies to me.

I’ll check out VSCodium, thanks for the suggestion.

After checking VSCodium i found that it starts slowing down too once i start the preview option.

@Michael_Ronin @Andrew, I can confirm on a similar setup that tinymist preview does affect significantly the input speed. I don’t know the reason specifically. Note that I don’t have dedicated graphics, so it might be that, idk.

1 Like

Does typst preview rely heavily on GPU?
I tried running it on a similarly speced pc but with dedicated graphics (RTX 3060TI) and it ran smoothly.

I don’t remember anything about hardware acceleration, so probably only CPU. The only issue I see is that the project is too big or has something that is an edge case for Tinymist. Small multi-file project should just work. Another thing is to restart the machine. That’s all from me.