Commit graph

1666 commits

Author SHA1 Message Date
Myriad-Dreamin
62ed2c78b9 build: bump assets to 0.14.2-rc1 2025-11-18 02:17:23 +08:00
Myriad-Dreamin
1f3788c77f docs: update changelog 2025-11-18 02:13:27 +08:00
Myriad-Dreamin
2a0a5ab3ae
feat: hot reload compiler respecting typst font, package and library options (#2252)
they were not adding to the `Config::primary_opts` which is used to
detect whther to restart (reconstruct) a compiler.
2025-11-18 01:40:22 +08:00
QuadnucYard
a42700c04b
feat: export tool with page/text preview features (#2182)
Added an editor tool to export and preview documents, with all
configurable options.

Not supported: output path customization (requires changes in server)

<img width="1381" height="1458" alt="image"
src="https://github.com/user-attachments/assets/d27e6e19-bcf4-4d1a-a20e-9bea0258be24"
/>
<img width="1392" height="877" alt="image"
src="https://github.com/user-attachments/assets/53d93601-3e05-4e36-b4fd-26384fda1347"
/>

---------

Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
2025-11-17 21:59:12 +08:00
CGMossa
91d11177ba
fix: typo in helix docs (#2251) 2025-11-17 19:30:49 +08:00
Myriad-Dreamin
f3762eb40a
fix: change typo 'Code Compilation' to 'Cold Compilation' (#2249)
Some checks failed
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
Updated resource usage terminology for clarity.
2025-11-16 09:35:03 +08:00
Myriad-Dreamin
f5db6e8d31
fix: update code and docs about syntax mode (#2248)
which was detected by gemini review.
2025-11-16 09:15:04 +08:00
Myriad-Dreamin
9d5beb196b
feat: minimal viable support for syntax-only mode (#2247)
Configure whether to enable syntax-only mode for the language server. In
syntax-only mode, the language server will only provide syntax checking
and basic code completion, but will not perform full document
compilation or code analysis. This can be useful for improving
performance on low-end devices, devices under power-saving mode, or when
working with large documents.

Default behavior: Always disable syntax-only mode. The strategy may be
changed in the future, for example, automatically enable syntax-only
mode when the system is in power-saving mode.

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-16 08:30:20 +08:00
Hong Jiarong
575b0e301e
fix: destructuring pattern handling in ExprWorker (#2244)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
This PR corrects destructuring handling in `ExprWorker` by switching
`DestructuringItem::Named` to use `named.pattern()` rather than
`named.expr()`. According to ast definition (see `Named::pattern` in
0da0165954/crates/typst-syntax/src/ast.rs (L1418-L1433)
, the rhs of a `Named` pair must be interpreted as a pattern when it
appears inside a destructuring context, not as an expression. This
change ensures nested destructuring patterns are analyzed correctly.
Also, spread items (`..rest`) are normalized into pattern form and
registered as proper declarations.

So that now complex patterns like `#let (x: (used_a, unused_x), y: (c1,
c2, c3)) = (...)` and array spreads like `#let (first, ..rest) = (1, 2,
3)` are allowed to resolve and lint as intended.
2025-11-15 23:41:04 +08:00
Myriad-Dreamin
15100abdde
docs: add editor notes (#2239) 2025-11-15 20:58:53 +08:00
Myriad-Dreamin
06c2240caa
feat: customize paste behaviors in vscode (#2238)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
Close #1830 and close #2063 

The hook script feature is available since `tinymist` v0.14.2.

Hook Scripts allow you to hook and customize certain behaviors of tinymist by providing code snippets that will be executed at specific events.

The hook scripts are run as typst scripts with some predefined variables. Since typst is sandboxed, the hook scripts cannot access system directly. However, you can still bind lsp commands to perform complex operations.

See https://myriad-dreamin.github.io/tinymist/feature/script-hook.html.

- [x] run a demo
- [x] finish tests
- [x] add docs
2025-11-11 20:26:58 +08:00
Myriad-Dreamin
c206933bf5
feat: add PathAt code context query (#2232)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
This is used for custom paste scripts

- by pattern: e.g. `$root`
- by code: e.g. `{ root }`
- on conflict callback: e.g. `{ (dir: root, on-conflict: root + "/" +
random() + ".png") }`
2025-11-11 02:43:02 +08:00
Myriad-Dreamin
c63162959d
feat: group compilation statistics (#2231)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
2025-11-09 08:16:02 +08:00
Myriad-Dreamin
9f8501c42a
fix: specially identify text that is starts with @ (#2233)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
Since typst v0.14, a single `@` are not longer parsed as reference
syntax, because empty reference are not allowed since typst v0.14.
However, the IDE should still handle case where user inputs a single
`@`.
2025-11-09 02:20:10 +08:00
Myriad-Dreamin
052149a509
build: update to macos-14 runner (#2234)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
2025-11-06 19:46:42 +08:00
Myriad-Dreamin
1e761e8f00
feat: merge StatefulRequest and SemanticRequest (#2226)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
This would help:
- compile compiled typst document on demand for analysis.
- remove the concept about `StatefulRequest`
- prepare for introducing stateful code context query (lsp command
`interactCodeContext`).
2025-11-04 22:29:39 +08:00
Myriad-Dreamin
a6adbaa926
feat: add no_pdf_tags, ppi, and more pdf_standard to extra args (#2220)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
- `--no-pdf-tags` to disable tagged PDF
- `--ppi` to specify the PPI (pixels per inch) for PNG export
- `--pdf-standard`: add all rest commonly used PDF standards, which was
introduced in `typst` v0.14.0
2025-11-04 18:23:07 +08:00
Myriad-Dreamin
7c00eba127
feat: introspect and show complation statistics happening in the language server (#1958)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
Adds capability to introspect complations happening in the language
server, to help improve efficiency. I expect most compilations are
caused by tracing for analyzing dynamic expressions, but I haven't
really profiled a document. Then introspection will help confirm or
refute the expectation.
2025-11-03 19:28:42 +08:00
QuadnucYard
f13532964d
feat: update symbol list and preserve definition order (#2217)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
- Updated symbols to the latest. Simplified category map initialization.
- Preserve the definition order of symbols. This is more natural.

There are still issues with symbol rendering and clipping, but that will
not be covered here.

<img width="1255" height="583" alt="image"
src="https://github.com/user-attachments/assets/4bdfdcb6-25b4-4821-85fd-50e945871b32"
/>
<img width="1220" height="409" alt="image"
src="https://github.com/user-attachments/assets/22124806-db58-42d7-b834-96508199fcb5"
/>
2025-11-03 02:13:58 +08:00
odilf
bb5d3f476f
feat: scroll preview with hjkl (#2111)
Closes #2107 

Sorry for not getting confirmation on the issue first, but I had some
free time and thought it would be easy to implement and, indeed, it is
just a few lines of code. I'll attach a video of how it looks.


https://github.com/user-attachments/assets/60e6f7ef-cdff-4f85-a1e8-385058f87966

For the small nudges I think the instant jump is better, even though it
looks kind of janky. The problem with the smooth scroll is that you
can't press it repeatedly and I think that you use `jk` for small
adjustments where it's clear what is being scrolled. However, for the
big hl jumps I think the smooth scroll is better to not disorient you.

Happy to change anything, of course :)

---------

Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
2025-11-02 21:31:35 +08:00
ParaN3xus
70d3443656
feat: replace window global with windowElem in preview web frontend (#2145)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
The preview feature heavily relies on the global `window` object. This
forces the preview to be used only as a standalone page.

In this PR, I replaced `window` with `windowElem` to make the preview
component modular and reusable.

TODO:
- [x] Fix `handleTypstLocation`
- [x] Fix zoon center
- [x] Fix drag
- [ ] Do a comprehensive test
  - [x] `handleTypstLocation` under both canvas mode and SVG mode
  - [ ] other stuff (idk what yet)
2025-11-02 17:34:20 +08:00
Myriad-Dreamin
358301cf6c
build: bump version to 0.14.0 (#2215)
+tag v0.14.0
2025-11-02 16:15:26 +08:00
Myriad-Dreamin
e23530b96e
build: bump version to 0.14.0-rc2 (#2213)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
+tag v0.14.0-rc2
2025-11-02 04:47:10 +08:00
Myriad-Dreamin
00e1c07782
fix: {table,grid}.cell are ignored during HTML export (#2209)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
in typst v0.14. Not sure whether there is some bug since typst v0.14

---------

Co-authored-by: Hong Jiarong <me@jrhim.com>
2025-11-02 01:36:15 +08:00
Myriad-Dreamin
e1edf1e719
feat: clear global timing objects before and after user profiling (#2210) 2025-11-01 23:13:45 +08:00
Myriad-Dreamin
f2a10fec2f
build: bump version to 0.14.0-rc1 (#2189)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
+tag v0.14.0-rc1
2025-10-29 12:22:35 +08:00
Myriad-Dreamin
f6abe0c800
build: bump dependencies (#2206)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
2025-10-29 04:30:38 +08:00
Myriad-Dreamin
6b6a1bdad2
feat: match pdf images for path completion (#2205) 2025-10-29 04:03:26 +08:00
Myriad-Dreamin
f011022097
feat: bump typst to v0.14.0 (#2201)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
Co-authored-by: paran3xus <paran3xus007@gmail.com>
2025-10-28 23:27:31 +08:00
Myriad-Dreamin
a6c39d4306
build: bump version to 0.13.30 (#2198)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
+tag v0.13.30
2025-10-27 18:57:31 +08:00
Hong Jiarong
4bcb4dad40
build: update cmark-writer version to 0.9.0 (#2199)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
2025-10-27 18:06:17 +08:00
Myriad-Dreamin
cba1d34064
build: bump version to 0.13.30-rc2 (#2195)
+tag v0.13.30-rc2
2025-10-27 13:54:11 +08:00
Myriad-Dreamin
8c07fbefe6
build: bump version to 0.13.30-rc1 (#2187)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
+tag v0.13.30-rc1
2025-10-21 22:07:04 +08:00
Myriad-Dreamin
d561ec5f14
build: upgrade apple runner to macos 14 (#2185)
macos-13 will be deprecated
2025-10-21 18:49:22 +08:00
Myriad-Dreamin
5feebb31d2
fix: local registry feature was not enabled (#2186)
There was a typo of the feature and it was never enabled. This was
introduced when compiling tinymist for wasm targets.
2025-10-21 18:35:04 +08:00
Joseph Wilson
850852fc3b
fix: don't ignore user inputs in typlite (#2164)
I noticed that existing inputs specified on the command line such as
`typlite --input key-value ..` are ignored.

Test this as follows:
```zsh
$ echo '#sys.inputs' > test.typ
$ typlite test.typ --input key=value
```
Before this PR:
```zsh
$ cat typ.md
`(x-target: "md")`
```
After this PRL
```zsh
$ cat typ.md
`(key: "value", x-target: "md")`
```

---------

Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
2025-10-21 17:18:01 +08:00
Hong Jiarong
38f6b40ee7
refactor: typlite table parsing and diagnostic (#2181)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
This PR depends on #2180 and should be merged after it.
2025-10-18 22:37:07 +08:00
Myriad-Dreamin
2c198a3d6a
fix: set position_encoding on handshake and fix to utf-16 (#2153)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
Although we don't have enough tests about utf-8 position encoding, i.e.
it is not good to decide to use utf-8, it is completely wrong to not
passing a decided encoding back to client on initialization.

Edit: it doesn't work correctly under utf-8, so we currently always use
utf-16. We may fix it in v0.14
2025-10-17 11:39:20 +08:00
Hong Jiarong
cee5bfa4e6
feat: warning collector and logging for diagnostics in typlite (#2180)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
This PR depends on #2173 and should be merged after it.
2025-10-16 18:18:57 +08:00
Myriad-Dreamin
29a10c144e
fix: import type inference result from other modules (#2168)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
fix #2131
2025-10-15 11:22:39 +08:00
Copilot
d80199d744
docs: improve code comments in expr.rs and RefExpr struct (#2169)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
## Overview

This PR enhances documentation in the expression analysis system to
clarify how goto_definition works and when the `RefExpr` fields are set
versus `None`. This addresses feedback from @BlueQuantumx and @jo3-l who
requested better documentation to understand the expression analysis
flow.

## Problem

The existing documentation was insufficient for developers trying to
understand:
1. How the goto_definition feature works through the expression analysis
system
2. When the `root`, `step`, and `term` fields in `RefExpr` are `Some`
versus `None`
3. The overall flow of expression analysis in `expr_of`

The brief one-line comments didn't provide enough context about the
resolution chain concept or concrete examples of when fields are
populated.

## Changes

### RefExpr Structure Documentation
(`crates/tinymist-analysis/src/syntax/def.rs`)

Added comprehensive documentation including:
- Explanation of the resolution chain concept: `root` -> `step` ->
`decl`
- Three concrete examples showing different use cases:
  - Simple identifier reference (`let y = x`)
  - Module field access (`mod.field`)
  - Import with rename (`import: old as new`)
- Detailed field documentation explaining when each is set:
- `step`: Set for imports, field access, chained references, renamed
imports
- `root`: Set for module imports, field selection, propagated in chains
- `term`: Set when type inference succeeds, `None` when type unknown or
deferred

### Expression Analysis Documentation
(`crates/tinymist-query/src/syntax/expr.rs`)

Enhanced `expr_of` function documentation to explain:
- Two-pass analysis architecture (init_stage for forward references,
then full resolution)
- How it builds the resolves map that powers goto_definition
- Caching strategy based on source content and import hashes

Added detailed documentation for helper functions:
- `resolve_ident_`: Resolution process and reference chain building
- `eval_ident`: Lexical scope lookup order and type availability
- `extract_ref`: Reference chain propagation mechanism

Added inline comments at all RefExpr creation sites explaining the
context and field values for:
- Module imports
- Import/include paths
- Named imports with rename
- Module field selection

## Example

**Before:** The RefExpr struct had minimal documentation
```rust
/// The intermediate step in resolution (if any).
pub step: Option<Expr>,
```

**After:** Clear explanation of when the field is set
```rust
/// The intermediate expression in the resolution chain.
///
/// Set in the following cases:
/// - **Import/include**: The module expression being imported
/// - **Field access**: The selected field's expression
/// - **Chained references**: When an identifier resolves to another reference
/// - **Renamed imports**: The original name before renaming
///
/// `None` when the identifier is a direct definition (not a reference).
pub step: Option<Expr>,
```

## Testing

-  All core tests pass (expr module, tinymist-analysis package)
-  Clippy passes with no warnings
-  Build succeeds
-  Code formatted with `yarn fmt`

Note: Package-related test failures (cetz, fletcher, tidy, touying,
import_package) are expected in environments without network access per
project guidelines.

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `packages.typst.org`
> - Triggering command:
`/home/REDACTED/work/tinymist/tinymist/target/debug/deps/tinymist_query-1cacdd437723df09
--skip=e2e` (dns block)
> - Triggering command:
`/home/REDACTED/work/tinymist/tinymist/target/debug/deps/tinymist_query-1cacdd437723df09
goto_definition::tests::test --exact` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/Myriad-Dreamin/tinymist/settings/copilot/coding_agent)
(admins only)
>
> </details>

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Improve code comments in expr.rs</issue_title>
> <issue_description>> I'd like to push this forward, but I need some
tips/docs about how the goto_definition works. I've walked through `fn
def_of_syntax_or_dyn`, `fn definition` ... and finally focused on
`crates/tinymist-query/src/syntax/expr.rs -> fn expr_of`. Maybe there
could have some concise code comments?
> 
> _Originally posted by @BlueQuantumx in
[#1960](https://github.com/Myriad-Dreamin/tinymist/issues/1960#issuecomment-3294723078)_
> 
> > I read those comments when I was originally writing the code, but
I'm mainly interested in when `type` and `root` are set (or, conversely,
when they are `None`.) The comments don't really go into that detail
AFAICS?
> 
> _Originally posted by @jo3-l in
https://github.com/Myriad-Dreamin/tinymist/pull/2065#discussion_r2315906981_</issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>

Fixes Myriad-Dreamin/tinymist#2122

<!-- START COPILOT CODING AGENT TIPS -->
---

 Let Copilot coding agent [set things up for
you](https://github.com/Myriad-Dreamin/tinymist/issues/new?title=+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Myriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com>
Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
2025-10-14 21:51:24 +08:00
Hong Jiarong
baca369c29
fix: fallback for tables with block-level cells (#2173)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
fix https://github.com/Myriad-Dreamin/tinymist/issues/1845

Fallback for tables with block-level cells now converts the Typst
`HtmlElement` tree into a `cmark_writer::ast::Node::HtmlElement` and
lets `HtmlWriter` render it.

---------

Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
2025-10-14 12:00:43 +08:00
QuadnucYard
bcd6af975e
feat: multi-page export and no-write support (#2098)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
## Features

- Support multi-page export in the server export command. Added an extra
arg to decide whether to write to the file or only return data for
client use (page preview in exporter). VSCode users can use this feature
via the quick-export command or code lens.
- (refactor) Move most export logic from tinymist to tinymist-task,
excluding typlite-related, which already depends on tinymist-task.
- Added relevant export tests. The export e2e test now includes hash
checking for all targets.

## Not done

- Support new args in `TypstExtraArgs` for CLI compilation.

---------

Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
2025-10-13 23:02:44 +08:00
Hong Jiarong
1ca1d82901
fix: render figure images during docx export (#2175)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
fix https://github.com/Myriad-Dreamin/tinymist/issues/2104
2025-10-13 02:56:17 +08:00
Hong Jiarong
80ae0e5277
fix: update VerbatimNode to use trusted HTML writing method (#2178)
So that
515747c0b7
pass the test.
2025-10-13 01:18:55 +08:00
Hong Jiarong
515747c0b7
fix: enable HTML rendering for VerbatimNode and add regression test (#2172)
fix https://github.com/Myriad-Dreamin/tinymist/issues/1844
2025-10-12 22:55:01 +08:00
Hong Jiarong
8a28ff4afc
chore: switch cmark-writer dependency to local path (#2171)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
Further fix and refactor may base on this pr.

also refactor: centralize CommonMark spacing and fix inline custom node
handling

- add `FormatPolicy` to manage trailing newline / blank-line rules and
expose prepare_block_sequence
- route document, blockquote, and list content through the policy so
nested blocks get consistent spacing
- adjust `Node::is_block` / `is_inline` to respect
`CustomNode::is_block`, preventing inline custom nodes from forcing HTML
fallbacks
- ensure table rendering stays in Markdown by recognizing inline custom
cells correctly

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-10-12 15:50:19 +08:00
Luyan Zhou
6876a38c99
fix: re-correct order of scope merging & make test stronger (#2166)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
Sadly the #2154 is still false. This PR fixed it and made test stronger.
2025-10-11 02:58:29 +08:00
Myriad-Dreamin
42e3a3eb73
fix: bad refactor in "fix: invalidate cached snapshot after compile" (#2165)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
fix #2163, partially reverts Myriad-Dreamin/tinymist#2057 @jo3-l

---------

Co-authored-by: Joseph Liu <jo3.l.dev@outlook.com>
2025-10-11 02:19:39 +08:00
Luyan Zhou
9961cc9b69
dev: update build scripts to use correct cargo dev profile (#2157)
The `debug` profile is deprecated and reserved. We should use `dev`
profile instead.
2025-10-11 01:34:53 +08:00