Enter-tainer / typst-preview

[DEPRECATED] Use tinymist instead
https://Enter-tainer.github.io/typst-preview/
MIT License
450 stars 21 forks source link

Recompilation is triggered on every keystroke in irrelevant file #199

Open Enivex opened 9 months ago

Enivex commented 9 months ago

Describe the bug See title

To Reproduce

  1. Open a folder in VS code, containing a typ file and another file not involved in the typst document at all
  2. Preview the typ file
  3. Any keystroke in the other file will trigger recompilation of the typst preview

Expected behavior Recompilation should only be triggered if the file is somehow included in the typst document. This is the behavior I see with typst watch.

Package/Software version:

VSCode version(Help -> About):

Version: 1.85.0 (user setup)
Commit: af28b32d7e553898b2a91af498b1fb666fdebe0c
Date: 2023-12-06T20:48:09.019Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22635

typst-preview extension version: v0.10.0

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

[2023-12-12T12:48:16Z DEBUG typst_preview::actor::editor] EditorActor: received message from editor: UpdateMemoryFiles ["REDACTED\numerics\\periodic.py"]
[2023-12-12T12:48:16Z DEBUG typst_preview::actor::typst] TypstActor: processing UPDATE memory files: ["REDACTED\\numerics\\periodic.py"]

(The typ file is in the REDACTED folder, and I'm editing a py file in a subfolder)

7sDream commented 4 months ago

I think this is caused by #166, and it's an expected behavior.

You can see more context in issue #164, in which we discussed why this temporary solution was chosen.


Oh, I see it's an update memory file message, not a sync preview. Therefore, it's not relevant to the issue or PR mentioned above. However, the underlying reason behind them seems to be the same?