I have added character counter to the vscode status bar with
`const formatString = statusBarFormatString()
.replace(/\{wordCount\}/g, `${words} ${plural("Word", words)}`)
.replace(/\{charCount\}/g, `${chars} ${plural("Character", chars)}`)
.replace(/\{pageCount\}/g, `${pages} ${plural("Page", pages)}`)
.replace(/\{fileName\}/g, fileNameWithoutExt);
`
in editors/vscode/src/ui-extends.ts, and modified
`en = "Set format string of the server status. For example,
`{compileStatusIcon}{wordCount} [{fileName}]` will format the status as
`$(check) 123 words [main]`. Valid placeholders are:\n\n-
`{compileStatusIcon}`: Icon indicating the compile status\n-
`{wordCount}`: Number of words in the document\n`{charCount}`: Number of
characters in the document\n- `{fileName}`: Name of the file being
compiled\n\nNote: The status bar will be hidden if the format string is
empty."
`
in locales/tinymist-vscode.toml
This small change should make the option charCount possible for the
statusbar in vscode requested in
https://github.com/Myriad-Dreamin/tinymist/issues/2307 and a nice to
have feature.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Enhanced the exporter tool:
- For PDF format, added `pdf.pdfVersion`, `pdf.pdfValidator` and
`pdf.pdfTags`. `pdf.pdfVersion`, and `pdf.pdfValidator` will be combined
into `pdfStandard`, and `pdf.pdfTags` will be inverted into `noPdfTags`.
- Use `datetime-local` input for `pdf.pdfCreationTimestamp`.
- For image formats, added `pageNumberTemplate` option, since we cannot
customize that with output path for now.
<img width="1028" height="391" alt="image"
src="https://github.com/user-attachments/assets/1c0c44c9-0ea3-4f7c-a316-5a2746cb8a96"
/>
---------
Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
This pr adds support for tracking the layout information of module
import items in the source code and refactors the expression analysis
pipeline to accommodate this feature, which introduces a new
`ModuleItemLayout` struct that records the parent module declaration,
the byte range of each import clause, and the bound identifier span.
Expression analysis (`expr_of` / `ExprWorker`) is updated to initialize,
collect, and store this layout data in a new `module_items` field within
`ExprInfoRepr`, which is now also included in its `Hash` implementation.
During import declaration handling, each import item—including renamed
items—is recorded through the new `record_module_item` method, ensuring
that all layout information is captured consistently as part of the
analysis workflow.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Adds `c` as an alias for the `compile` subcommand to match `typst-cli`
behavior where `c = compile`.
## Changes
- Added `#[clap(alias = "c")]` attribute to the `Compile` command
variant
- Added test coverage for `tinymist c --help` and actual compilation via
alias
## Usage
```bash
# Both commands now work identically
tinymist compile input.typ output.pdf
tinymist c input.typ output.pdf
```
<!-- START COPILOT CODING AGENT SUFFIX -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Support command alias `c` in tinymist-cli</issue_title>
> <issue_description>### Motivation
>
> As `typst-cli` has a alias `c = compile`, `tinymist compile` receives
exactly same arguments as `typst compile`, it will be suprise if the
alias itself is not supported.
>
> May not also applies to other subcommands.
>
> If this is feasible, I'd be willing to write a PR. This should be
easy.
>
> ### Description
>
> _No response_
>
> ### More Examples/Questions
>
> _No response_</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
- FixesMyriad-Dreamin/tinymist#2259
<!-- 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>
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>
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.
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
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") }`
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
`@`.
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`).
- `--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
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.
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>
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)