Commit graph

1633 commits

Author SHA1 Message Date
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
Myriad-Dreamin
9ab2ecdc4d
fix: ignore non-typst files to focus implicitly (#2152)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / build (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 / announce (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
When a file, for example a rust source file, is sent to the language
server by `didOpen`, it is implicitly focused and starts a typst
compilation with the file. However, this is not expected. The error is
rarely triggered because vscode extension also explicitly send focus
events which prevents the implicit focus happens. So in conclusion this
bug was triggered stably by following steps:
- activate tinymist for some reason, and no typst source file is opened.
- open a rust source file and tinymist reports typst syntax error in the
file.
2025-10-10 12:04:19 +08:00
Luyan Zhou
a03d715fa7
fix: correct scope merging order (#2154)
fixed #1960 and added test case.
2025-10-10 10:18:25 +08:00
Luyan Zhou
8ce498751b
fix: update tinymist-project features to include 'system' (#2156)
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 missing feature causes build failure with test profile. Since we
currently only conduct tests locally(without web), this change should
not be bad.
2025-10-10 08:28:12 +08:00
ParaN3xus
b239224a63
feat: add js package registry support for tinymist-wasm (#2102)
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
Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
2025-10-01 16:40:21 +08:00
Myriad-Dreamin
c8e723fac7
feat: test and lower glibc version requirement (#2143)
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
Lock Linux to minimum supported version (Ubuntu 18.04 / RHEL 8, glibc
2.28).
2025-09-30 16:48:41 +08:00
Myriad-Dreamin
d617b145e2
feat: support offline definition queries (LSIF) (#2032)
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 purpose of the [Language Server Index Format (LSIF)][LSIF] is to
define a standard format for language servers or other programming tools
to dump their knowledge about a workspace.

Use cases:
- providing stable json format of package docs:
  - The unstable export was supported in #1809
- cache analyze results in such format.
- if we export typst docs to LSIF, some tools can help read typst code,
such as [lsif-node](https://github.com/Microsoft/lsif-node)
- if we have a typst package helping render typst docs according to
LSIF, it can also be used to render docs for other programming
languages, for example [OCaml](https://github.com/rvantonder/lsif-ocaml)
and [TypeScript](https://github.com/sourcegraph/lsif-node)

LSIF is not the only index format, so we may reconsider to use other one
in future, such as [SCIP](https://sourcegraph.com/blog/announcing-scip)


[LSIF]:
https://microsoft.github.io/language-server-protocol/specifications/lsif/0.6.0/specification/
2025-09-29 23:19:49 +08:00
Myriad-Dreamin
a4d256d75b
build: bump version to 0.13.28 (#2140)
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.28
2025-09-29 01:32:00 +08:00
Myriad-Dreamin
326c54ec75
build: bump version to 0.13.28-rc2 (#2139)
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.28-rc2
2025-09-27 20:23:51 +08:00
Myriad-Dreamin
53488dad22
fix: remove Clone trait bounds from diagnostics iterators (#2136)
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 requires new release of world crates, while we didn't plan it.
2025-09-27 17:02:06 +08:00
Myriad-Dreamin
d2a747372f
feat: add install vscode command (#2135)
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-09-27 11:46:20 +08:00
Myriad-Dreamin
34bc516466
build: bump version to 0.13.28-rc1 (#2134)
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.28-rc1
2025-09-26 15:58:50 +08:00
Joseph Liu
6b52aa70ba
feat: new lint warning for unknown math vars (#2065)
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
Add a lint warning for unknown math variables[^1], powered by Tinymist's
existing reference analysis. This allows users to see all such undefined
variables at once if they have the linter enabled, instead of just the
first error from the compiler. The autofix from #2062 is also applicable
to these warnings.

Example:
![example of new warning in VS
Code](https://github.com/user-attachments/assets/42672d50-e637-49b2-907b-aa413431e55e)
(The first error is pre-existing and emitted by the Typst compiler; the
second warning is new from this PR and emitted by us.)

Implementation notes:
- The generated diagnostic tries to closely match the corresponding
Typst compiler error, with one deliberate change: to differentiate the
Tinymist warning and the compiler error, we use the message `potentially
unknown variable: ...` instead of `unknown variable: ...`. I am not the
biggest fan of this choice, but I think it is very important that users
don't blame the Typst compiler for warnings that we generate; changing
the message so that it isn't an exact clone is the best way I thought of
for now.
- We avoid duplicating a warning if the compiler has already generated
an error for a given identifier by computing a set of `KnownLintIssues`
from the compiler diagnostics and threading this information through the
lint routines.

[^1]: If users like this warning, we can extend it later to apply to
undefined variables outside of math as well.

---------

Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
2025-09-24 01:09:10 +08:00
ParaN3xus
3b6de80a2f
fix: correct parent_last_loc for heading children in folding ranges (#2123)
This PR fixes #1796 by correcting the parent_last_loc parameter passed
to child elements when processing heading folding ranges.

This is because heading's `lsp_range` only covers the line it is on, but
it has children. This causes the `parent_last_loc` passed when
recursively calling the `calc_folding_range` function to be incorrect:
it is expected to be the end of the line before the next sibling
heading, but actually it is the end of the current heading's line. This
further prevents the correction of the heading's `folding_range` from
working properly, ultimately causing the returned `folding_range` to
retain the original `lsp_range`, which is just the heading line itself.

The fix uses the already-calculated `folding_range.end_line` for
headings when determining the `parent_last_loc` for child elements,
ensuring consistency between the parent's actual folding boundary and
the boundary passed to its children.
2025-09-24 00:24:31 +08:00
ParaN3xus
5ac358ef6a
ci: update toml-edit-js (#2125)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (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::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
New version of `toml-edit-js` fixes
https://github.com/rainbowatcher/toml-edit-js/issues/8, which will keep
comments in our `Cargo.toml`.
2025-09-22 01:52:14 +08:00
Luyan Zhou
51f9cdec81
refactor: refine get_ident method by unwrapping unnecessary Option (#2117)
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-09-14 18:28:33 +08:00
Luyan Zhou
45100d6d16
fix: correct the lexical hierarchy of comment group (#2116)
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
Hierarchy of comment group is always wrong previously, causing #2021.

This PR fixed it and added a test case.

BTW, the changes in the lexical hierarchy module influenced a folding
range test case, but it's just changed the order of items, which doesn't
affect the correctness (the order is even more correct).
2025-09-14 09:49:13 +08:00
Allan Chain
22089e5e27
fix: extend origin check for vscode servers (#2106)
Previously, Tinymist preview does not work on VS Code web (code-server)
because it tries to connect to the `localhost`, which is impossible
since we are doing remote development.

Even if we fix this error, the HTTP origin check will also fail because
the domain of our VS Code web is not trusted by Tinymist. One possible
fix is to grab the `VSCODE_PROXY_URI` environment variable and check if
the incoming request matches the URI. This will fix the issue for most
standard code-server installations.

However, GitHub Codespace is an exception. I did some logging, and found
that GitHub Codespace used different origins:
- `<random>.assets.github.dev`
- `https://localhost:<port>` (note HTTP**S**)
- `None`

This is very weird and difficult to debug. Moreover, the ports forwarded
by GitHub Codespaces require authentication before visiting, which the
VS Code webview does not support. One have to open the URL in another
browser tab to authenticate. This is frustrating and is difficult to
workaround. Therefore, currently, GitHub Codespaces are not supported.

(I asked LLM to generate some of the Rust code. It works, but may need
improvements.)

Fixes #625
2025-09-14 08:08:30 +08:00
Myriad-Dreamin
3bc77f06bf
build: bump version to 0.13.26 (#2119)
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.26
2025-09-13 10:52:34 +08:00
Myriad-Dreamin
8be6a12256
dev: remove useless glibc version overrides (#2118)
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
#2115
2025-09-13 02:57:51 +08:00
Myriad-Dreamin
ab20cfc988
feat: update global runner configuration to ubuntu 22.04 (#2115)
min-glibc-version is only used for detecting in the installer script,
i.e. not useful to limit a minimal glibc version. A global runner is
needed to be specified for running with older glibc.
2025-09-13 00:32:09 +08:00
Myriad-Dreamin
916a5cea7d
build: update readme docs (#2114)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / build (push) Blocked by required conditions
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::gh_pages / build-gh-pages (push) Waiting to run
2025-09-12 00:50:56 +08:00
Myriad-Dreamin
3324b12620
fix: update CI badge link in documentation (#2113)
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
2025-09-11 07:47:39 +08:00
Myriad-Dreamin
f74c104b9c
docs: add badgers (#2112) 2025-09-11 07:33:37 +08:00
QuadnucYard
4c8d34cdb2
feat: generate resource symbol svg in server and improve viewBox (#2109)
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
- feat: move symbol svg generation logic from client to client, and
directly display svg elements instead of mask-image. This significantly
boosts loading speed.
- fix: use font ascender and descender to bound view box, avoid
clipping.
2025-09-10 19:17:06 +08:00
Myriad-Dreamin
6799951ee3
build: bump version to 0.13.26-rc1 (#2108)
+tag v0.13.26-rc1
2025-09-10 18:06:22 +08:00
QuadnucYard
4ebdd906c2
feat: revamp symbol view and add optional details (#2101)
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
- Restructured files.
- Render non-printable symbols, following typst documentation's
convention.
- Add a toggle to show details: symbol name and unicode, both of which
can be copied to clipboard on click.
- Make detypify import async, so that it will not block symbol
rendering.
- Show detypify canvas only when available.

<img width="1289" height="421" alt="image"
src="https://github.com/user-attachments/assets/ed6469c4-57a0-4d17-a4be-206875a03e43"
/>

<img width="1238" height="632" alt="image"
src="https://github.com/user-attachments/assets/e6bba758-7836-4230-9ab9-f9550454b4de"
/>

---------

Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
2025-09-10 11:27:44 +08:00
Copilot
a1be6a6824
feat: add missing server info (#2093)
- [x] Explore repository structure and understand current LSP
initialization
- [x] Locate server info collection logic in ServerState
- [x] Understand the InitializeResult structure and identify server_info
field
- [x] Add server_info field to InitializeResult with name and version
- [x] Extract version information from Cargo.toml
- [x] Update e2e test redaction logic to handle server_info fields
- [x] Test the implementation with LSP clients

Fixes #2092.

<!-- 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-09-10 11:09:54 +08:00
Myriad-Dreamin
ef08eaa93b
feat: enhance CLI and argument documentation (#2072)
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 improves the help message of the CLL. Also, we change the verbs
in the help message from plural (e.g. `compiles`) to singular (e.g.
`compile`). This matches the style of `clap-rs`.

Added tests about critical help messages.
2025-09-03 17:02:42 +08:00
hyrious
c7b10d1b6c
feat: preview page remove extra space and do not invert background (#2094)
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
| Before | After |
| ------ | ----- |
| <img width="300" height="246" alt="image"
src="https://github.com/user-attachments/assets/3f1e9d69-390c-46ce-8469-52d90c052fed"
/> | <img width="303" height="243" alt="image"
src="https://github.com/user-attachments/assets/4b70a9d2-07c6-496e-82df-d0ad27bd582e"
/> |

1. The `svg` element by default has `display: inline`, which adds extra
space at bottom (line height), change that to `block` can remove the
space.
2. The `svg` element and its outer `div` both set background color,
which will be inverted to another color that are not equal to the whole
page's background (I was setting `--main-margin` to see the outside).
This PR prevents the background from getting inverted.

There's another tiny thing: `#typst-container.mode-doc` has `margin-top:
-1px` which shifts the whole Typst doc 1px up. That will cause the page
always has 1px margin at bottom because the SVG element has the full
height. One possible fix is to always `- 1px` on the SVG `height`
attribute but I'm not sure if this affects some calculation. So I'm not
adding this trivial change.
2025-09-02 12:55:12 +08:00
Myriad-Dreamin
6e386e2838
feat: use card/button styles from vscode themes (#2100) 2025-09-02 11:10:43 +08:00
QuadnucYard
8d4052e612
feat: revamp font view with more features and better styles (#2060)
## Features

- Added font filters.
- Greatly improved styles. Now it follows the VSCode theme.
- Added tailwindcss-like utility classes.

<img width="713" height="941" alt="3H L7HDJOZ`X(UJU)L2PEYS"
src="https://github.com/user-attachments/assets/2a239bde-e01e-497c-803e-3d1c958319b6"
/>
2025-09-02 10:02:32 +08:00
Myriad-Dreamin
985c0c16b8
fix: build script for editor tools (#2099) 2025-09-02 09:14:50 +08:00
QuadnucYard
ce447185d1
dev: drop if_chain and collapse if statements (#2097)
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-09-01 16:46:54 +08:00