#Tinymist
1 messages · Page 4 of 1
nope
This is very convenient to test your queries.
nice, I see
For instance you type my (call item: (ident) @typst_function.name (_)) in that window and put your cursor on the capture group name, here typst_function.name to see what is found.
I opened up the python text object file, that was the fast way to get to know how they work. (The corresponding rust file uses some advanced syntax I didn't grok yet 🙂 )
now hypothetically if the above definition of function.outer is good for typst, shouldn't it be part of treesitter defaults?
You can try it in a typst file containing only #text[Test] say
I think you need two queries to handle the two cases (depending on whether the let is deep inside a code block or not). For the #let situation you can use (code (let pattern: (call _) value: _ @function.inner)) @function.outer
I don’t know how to handle precedence between those two queries to make sure the one selecting #let is tried first.
@oak quest is it annoying to you that we’re having this long conversation which is not really about TInymist? Should we create a treesitter thread?
it's nice, it works but has some precedence problems yes. I don't even know if people agree on including the # or not. For "outer" I think it's reasonable
I'm personally ok with you guys talking about anything here, although you should be better to create one separate thread I think, to not annoying other people that are only interested in tinymist.
Ok. I don’t where to put that new thread. As a subthread here (I don’t even know whether discord allows this)? As a thread in the discussions channel? A thread in the universe channel?
I really don’t know what to do because this is the first discord server I see where many people seem to have very strong opinions about what is on topic or off topic.
I'm happy you helped me with this, at least I have the typst function text object I wanted 🙂
In practice, it is better to humor the topic attribution mania, rather than take it as face value.
oh ok... I was always on my toes in #discussions
@hardy grotto Here's a nice one (section (heading _) _ @typst_section.inner) @typst_section.outer
['aS'] = '@typst_section.outer',
['iS'] = '@typst_section.inner',
The section thing is already defined in the grammar, so we can select a whole section and its body until the next section. What do you think it should be called? Different name/letter?
I've been using Typst through Tinymist in VSCode without issues. After yesterday's Tinymist extension update, I keep getting warnings like the one shown in the attached image. While it doesn't affect functionality, I'm wondering if this update requires additional configuration.
Also, I'm not sure if it's related to these warning signs, but since the update, the preview seems to freeze/become unresponsive more frequently.
Thank you for creating such a great extension!
could you check 20-rc1? 0.13.20 will be published 6 hours later.
I'm not sure what 20-rc1 refers to, but I'll wait for 0.13.20 to be published and see if that resolves the issues. Thank you for the response!
Guys, I've been suffering from a weird bug on Tinymist for a long time. Every time I open VS Code, there is a chance that Tinymist will recognize the current file and start to process it, showing some syntax error, and even compiling it to pdf. But that file, as well as the entire folder, has nothing to do with Typst. It often happens when I open the folder for the first time. After I close the file and open it again, nothing weird happens.
rc means release candidates. The rc builds appear on GitHub releases and happen before real releases. If you would like to confirm some features or bug fixes will work as you wish, you could download and test the extension in local. I will also try new features in local with release candidates, but this only proves features work on my machine.
I noticed it before, rarely happening on my side, but I haven't figured out the reason.
Is there a way to restart the server without reloading the window? Would be useful when server freezes, or when changing a setting
on VSCode
@oak quest FYI, problem persists in 0.13.20
i may wait for a bug report to know what is happening.
you could use the restart server command
I guess I was searching under the "Tinymist:" commands. Why are some commands "Typst:" and others "Tinymist:", or "Typst Preview:"?
All commands are under "Typst" catergory I think. The only command containing "Tinymist" word is "Tinymist: show log."
I have these ones under typst preview. the "tinymist:" ones were for focusing on the extension views. I guess I am just really bad at searching things sometimes
these commands were introduced in 2023, at the time there was no tinymist and I did't know there could be a category field for commands. may be it is time to tidy up a bit.
Hi! Do you guys also have problems with tinymist in vscode not updating the preview after a while. No error mentionned in the log
there was a new update today, do you know if it still happens with that one?
Okay it did the update and seems to work now. I will confirm in a few hours if it occured again.
still trigger the bug once per thousands of save operations, but I think I have totally fixed the unresponsive bug, i.e. it will be updated if you save twice. I'll stay and wait for responses for a while and continue fixing it when I add some tests.
This section documents experimental project management features. Implementation may change in future releases.
The Core Configuration: tinymist.projectResolution
This setting controls how Tinymist resolves projects:
singleFile (Default): Treats each Typst file as an independent document (similar to Markdown workflows). No lock files or projec...
Thanks a bunch!! Will try on the next opportunity!
I updated the documents: https://myriad-dreamin.github.io/tinymist/feature/project.html#label-A Sample Usage of lockDatabase
If you still find bugs, you could report it and I will fix them quickly for having the new test framework to prevent regressions. I haven't run the extension but I have scheduled a plan:
- test preview can be started in a week.
- test background preview can be started in a week.
- ensure lock file is updated with LSP commands in two week.
- test lockfile is used by background preview in two week.
- test nested lockfiles work well in a month.
- ensure that all CLI arguments of
typst compilecan be also set withtinymist compileortypstExtraArgsin a month. - finally tweak schema of the lockfile and freeze the schema version to v0.1.0-rc1 (currently it is v0.1.0-beta) in a month. We may keep maintaining backward compability of
v0.1in a year or two.
I'm on 0.13.22 on vscode, it is working fine for me
does tinymist support range formatting with typstyle? I can format the whole buffer but not just a part of the file with neovim. I see tinymist sets the rangeFormatting capability, so that seems correct so far
there is a PR
will get merged and appear in 0.13.24
there had been many times that we finish a fresh feature before people asking for one.
Hi! I am searching for the best practice to develop a local package. I wanna put the package still under progress somewhere out of the current project folder and import it with #import.
The few possibilities to put the package are
- ✅ A subfolder (but it means the local package has to be copied to the working project where it's imported)
- ❓ Use
@localnot@previewas in Private packages - ❓ Under the path
@preview(this might pollute the@previewenvironment?) - ❌ Full path
#import "C://path/to/a/local/package/lib.typ":
In the end the only viable way seems to be the first one. But I think it's better to avoid copying the package (or manually link it there). Or under the path @preview? Is there any better solution?
Thanks!
It means not working for crosses. Maybe I missed sth so it doesn't work...
Usually where is the default @local path in Tinymist?
I think tinymist even has features to put your current project there if you have it open
thought i could be mixing something up
system dependent
see the typst/packages repo
it has docs on where to put this
you can also use something like utpm to set this up more easily
Thanks for the info!
I will check the doc in more details
the next version of typst will actually have better error message showing you where exactly it expected a package to be when it cannot be found locally
Thanks again! It works!
The path of @local namespace is indeed typst\packages\local. It is not there at first and has to be created manually.
Another thing noteworthy (which boggles me a bit) is that the directory hierarchy seems to be strictly packages/preview/{name}/{version} otherwise ignored (double check needed), as described in the typst/package repo .
After a short time for Tinymist to notice the file changes under @local, the path autocompletion of Tinymist works smoothly for the packages under @local !
Great idea!
I have another question about absolute paths (especially to external files).
Is it on purpose to forbid using files not located in the project folder, like for safety reasons?
I personally maintain a unique bib file on my machine. In latex, there is an environment variable called BIBINPUTS to pass the external bib file path.
But seemingly with Typst, it seems not possible to do that anymore.
Yes
Though you can grant access to paths through the cli. Not sure how it's done in Tinymist
thank you a lot!
Have you tried a symlink?
Yes, that's my choice in the end.
It's actually perfect except that I have to create one for each project 😄
But it's good to know typst-cli allows that too
I just have some new question regarding the symbols list panel of Tinymist (invoked by ctrl + shift + o in vscode)
On my machine, it seems that symbols defined below commented lines will not show up in the editor symbol panel
For example, a file test.typ has only one variable
#let c_bg = rgb("#fafafa")
We see our only variable in the file c_bg after pressing ctrl+shift+o or ctrl+p+@
But with a commented line above the variable, like
//
#let c_bg = rgb("#fafafa")
The variable c_bg will not be visible in the symbol list 🥲
I don't know if it's just my machine bugs 😅
tinymist.wasm is working
The missing thing is to implement http registry and fs accesses, but it was implemented in typst.ts and I only need to achieve it again.
@oak quest do you know anything about this?
$ cargo insta test -p tinymist-query --accept
Compiling tinymist-tests v0.13.22 (/home/emilylime/.cache/paru/clone/tinymist-git/src/tinymist/crates/tinymist-tests)
error[E0432]: unresolved import `tinymist_project::vfs::system`
--> crates/tinymist-tests/src/lib.rs:9:51
|
9 | base::ShadowApi, font::FontResolverImpl, vfs::system::SystemAccessModel, CompileFontArgs,
| ^^^^^^ could not find `system` in `vfs`
|
note: found an item that was configured out
--> /home/emilylime/.cache/paru/clone/tinymist-git/src/tinymist/crates/tinymist-vfs/src/lib.rs:12:9
|
12 | pub mod system;
| ^^^^^^
note: the item is gated behind the `system` feature
--> /home/emilylime/.cache/paru/clone/tinymist-git/src/tinymist/crates/tinymist-vfs/src/lib.rs:11:7
|
11 | #[cfg(feature = "system")]
| ^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0432`.
error: could not compile `tinymist-tests` (lib) due to 1 previous error
info: no snapshots to review
@hardy grotto you mentioned trouble on the neovim issue in the tinymist repo. On neovim stable (v0.11.3) I don't see how trouble helps, do you have more information about that?
Maybe I don’t understand what you want. When I try your example with main.typ and other.typ, I can open main.typ in neovim (there is no buffer at all for other.typ) and I open the trouble.nvim panel I see
Quick question: I noticed that when inserting file paths in the read function, Tinymist doesnt show me .java files in the autocompletion file list (but it does show .png files)
Is that something that could be changed? Would be very convenient for me because Im often inserting Java sources 🙂
Hovering over such a file path in Typst source code in VS Code shows me „A None file“ in the tooltip
I want a feature that the typst.app already has: it issues a diagnostic on line 3 of main.typ, highlighting the user error there, in this specific case.
Why should the error point to line 3 in the file main.typ? Because that's where we need to go edit to fix the problem.
In many cases, other.typ is a library or package and main.typ is the user's document. That's why this is a big improvement to UI if it can be resolved.
I'm interested to hear from @oak quest if it's ok to add a diagnostic for this ("splitting" the existing diagnostic) in that case maybe a contributor, maybe me, could try to do it
picture of the UI in typst.app for this scenario
it's not perfect, but at least it has a diagnostic/underline on the line we need to look at and fix our mistake
(sorry if my communication sounds direct, I'm just trying to be clear)
this is...
error lens?
there is no diagnostic to highlight on the line we're talking about right now, so I don't see how error lens helps
if we want a user document and package example for the same issue, this is a good example:
#import "@preview/fletcher:0.5.8"
#fletcher.diagram(1)
Both neovim and vscode can observe: no underline/highlight on line 2 in our document, where there is an error (diagram doesn't accept an integer argument)
Preview in tinymist is broken (vscode). It looks like a font issue, but the pdf-preview works, so I don't get it.
is this on a nightly release/prerelease? In that case there is a similar issue open already
paran3xus tried fixing a bug and the bug fix bombed preview intermediately.
@oak quest Do you think I can open an issue for this? Or is it just a user setting in VS code?
besides completing well-known files, we could also complete all files to read in the (reading) directory.
it is not implemented yet.
Thanks, thats good to know. I will open a ticket at the Tinymist repository 🙂
hi does tinymist on vscode support the git version of typst?
Sometimes.. Or something like that.
Huh
via nightly channel (built per day). you could check the release note to find the used git version
thank you
is the vscode pre-release version the same as nightly?
For the record a better helix keybinding for pining main files is
"C-m" = ':lsp-workspace-command tinymist.pinMain "%sh{realpath %{buffer_name}}"'
(using the realpath command to build the absolute path based one the current directory, which works also when buffer_name includes a relative directory as in a/b.typ)
the # shouldn't go before "annotation"
not a bug/issue, just a dev/internals question
i'm trying to add a code action to a local fork of tinymist that requires access to latest compilation diagnostics. at a glance, it seems like this is going to be a bit tricky because the architecture is designed so that compilation diagnostics are transient. i.e., after compilation, they get sent through a channel and eventually communicated to the editor, but are not stored anywhere. in particular the diagnostics aren't accessible via LspComputeGraph (otherwise i could make code actions a stateful request.)
is the above correct? (just wanted to confirm before trying to throw diagnostics into CompileSnapshot)
bit more context in case this is an XY problem. i'm trying to hack in support for implied multiplication (so $xy$ doesn't error when xy doesn't exist but rather displays the product of variables x and y.) i'm not planning on upstreaming this, just wanted to see how difficult it is to do locally and because i miss it very much from latex
the typst compiler change ends up being trivial (i downgraded the 'no such variable' error to a warning, and made it display as multiplication instead.) then i wanted to add a code action to tinymist so that it automatically detects these warnings and fixes them on save by adding back spaces between the variables, so that the final document still works with normal typst.
it's pretty easy to add a code action that just fixes one warning at a time, but i wanted a source-level code action that fixes all of them in one go and here we are
Is there a markdown to Typst command in the LSP?
I see there is export to markdown, but I'm looking for import
No
But check out pandoc
the editor will attach the diags at the cursor so you don't have to fetch diags from somewhere. it would be sufficient validating ranges before generating code actions. besides, isn't there already a auto fix code action in current tinymist?
might insteadly using cmark, a typst package.
right but i want all diags across the current file since the code action would run on save, not just those at the cursor
at least in my testing vscode doesn't seem to reliably send all of them
isn't there already a auto fix code action in current tinymist
maybe i'm missing it? i think there's localized/quickfix code actions that you can use one at a time, but nothing likesource.fixAllwhich is what i'm trying to do
anyway, i ended up hacking in a latest_diags field to ProjectInsState that gets updated in process_compile, which sometimes works, but occasionally the snapshot i receive in the request handler has empty diagnostics. it's not consistent (if i type some random things to get a recompile it goes away), so i suppose it's a synchronization/caching problem of some sort. i don't fully understand the architecture yet...
obviously this is an issue on my end with the local changes i made, not a bug in tinymist, but was wondering if you see any obvious issues just from what i said above. if not no worries i'll continue poking at it until it works :P
It is okay to introduce latest_diags. From my point of view, we could also instead add a tinymist fix command resembling tinymist test, which is easy to implement and doesn't affect the ProjectInsState (sounds risky). fwiw, vscode runs all tests by running CLI command tinymist test instead of running a LSP command.
i removed snapshot caching from ProjectInsState and my problem goes away 🤔 i want to say there is some latent cache invalidation bug here... dont think its easily observable in current tinymist though but i will see if i can come up with a reproduction or something
ok i have a theory for whats going on now. not sure if bug or intended design. the revision is being incremented on the "start recompilation" signal, Interrupt::Compile, but the success doc (and diagnostics which i added) are only updated in the project state on Interrupt::Compiled.
so if a snapshot is requested between when the project is compiled and when it finishes compiling, the revision will have changed already so a new snapshot is generated. but the new snapshot hasnt gotten the updated document or diagnostics yet, because this happens before compilation finishes
in practice i think this implies snapshots lag behind the latest compilation state a bit. not sure if this hypothesis sounds reasonable or if it is total BS
i believe there are some, especially when one removes/creates files. I would like to fix it later, because I've changed a lot recently and I should wait for one or two months and see if there are some other serious bugs.
previously the requests acquiring a typst::Document would wait for a fresh compilation, but I turn to decide not doing that because we prefer to serve with lower latency and we expect the document usually doesn't change much.
like there is a label in the document to be found or not, you usually don't change existency of the label when you are editing the document.
hmm yeah that makes sense. but what i am claiming is that, when the project compiler generates a new snapshot, the timing of when it recomputes instead of using the cached snapshot is suboptimal
i can send a PR later this week with a potential fix to discuss if it would be more clear
You are correct. That's why I introduced a WorldComputeGraph that computes on demand. This matches the insights mentioned in https://rustc-dev-guide.rust-lang.org/query.html. But I have not finished it yet, because I also find it pretty complicated the codebase. I'm slowly finding a way to achieve balance between faster query and simpler implementation.
okay, sounds good. the fix i have is fairly small and localized, so i will send it later when i convince myself it is correct and you can take a look. but i understand if you prefer to wait to change this, because while i think there is a bug here it is not really observable with the current featureset
The fix will be likely good if you pass all CI testing. There have been some smoking tests and e2e tests of CLI, neovim, and vscode that about incremental compilations and queries. I'll take a look and merge it quickly in v0.13.26 (now is v0.13.24-rc1).
the smoking test (included in scripts/e2e.sh) is to test 100k LSP queries with changing some multiple-file documents for dozens of times and then validate the results of 100k LSP queries are all same as that generated by previous-commit CLI. I'm pretty sure the smoking test helped a lot when I was developing the compiler.
i sent https://github.com/Myriad-Dreamin/tinymist/pull/2057. existing tests seem to pass for me locally, but i don't think they can detect the change here
btw, i'm thinking about upstreaming a code action that adds spaces in undefined variables (basically automates fixing this kind of hint from the typst compiler: Hint: if you meant to display multiple letters as is, try adding spaces between each letter: "i j".) does this sound like something in scope for tinymist?
the more fancy version i'm building locally patches the typst compiler to make the undefined variable error a warning instead. that means all of the problems can be generated at once and fixed automatically in one code action, but that's a lot more complicated, and i don't suppose tinymist wants to patch the compiler in this way?
Would be nice if typst itself could power through most errors, for things such as highlighting all errors
mm it'd be nice but i don't know if it's technically feasible or desirable
syntax errors are reported all at once already
but undefined variables and the like are runtime errors, and it's less defensible for the runtime to keep chugging along once it hits a problem
I've been hoping $ABCD$ and alt+enter (apply the code action) to get $A B C D$ for a long time. I believe many people will love it.
I mean, that's just abusing the math font
Or do you actually mean the product of a b c and d?
I don't think it should be considered, the most important principle is to ensure consistency with typst-cli whenever we can. If there is any compiler bug, we can report to typst/typst confidently. If somebody ask a question in #quick-questions, we might not like to ask "are you using tinymist or not?" first every time.
?r This is needed sometimes I think. Like this, ```
$op(triangle)A B C$
For undefined reference warnings, it might be better to detecting them by static analyzers, causing that the compile errors are not triggered if the code is even not reachable? tinymist does know definitions well (using the goto definition). it only needs to check all analyzed undefined references again and report a warnings if it is 100% sure. related:
- goto definition request: https://github.com/Myriad-Dreamin/tinymist/blob/4ce0a59862c212e938fcdda4ab35bad17e73fd7e/crates/tinymist-query/src/goto_definition.rs
tinymist-lintadds extra diagnostics: https://github.com/Myriad-Dreamin/tinymist/blob/4ce0a59862c212e938fcdda4ab35bad17e73fd7e/crates/tinymist-lint/src/lib.rs#L200-L208
Hello, I'm experiencing a smallish issue with the Tinymist preview in VSCode on my work computer, I did not find a similar issue in the Github tracker, but I wanted to check here before creating a new one.
Essentially, gradients render as black in the VSCode preview when I'm scrolled to the top of a document.
- I can get the gradient to appear if I scroll down a bit.
- It seems to trigger at some point when the block with the gradient is clipped by the top of the preview window.
- If I put a page break and add a second gradient on another page, the second gradient does not seem to experience the issue.
- I cannot reproduce the issue on VSCode on my personnal computer.
If it is not a known bug, I can file an issue with a complete log.
Here is the code for the example screenshots
#block(width: 100%, height: 10cm, fill: gradient.linear(blue, yellow))
i considered this but it seems a bit finicky. the compiler will already emit one error, so emitting warnings for the rest is kind of inconsistent. moreover arguably we should take care to not duplicate an error at the location the compiler already errored on
that said maybe its ok to add one duplicate warning 🤔 not too big of a deal and arguably more consistent if theres a warning everywhere
if youre ok with this i can contribute warnings for undefined references, a quick fix code action to add spaces, and a source-level fix
-all code action to add spaces to all undefined variables at once
the only catch is the source-level code action should probably use LSP code action/resolve instead of the edits being eagerly computed, and at a glance it seemed tinymist has some custom handling for code actions that maybe complicates things (?)
the gradient outside of window are not rendered for performance issue. from your screenshot, there may be some wrong checking about whether the gradient-filled rectangle is visible in window.
deduplication is surely needed. not sure we should emit errors for consistency. feel free to explore more design because I also haven't develop many lint checks so I may misjudge something.
i asked laurenz in #contributors and he seems interested in potentially changing the compiler to emit all undefined variable errors at once
in which case the benefit of an additional static analysis pass is minimal
so an alternative is to just build the quick fix code action and a fix-all action based solely on compiler diagnostics, which would not do too much more than the quickfix right now but would become much more useful if the compiler makes the discussed change
most looks pretty good. for source-level "fix all", some delayed computing may be better? I mean you only return a code action that will execute some lsp command and you calculate and fix all issues after user invoke the fix all commands.
yeah, that's codeaction/resolve in LSP (at least as far as i can tell)
how does compiler check and emit errors in an unexecuted function body?
it wouldnt do that, but errors in live code is probably good enough for math undefined variables (which id expect are usually in the main document body)
I'm not sure if we should fix all of the undefined references in a fix-all action. in principle, we may only do things that we are 99% sure that user will not hate or revert. specific for batching fix undefined references, I suggest learn the r-a (rust-analyzer) way: people can select a range of rust code and fix all of the unused item warnings in the range.
mm i think there is a reasonable argument for both sides. such fix-all code action already has to be triggered by the user, and they can also predict what changes it will make based on the diagnostics they see. personally i would just run it automatically on every save so that i dont have to care about adding spaces ever again
but i also understand your position
I mean there are multiple ways to fix a undefined reference, so we should not fix it in a fix-all action by default. Another way is creating missing definitions for users:
- creating a file
foo.typand import it forfoo. - creating a let binding
#let foo = ${none:0}forfoo.
we should not fix them by default, but may do it by some settings. The concrete design of settings may need some investigation about the existing nice tools like eslint. However, we could mark experimental features and disable them by default to attract angel users that tolerate our design missing and give more feedback, also avoid too much eager hesitation about design. We can mark the "fix all" as experimental, and doesn't fix undefined references by default, and introduce an experimental flagtinymist.autofix.experimentalFixUndefinedReferenceInMath(the name needs bikeshedding) that match your needs.
right of course, i agree this should not be enabled by default
Good. I'm cautious about design but rather easy-going with experimental features, so please feel free to design and develop in your style. I'm looking forward the day we unleash the power, i.e. making the experimental features stable. in fact, there are 90% experimental features and 10% stable features.
hmmm. took a look at this and i can't really decide on whether emitting an error or a warning would be better. on one hand we can try to copy the typst compiler diagnostic exactly (which is possible)
...but then that can cause confusion if tinymist has a bug and produces an incorrect diagnostic, which looks exactly like the typst compiler diagnostic but isn't the compiler's problem
however emitting a warning is not great either, because then the user will see a mix of warnings and errors for what's basically the same issue
maybe the solution is to generate a warning "potentially undefined variable: {name}"? ideally we would not include the word "potentially", but i feel we have to differentiate our diagnostic from the typst compiler one somehow
also hitting this build error today ^^ originally i did some weird temporary fix but it got lost in my git history and i cant fix it again 💀
edit: ah the change i made was (in tinymist-tests/Cargo.toml)
- tinymist-project = { workspace = true, features = ["lsp"] }
+ tinymist-project = { workspace = true, features = ["lsp", "system"] }
but not sure if this is the correct fix in general, though it makes tests run properly again
that should be correct. I also noticed the undefined reference error from some reports
update: tinymist.wasm can process multiple files now.
anybody got an idea how I can install an old version (13.4) of this thing?
because somehow my complete setup got broken by an update
how are you installing tinymist? I'd check so that you are not using prerelease versions but using stable versions. Current version is 0.13.22
Trying to install using cargo, what I am doing wrong?
It says right there what's wrong and how to fix it
Sorry for that, but just add --force?
Yes
In this picture: completion for @ syntax (references) with tinymist.
Could there be a convention for which label names to exclude from this list of completion alternatives? "/" "," for example do not work in label names together with the @ syntax, so that's one idea for a rule.
Discarding these as completion options would help the user find the labels/names that they actually are likely to use
I guess this is an ecosystem wide discussion. Elembic is not the only producer of its own internal label names
maybe this is a typst compiler change and not tinymist, but people here maybe have vested interest
now it can be discussed in the typst PR https://github.com/typst/typst/pull/6840
that's just the start of the discussion, more to be done
excluding anything with a / should only be done when the auto completion is not at the import statement or in a string there since this works nicely
that's not based on labels so it's a different code path, no overlap (at least in typst-ide that's clear, at that level no problem)
There could for example be a convention that certain other substrings are skipped in completion. Maybe __ prefix (looking at elembic up there) @tribal mesa
_ prefixed identifiers are even put front. but I guess I can move these identifiers to the end of the completion list.
what about completing them as function calls (ref(name))
excuse my incompetence, is that a kind of completion that exists right now? I find nothing in neovim with that syntax
I don't know what decides the order here probably filtered by blink.cmp in my editor. But it's another document and the list has some legitimate targets (like fig1 and fig2) and typical package labels that we don't care for like __pillar and _mannot
not implemented yet.
Just asking so that I can understand what the question is about. I think we should decide some conventions or rules so that we can filter labels based on context. This first PR is just the low hanging fruit (@test,1 is invalid syntax, so we should never suggest test,1 as an option for completion)
tinymist doesn't sort label completion items, looks blink.cmp neither.
I meant it could be referenced as ref("test,1"). it is another question to determine whether a label should be shown or not. I think it is a personal flavor and there could a configuration to filter out unwanted completions. there is also a similar question to determine whether show _ prefixed identifiers or not. physica package has many such "exported private variables"
it's an ecosystem discussion because we need to filter these out to preserve usability and package authors need a way to hide their implementation details
Actually, I should update the PR. Here are two facts:
@test,1 @test/2 @test@2are not valid syntax (or if they are, they reference @test<test,1> <test/2> <test@2>are not valid syntax
The second point I didn't realize before. So those candidates should be removed from both@and<label completion
How much quicker is tinymist preview than Typst watch?
tinymist preview is based on a custom svg exporter and updates preview webview incrementally
so i think at least it's way faster in the final io stage
tinymist preview is immediately updating ideally, Typst watch only when you save the file, that's the biggest difference
there are two metrics, speed and overhead. preview is faster but has more overhead. when you computer cannot afford to the overhead, you'd better switch to use typst watch. it's a main task to optimize the overhead in long term but we very lack of volunteers to analyze, test, and optimize overhead.
another metric is memory overhead. running lsp and watch separately will double the memory usage. for example you document may take 40GB and running separately will take 80GB and might exceed size of available RAM.
I think this was an exaggeration
I was more going to ask, what computers do they usually use that 40GB is fine and you have to assume 80GB memory usage to reach OOM 😅
there can be some leakage (memoization is basically memory hoarding; keeping memory around on purpose in case it's useful later) and I had 16GB machines struggle (i.e. (way?) less than 16GB for the document alone); have never had problems with 32GB RAM
That number by itself doesn't mean much without knowing what the document was. People have been making some extremely large documents
yes and no, because I got a document used 40GB but my dev PC has 128GB ram (@ sillyfreak, 😇). such large documents are virtually rare cases if you have sane template settings.
Damn can I have some of your ram
I have run out of RAM that way on this laptop. Not because the document was too big but because the incremental cache kept growing to fill RAM after edits. Was a drawing of a map/vector graphics though
Just download some more ram
hi, not sure if this is the right place to ask. I am encountering a weird bug but i'm suspecting it's just user error since it would have been reported by now.
I'm using vscode tinymist 0.13.24, and when i have multiple .typ files and previews open, typing @ only triggers the available symbols/labels in the last opened preview, instead of the current active file, even though the "Go To Symbol In Editor" command shows all correct labels available in the current .typ file.
It goes back to normal when i close all the other previews except the file i want to edit. I can still leave the other .typ files open.
Is this expected behavior or is there something that causes this?
Thanks
this is a "known feature" that only one previewed document is searched. we may improve it in future.
sorry for the quick-question, but is the jumping-to-source-by-click possible using zed and background preview with svg? 😅
i couldn’t find it and it took me some time to even get the preview working (i for some reason need both a settings and a initialization_options variable…)
impossible yet. for now it is possible only if we change the zed code (I gave up after some investigation for zed is gpl and I don't like to feel worry whether I violate gpl).
shame :/
thanks tho!! :)
I explained the reason why it is impossible and you could search on discord server to find the long description. in short zed needs to improve it's support to lsp and editor plugin
not. neither any opened issue. there is a todo in the codebase.
I see thanks :)
I'm getting a failed to download package error. I think it could be something on my end, but I'm unsure on how to fix that.
I've only got vscode with the Tinymist extension
Specific error is failed to download package (error sending require for url (URL))
It also does not autocomplete import @preview
I don't know if it is tinymist's or typstyle's fault, but tinymist formats my document in VSCode empty lines inside blocks are getting indented.
E.g.
#box[
indented
// The line below has 2 spaces
indented
]
it's typstyle's
i think i know why, not really something that can be fixed by Tinymist im afraid
typst in idea https://github.com/Myriad-Dreamin/tinymist/pull/2087
is there a way to get tinymist to read the "new" (inline) tidy parameter syntax?
Not yet, there were some design questions myriad was concerned about
He wanted to start a document on this I think, but he's probably busy with other things
Hey I have a quick question
Does anyone using the live preview feature of Typst know how to also capture the errors that are outputted
I think it's in development to show errors as overlays in the preview
in neovim I look at the workspace diagnostics list to see all errors. I kind of struggle with this issue: https://github.com/Myriad-Dreamin/tinymist/issues/1870 (the panic happens in a different file than currently editing). Though I think I wrote up the issue in a very confusing way
okay that's great thanks!
My problem is that I sometimes don't get workplace diagnostics right away
or like you said they can be in different files
Another question for you since you seem knowledgeable: Is there a way to configure Typst with per project config files? For instance a way to change the root without setting it up manually through ENV each time?
If you are using tinymist, you can set the project root in tinymist settings, and e.g. in VSCode those settings can be specified on a workspace level
I don't know anything in practice, but I've heard there's some new stuff happening here: https://myriad-dreamin.github.io/tinymist/feature/project.html
This section documents the experimental project management feature. Implementation may change in future releases.
The Core Configuration: tinymist.projectResolution
This setting controls how Tinymist resolves projects:
singleFile (Default): Treats each Typst file as an independent document (similar to Markdown workflows). No lock files or pro...
Thanks!
Hi guys. How to use dev version like Typst app?
I switched to pre-release version, and got this preview:
The exported PDF is correct.
It's a known issue: https://github.com/Myriad-Dreamin/tinymist/issues/2020
this was caused by an old html was bundled and can be fixed by updated assets. waiting for the nightly maintainer to operate it.
asking now here since it seems more appropriate of a place: can the white page fill be turned off in preview? i mean, not with a page property — this one works as expected — but the underlying "typst-page-inner" class in HTML? asking to get a fully transparent background setup
an option to tweak it's rgba could be nice
Not sure if set page(fill: color.rgb()) is what you are asking for.
nope, not that one — as i said, it works perfectly. it is transparent in the HTML, as you can see with #set page(fill: rgb("#00000000")
the problem is that sort of "canvas" element beneath it: look at <rect class="typst-page-inner" …/>
the html class typst-shape hints that the shape owning #000 may be some typst element generated by your code, rather than typst-preview.
as far as i'm aware of, no
specifically tested it with just that #set line, nothing else
Maybe you hover the wrong element in screenshot. I checked it by myself and the page inner aer fill with white.
I'm afriaid that cannot be removed, because people may #set page(fill: none) and black text may be hard to be viewed on the background that is depended by the dark or light theme.
i dont see how that case can interfere with just adding a setting for it in the LSP config itself, if there ain't one already
let it be white/black by default, but give an option to set it's visibility to "none" or change the rgba of it
I don't want to add any preview-specific theme setting to the configuration, because any details about the html in the screenshot may change in future. The correct way may be allowing preview theme plugin that fully customizes the html and we expose some configurations from the theme plugin. Also, a theme plugin may not generate a typst-page-inner at all, which also tells that "any details about the html may change in future".
sounds reasonable
You can subscribe https://github.com/Myriad-Dreamin/tinymist/issues/746 to watch whether we support preview theme plugins. That is easy to implement, by allowing to load typst-preview html from another extension, by tinymist.typst-preview-theme = "extension-name", but some design is not yet determined.
I think it is simple. yeah. When I write the above reply, I find the most simple theme extension doesn't have to have configuration.
and we can add background, invert-filter configurations to the theme extension. it can always ensure compatibility: we could publish an v2 extension whenever we would like to, which wouldn't break any existing user configurations.
ok, i'll keep an eye out for that
rn this is the only thing that makes LaTeX-like pdf preview in something like zathura a viable option, since the solid color background looks very out-of-place in an otherwise translucent setup
in every other aspect, live preview is a killer of a feature, just as everything else with typst so far
Hi a quick question about autocompletion of package functions: is there an easy way (or is it actually possible) to tweak the autocompletion style (in vscode+Tinymist)?
One case is about function completion. In Typst, we have function calls with both braces and square brackets.
#import "@preview/dashy-todo:0.1.2": *
#todo(...args)[ The actual content goes here usually]
//Most of the time, we use only the square brackets and leave out the braces, like in
#todo[...]
However with the autocompletion, it always gives function calls with braces
#td // <- here a autocompletion list pops up, as shown in the picture
#todo() // by autocompletion, we get this on default. #todo[] or #todo()[] might be better
This is one example where I think we could benefit a little bit by allowing style tweaking in autocompletion.
this is a good question. we detect default style to provide in best effort. if you add type hints (docs) to todo function, it should be completed with square braces. but "in best effort" means it is hard and may be impricise. We thus choose to provide variants and set the most frequently used one to default. We also try to filter out impossible cases.
I didn't think of #todo()[] and it may be good if we introduce this one style in future. I need to think of it for a while.
I would like this, too. In this case, I would want the snippet functionality to switch from the parenthesis the brackets with a tab
Sorry but on my vscode setting it's giving sth else. Maybe it's also a problem of the package I am using to test autocompletion.
I agree. Here I'm just giving one example. It would be nice to have sort of control of the style in future.
Give a try to tell the language server that the body is a content. In your screenshot, the language server says body is a value having any type.
/// - body (content): The body of the tody
/// -> content
#let todo(body) = body;
Now it's working. So there's workaround already and part of the issue is from the command I am testing
It is hard to let package owners learn this feature, but overall there is no problem to request people to document package exported functions as many as possible.
Thanks a lot. I also wonder where to learn the completion syntax supported (like .bracket here) or the name of this feature if it's actually well-known. For me it's like magic 😁. Or is .bracket the only extension of the "commands name" completion?
I tried to import the following todo from another file, but then the auto-completion fails again for tdbr. So there seem to be some rules to be followed.
// In preamble.typ
/// - body (content): The body of the body
/// -> content
#let todo(body) = body; // just for auto-completion
// In main.typ
#import "preamble.typ.md": *
#tdbr // <- auto-completion fails again
It's not worth to documenting "small features", because skilled people can find them while new people don't have to learn this feature to make a simple typst document. I think it good to provide some tips box to show these small features, also we can add them all to https://github.com/Myriad-Dreamin/tinymist/blob/main/docs/for-llm/vscode-ui.md. LLM is good to read documentation will many details in a second and find the useful information for you.
Interesting, tinymist fails to get types for variables imported by star (*)
Could you create an issue so that I will not forget it?
#import "preamble.typ.md": todo
Good to know there's a llm-specific documention! it's going to save a lot of time.
Indeed the issue is related to start import. Yes I will file an issue now and link to the discussion here.
Only me know all of that about tinymist features, and I'll update the llm-specific documention slowly. You could ask deepwiki when the documentation misses something: https://deepwiki.com/search/relevantcontextthis-query-was_683a54c6-751d-4b7a-9e7a-ac49357f39a2
DeepWiki provides up-to-date documentation you can talk to, for every repo in the world. Think Deep Research for GitHub - powered by Devin.
In the readme, there is an entry to deepwiki with tinymist. deepwiki will answer questions based on the source code.
Thanks! I will check it soon
Hi everyone,
I'm having trouble with automatic tinymist (Typst LSP) configuration on Neovim 0.11.4 with NvChad.
Current configuration:
settings = {
formatterMode = "typstyle",
exportPdf = "onType",
semanticTokens = "disable"
}
}```
Issue:
Manual startup works perfectly: :lua vim.lsp.start(vim.lsp.config.tinymist)
But no autocmd can automatically launch tinymist on .typ files
Failed attempts:
```lua-- None of these variants work
vim.api.nvim_create_autocmd("FileType", { pattern = "typst", ... })
vim.api.nvim_create_autocmd("BufEnter", { pattern = "*.typ", ... })
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { pattern = "*.typ", ... })```
Context:
typst-preview.nvim is installed and already has an autocmd on FileType typst
Filetype is correctly detected (filetype=typst)
Other LSPs (lua_ls, etc.) work normally
Using the new vim.lsp.config syntax in Neovim 0.11
Temporary workaround:
I mapped manual startup with my preview command:
```luamap("n", "<leader>p", function()
vim.lsp.start(vim.lsp.config.tinymist)
vim.cmd("TypstPreview")
end, { desc = "Typst Preview + LSP" })````
Thanks in advance for any help!
do you use nvim-lspconfig? and does your config run vim.lsp.enable("tinymist") at some point? I don't know too much of the details here but there's just a few of the right things that are needed to make it work
the doc for vim.lsp.enable says
Auto-starts LSP when a buffer is opened, based on the |lsp-config|
filetypes,root_markers,
androot_dirfields.
which will work fine when you have filetypes set in the tinymist lsp config (nvim-lspconfig does this for you if you have it)
😄 It's working now .... Thank you.
great. what did you need to do to get it working?
Hi, I using Tinymist with Helix and this setup is awesome! Thanks for that!
I hope this is the right place to ask but how I can configure a keybinding to open the current file in pdf form using xdg-open?
Any chance that someone found & configure snippets for typst? (To be used with Helix)
Thanks in advance!
Not sure if this is the right place to ask, but I'm trying out Typlite's DocX export feature, and it doesn't seem to be including any images in the resulting file. Is this currently unsupported or do I have to do something special to make it work? (I've already tried a few show rules for HTML image output)
Oh, the issue was that the images were inside figures
helix may be able to invoke the lsp command tinymist.exportPdf. you could check the docs to get if you can keybinding and invoke the command to open a PDF.
Would there be any interest if I tried contributing figure support to Typlite's docx output?
the symbols panel doesn't seem to work
how do i debug this?
and its empty when i draw anything
also clicking one of the little squares inserts a three-digit number in the document, not sure if that's what it is supposed to do
tinymist version?
can't repro on my end
you are using prerelease version, if you don't need nightly features, consider switching to release version may help, as it includes updates to the symbol view
which may resolve your issue
can any guys help this helix guy? https://github.com/Myriad-Dreamin/tinymist/issues/2148
@scenic wolf @buoyant sand
the typlite maintainer is busy now and I think any contributions or questions are welcomed.
Oki 🙂
Can't say I ever had this issue but it has also been a while since I wrote typst at all
There is also label renaming feature, in addition to range formatting. But even 3-line document can't have labels renamed in Neovim.
Language server couldn't provide rename result
Didn't a release should have mentioned this?
First from top match was on RC for 24th version, on the release page. which adds the feature
I think it occured in some rc releases, but I reverted it after some tests and I found it totally broken.
oh, right, it didn't hit the final release...
just the last line was missing.
-- lsps with default config
for _, lsp in ipairs(servers) do
vim.lsp.config[lsp] = {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
}
end
vim.lsp.config["tinymist"] = {
cmd = { "tinymist" },
filetypes = { "typst" },
settings = {
formatterMode = "typstyle",
exportPdf = "onSave",
semanticTokens = "disable",
},
}
vim.lsp.enable "tinymist"
I'm trying to get into tinymist preview again, and I can't get decent error reporting. The language server simply doesn't catch everything - especially if the issue is steming from a file I don't have open, so I need a way to receive errors from the preview side of tinymist. At the moment, I compile the document with typst to get a decent error message (the typst errors are usually better than the tinymist errors anyway). I think enabling debug mode and checking the logs also works, but I don't want to do that every time there is an error
could it be the case that the language server does catch it, it just reports the diagnostic towards the file where the error happens (so not on a file you have open)?
But if it can't tell me which file that is then that's not good enough
I have a lot of files, many of which are templates
I use neovim and just as information for me, there is always a relevant diagnostic in the diagnostic view that shows "whole workspace". Even if the related files are not open
I also use neovim, so I'll try and get that
ok so you and me probably have common ground in the issue that I reported: https://github.com/Myriad-Dreamin/tinymist/issues/1870
apparently neovim doesn't support this by default (https://artem.rocks/posts/workspace_diagnostics_nvim) are you using a plugin to acheive it or a bit of code like in that article?
Personal website and tech blog.
right, I use a plugin (trouble)
(oh wow I've never seen the lua goto syntax before.. which makes sense because of lua 5.1 dominance, and it's lua 5.2 syntax but apparently also in luajit)
To be honest, tinymist is also unusable for me in neovim. It gets out of sync with reality extremely quickly. I have a key binding specific to tinymist that writes the file to disk and reopen it at the same position. At the beginning I tried to simply restart lsp but this wasn’t enough.
I’d be very happy to try to help fixing this issue if there is anything I can do. In one month I’m meant to showcase Typst in a big open source software festival and I don’t really want people to see that. I kept postponing serious investigation of this because I always have too much work to do. But at this stage I’d be happy to devote one day of work to this issue.
What I mean by out of sync is that diagnostics stay around after I fix the error (and when I say error I mean unfinished stuff, so the thing I see most often is the “unclosed delimiter” error).
And autocompletion is extremely unreliable too. Most often there is nothing at all.
I would really love to get access to the neovim config of someone who doesn’t experience those problems, so that I could try to understand what is interacting badly with tinymist.
Hi,
I'm using tinymist with the Helix editor, and I’ve set it to compile on save. I’d like to ask:
- How can I exclude a specific file (my template) from being compiled?
- Is it possible to define a custom output folder for the generated PDF files?
Thanks in advance!
I don't have this problem. Do you have a keybinding for pin main or something like that? could that maybe help? If you have this problem on single file documents then I have no idea unfortunately.
I don't know how much it helps, but here is a suggested minimal config for tinymist, typst-preview and blink.cmp. It's enough to show that they work together - documentation hover, autocomplete, preview, diagnostics). Not really complete enough for real work (because of missing keybindings and diagnostics setup). https://gist.github.com/bluss/6fa4bd1fefa4afffcb4d0200075ef1f8
Diagnostics disappear after they are fixed with this config.
Thanks, I'll try this config tonight.
I’ll try editing with this config, but I already see random syntax highlighting using it.
For instance the following line (alone in its typst file) seems to reliably trigger highlighting issues: $𝒮(G)$ foo bar $bold(f)$.
I can also use it to confuse tinymist by removing the 𝒮 and then undoing that move (either with undo or by retyping it).
With the bluss’s minimal config I see
With my normal config I do not see the same bug. After deleting and undoing the delete a couple of time I start seeing a random “unclosed delimiter” error between foo and bar.
well that's an interesting bug with removing/undoing 𝒮. must be related to the special calligraphic character there. Are all your issues connected to that, is that the common factor?
Certainly worth reporting that as a bug since it's reproducible. Happens both in the "minimal" config and my usual config.
@strong bear assuming you are the same Sylvan Franklin (sorry about the ping otherwise), could you confirm this problem is not fixed for you (see the examples above)? You wrote on GitHub that you don’t see the issue on the latest neovim+tinymist but, if it’s indeed the same problem, I see it in current tinymist with both the lastest stable release of neovim and the nightly build of neovim.
@oak quest in the attached log, do you see something that could be used in a neovim bug report? This log is created by opening a file containing only the line $𝒮(G)$ foo bar $bold(f)$. and immediately existing the editor without moving the cursor or editing anything.
It’s a bit overwhelming to see this log of 10 seconds (as attested by the timestamps) without knowing anything about the lsp protocol.
Actually one thing seems clear: when asked for full document semantic tokens, tinymist answered:
{
id = 2,
jsonrpc = "2.0",
result = {
data = { 0, 0, 1, 19, 4, 0, 1, 4, 22, 4, 0, 1, 1, 22, 4, 0, 1, 1, 22, 4, 0, 1, 1, 22, 4, 0, 1, 1, 19, 4, 0, 1, 1, 22, 0, 0, 1, 7, 22, 0, 0, 7, 1, 22, 0, 0, 1, 1, 19, 4, 0, 1, 4, 5, 4, 0, 4, 1, 10, 4, 0, 1, 1, 22, 4, 0, 1, 1, 10, 4, 0, 1, 1, 19, 4, 0, 1, 1, 22, 0, 0, 1, 1, 22, 0 },
resultId = "1"
}
}
and neovim shows
with the incorrect r at the end of bar.
Is this something that is clearly wrong and can be reported to neovim?
To be honest I’m not sure the answer can be “neovim can’t handle unicode”. Sure, every program has bugs, but there are other lsp server having no issue with those letters. For instance I can type in a lean file
notation "𝒮" => Nat.succ
#eval 1 + 𝒮 3 + 𝒮 4
and neovim and VSCode have no problem at all putting semantic highlighting in the correct places.
It seems a bit more likely that tinymist is relying on some specific quirk of the VSCode lsp client. And I don’t mean that VSCode is bad here, testing a lsp server only against neovim would most likely turn up specific quirks of the neovim lsp client.
I also have a question. As can be seen in the log, my lsp config contains semanticTokens = disable, as intructed on https://myriad-dreamin.github.io/tinymist/frontend/neovim.html. Is it expected that I still have all those semantic tokens requests?
I checked what the lsp data means here. I’m sure you know this but I’m still reporting to show I’m trying to understand instead of simply hoping you’ll do a miracle for me.
Numbers in the data fields are made of groups of 5. First one is the line number relative to the previous token (or start of file for the first one). Second number is a character count relative to the previous token on the same line. Third one is length of the token. Fourth one is token type. Fifth one is token modifiers. Numbers for token type and modifier are explained earlier in the trace in the semantic token legend.
For our example we get:
Input was a single line with content:
$𝒮(G)$ foo bar $bold(f)$.
Token types
22 text
19 delim
10 punct
5 function
Token modifiers
0 strong
4 static
data = {
0, 0, 1, 19, 4, $
0, 1, 4, 22, 4, 𝒮
0, 1, 1, 22, 4, (
0, 1, 1, 22, 4, G
0, 1, 1, 22, 4, )
0, 1, 1, 19, 4, $
0, 1, 1, 22, 0, " "
0, 1, 7, 22, 0, "foo bar"
0, 7, 1, 22, 0, " "
0, 1, 1, 19, 4, $
0, 1, 4, 5, 4, bold
0, 4, 1, 10, 4, (
0, 1, 1, 22, 4, f
0, 1, 1, 10, 4, )
0, 1, 1, 19, 4, $
0, 1, 1, 22, 0, .
0, 1, 1, 22, 0 ??? maybe newline?
},
So 𝒮 is reported as having length 4. I checked my Lean code example and 𝒮 is reported as having length 2 there.
Note that python says
>>> "𝒮".encode(encoding="utf-8")
b'\xf0\x9d\x92\xae'
so it certainly seems to agree with tinymist that this requires 4 bytes.
I found some discussion at https://xerool.net/blog/dealing-with-lsp-encoding.html.
So it seems LSP uses by default utf16 code units and that 𝒮 is indeed two utf16 code units long.
See also https://stackoverflow.com/a/65972323.
That answer say what lsp expects is "𝒮".encode('utf-16-le')//2 which is indeed the 2 using by the Lean LSP server and not the four sent by Tinymist. Note it doesn’t necessarily means Tinymist is wrong, maybe it tries to negotiate this with neovim and neovim refuses.
I found a bit more time to investigate. The xerool blog post linked above suggests that neovim is asking the right question but expect the lsp server to answer with {"capabilities": {"positionEncoding": "utf-8"}} which I don’t see in the logs. And looking at the code of tinymist that seem to handle announcing its capabilities I see https://github.com/Myriad-Dreamin/tinymist/blob/b239224a63b8d63e82d5f65eec1e61b439841056/crates/tinymist/src/lsp/init.rs#L126-L127 which says
// todo: respect position_encoding
// position_encoding: Some(cc.position_encoding.into()),
Again I’m completely clueless about the lsp protocol, I’m only trying to show I try to help.
@hardy grotto Maybe you could wait for me, a more professional lsp developer, to save your time. But we may prioritize to spend our spare time to the prepare for the very near typst v0.14.
if we ask for utf-8 and server response doesn't specify positional encoding.. the client may use utf-16 but the server keeps using utf-8.
Sure, I’m happy to wait, I only wanted to help and point out that the issue is not solved since the GitHub issue was closed. And of course I understand that you set the priorities for this project.
I don’t understand what you mean here. Do you mean you confirm this is indeed the issue?
i can make a quick patch for you and you could verify with a prebuilt binary with the patch. nevertherness I will add necessary tests to https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/spec to check and prevent regression in future.
I’d be very happy to test a quick patch. I don’t even think I need a prebuilt binary, I should be able to compile it if needed.
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 ini...
@oak quest thanks a lot! Unfortunately it doesn’t seem to fix the issue. In the lsp log I can see the new information sent by the server but it doesn’t fix the issue in neovim.
When I close neovim while the tinymist preview is running and open in Firefox, Firefox crashes. That’s not supposed to be possible right? Like, it’s a bug in Firefox
do you use the typst-preview.nvim plugin?
if so: I‘ve used it (also together with firefox) for over a year and didn‘t have any issues, closing nvim with it running thousands of times
if you‘re not using the plugin: I‘m interested in your setup 🙂
Same here: I never close firefox before closing neovim and never saw a crash. I run firefox in a profile devoted only to typst-preview.nvim (simply because I want to open a new window and have my window manager to put it next to my neovim window).
could you open an github issue and include the discord link to this message, so that I can go back to work on this issue later? you don't have to rearrange description because i've gotten your issue via the above conversation.
I am using typst-preview
I use firefox ESR, that could have something to do with it. tbh I have no idea what the difference is but someone on reddit recommended it
Just googled it, and it sounds like ESR should only be more stable than the usual firefox, so that doesn't seem likely to be the cause
Maybe also relevant that sometimes when I come back to neovim after working on something else there are a lot of TypstPreview related error, but I dismiss them and it continues to work fine. I use wayland/sway
this is the kind of issue I just really can't be bothered to fix though
Ok, I opened https://github.com/Myriad-Dreamin/tinymist/issues/2162. Is that what you needed?
Is there anything I could do to help with issue (either technical or some sort of sponsoring)? I would really love this to be fixed before November 15th when I’ll give a Typst advertisement talk in a big open source meeting (https://capitoledulibre.org).
could you test it again?
I ran cd editors/neovim && ./bootstrap.sh editor for test and semantic highlight looks correct now.
@oak quest it works fantastically! Thank you so much ❤️ ❤️ ❤️
Note about your test that this is not only about semantic highlight, it also got rid of all the confusion from misinterpreted document changes.
I installed Tinymist on VSCode on my new PC, but for some reason, local packages are not being suggested. How can I make them show up in the suggestions? (it worked fine on my previous PC.)
Seems like when raw blocks and $ are used together, it messes up highlighting.
Apparently, this is a problem of codly + tinymist
Hi, I am trying to configure Tinymist on helix to export the pdf to output folder. What I am doing wrong?
[language-server.tinymist.config]
outputPath = "$dir/output/$name"
Thanks, but I dont understand yet 🙁
my desired location fot the output path is /home/user/Git/vault/5_Appendix/Typst/output
How I can do it?
If you use the config that sleepy mentioned where does the pdf compile to?
I cant see the compiled file 🙁
Well
Did you configure it just like this?
https://myriad-dreamin.github.io/tinymist/frontend/helix.html
Try to set it to the defaults first and see where it compiles to
Also if you maybe forgot but it asks you to install the tinymist cli
Run and configure tinymist in helix for Typst.
Features
See Tinymist Features for a list of features.
Finding Executable
To enable LSP, you must install tinymist. You can find tinymist by:
Night versions available at GitHub Actions.
Stable versions available at GitHub Releases.
If you are using the latest version of typst-ts-mode, then...
In assuming root means the project root, and dir well the dir of the typst file?
In your case one would assume vault is the project, therefore the root variable
does 0.14 work with tinymist? assuming the answer is no
Not yet.
At least on vscode with the prerelease version it works fine
Sorry for being dumb, but if root is the project what is dir?
I will try it again
Curious whether there's a way to run tinymist as a command line linter?
ie cargo clippy for Typst?
the tinymist binary (https://github.com/Myriad-Dreamin/tinymist/tree/main/crates/tinymist-cli) does have additional functionality; not sure how linting a Typst document would look like though
you can use this. https://myriad-dreamin.github.io/tinymist/feature/testing.html That's a test runner, not a linter
Thanks. I use tytanic as a runner now. Was looking more for something that could elevate warnings -> errors as a part of my CI.
That's something that i added to tytanic and i think it would be cool to add this to tinymist and typst proper, but where would it go for all programs to pick it up other than CLI options for each?
not all projects have manifests, notably most documents don't
I saw there was was an update to 0.14 on the repo
When can we expect this to hit vs code prerelease? 🙂
Weirdly it seems that the version there already is based on main?
I could add the per character justification
Maybe it's always been like that
Tinymist publishes versions of Typst main on prerelease since I think end of 2024, so yea it's been like that since a while. https://myriad-dreamin.github.io/tinymist/#label-Versioning and Release Cycle
There is a young linter feature and you could enable it by lsp configuration. I tried to make some lint checking. One of them, checking deprecated comparison between a type and a string, has many false positive. And it indicates lack of analysis framework for typst. I may switch to use codeql or continue improve the typst analyzers written in rust in future.
For typst pre-release v0.14.0-rc.1, it has been available in tinymist v0.13 nightly. For stable release, tinymist v0.14.0-rc1 was released just now. tinymist v0.14.0 will come in this weekend. Fixes for the two found minor regressions are in progress: https://github.com/Myriad-Dreamin/tinymist/issues?q=is%3Aissue state%3Aopen label%3Anightly
@oak quest incredible work! I'm very, very happy that this is progressing so well.
Personally, I'm considering giving Zed a try as an editor, and tinymist support for Zed would be a definite, and hard, requirement!
I don't know if you've tried Zed, but it looks neat.. 😄
I tried it in July, 2025 (this summer). The basic lsp features worked insanely good. I noticed some people found some problem, and they didn't report issue to tinymist's github repo. but don't expect I pay my attention to all editors continuously :).
No, no, I totally understand.
I also opened Zed, and immediately got super tired, and shut it down again.
But I cannot deal with the constant AI things in visual studio code. It is getting annoying.
Neovim requires too much intelligence to configure so I don't want to do that.
Any chance to getting help with that please?
A well kept secret about neovim is that there is no actual requirement to constantly tweak your config, although a lot of users love to do that. You can pick a good default config such as kickstart.nvim and then never tweak or update anything unless there is something that’s really getting on your nerves (and then you can ask for help).
# ~/.config/helix/languages.toml
[language-server.tinymist]
command = "tinymist"
config = { exportPdf = "onSave", outputPath = "$dir/output/$name" }
[[language]]
name = "typst"
language-servers = ["tinymist"]
that should work
you have to have Tinymist installed
For this specific project the project directory is at ~/Git/vault/Typst and I want the output files to be at ~/Git/vault/output. How this can be done?
I dont understand from the docs what is $dir and $root... thanks in advance
If i try to assume better now.
Root is just the root of your project
So lets say if you opened helix on the dir typst, root would be typst.
And dir would be all the rest of the path to the opened file.
So if its / (typst)/docs/report/main.typ dir should be docs/report, and well name is the report.typ
If you open the project from cault you could use root/output/name (or dir/name if yku wanna conserve the parh).
Or simply use an absolute path like ~/git/vault/output/name (or with home/user)
Is it possible to profile incremental compilation for a specific edit with Tinymist, like in the web app? It seems like the "Profile" button always triggers a clean compile.
click More .. and choose Profile Server. This might fit your case.
Do I understand correctly that typst-preview.nvim is not yet updated so we cannot yet use Typst 0.14.0 in neovim?
I just started it right now, with tinymist 0.14, and typst-preview works for me. For this one document
yes
I'm reminded that the default typst-preview config has it download and use that tinymist. Then you'll end up with an old tinymist of course. My configuration just uses the tinymist I install through mason, so check that
Do you mean the dependencies_bin option?
yes
I can confirm typst-preview downloads its own outdated tinymist, but I haven’t manage to prevent it yet.
Isn't typst-preview deprecated?
Or are we talking about something else
@jaunty kiln it’s a mess: there are https://github.com/chomosuke/typst-preview.nvim, https://github.com/Enter-tainer/typst-preview and https://github.com/niuiic/typst-preview.nvim which are three different things.
The one I use is chomosuke/typst-preview.nvim I don't think it's deprecated
Yes, this is also the one I use.
And I just managed to get it use the correct tinymist version.
Thanks a lot for your help as usual!
Do you know if chomosuke is here on Discord?
I’m asking out of pure lazyness to open a GitHub issue.
no idea, chomosuke has not been very active though so I'd imagine not
There are three commits in October in the repo, it’s not so bad.
just coudl update typst and tinymist and everything worked perfectly fine again
great job 👍
this typst-preview.nvim config:
dependencies_bin = {
["tinymist"] = "tinymist",
},
afaik that should just result in always using your currently installedtinymist version
Is this a known panic?
thread 'tokio-runtime-worker' panicked at library/core/src/slice/sort/shared/smallsort.rs:860:5:
user-provided comparison function does not correctly implement a total order
I actually once was bitten by this in my program. Don't remember how exactly I fixed it.
https://codeberg.org/Andrew15-5/bulk-client-renamer
typst can also crash like this IIRC https://github.com/typst/typst/issues/6285
is this specifically only with tinymist?
yeah, I wonder if that's the case. it probably is (Tinymist uses Typst's code and stuff), but only Tinymist repeatedly crashes. Typst did maybe a few times in the background.
huh, interesting. Maybe it only trips on specific values and Tinymist evaluates those more frequently for some reason.
wow, much information...
thread 'tokio-runtime-worker' panicked at library/core/src/slice/sort/shared/smallsort.rs:860:5:
user-provided comparison function does not correctly implement a total order
stack backtrace:
0: 0x55b62506b042 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h46a716bba2450163
1: 0x55b625096b03 - core::fmt::write::h275e5980d7008551
2: 0x55b6250665b3 - std::io::Write::write_fmt::h561a66a0340b6995
3: 0x55b62506ae92 - std::sys::backtrace::BacktraceLock::print::hafb9d5969adc39a0
4: 0x55b62506cad7 - std::panicking::default_hook::{{closure}}::hae2e97a5c4b2b777
5: 0x55b62506c8da - std::panicking::default_hook::h3db1b505cfc4eb79
6: 0x55b62506d472 - std::panicking::rust_panic_with_hook::h409da73ddef13937
7: 0x55b62506d1e6 - std::panicking::begin_panic_handler::{{closure}}::h159b61b27f96a9c2
8: 0x55b62506b539 - std::sys::backtrace::__rust_end_short_backtrace::h5b56844d75e766fc
9: 0x55b62506cead - __rustc[4794b31dd7191200]::rust_begin_unwind
10: 0x55b62346abd0 - core::panicking::panic_fmt::hc8737e8cca20a7c8
11: 0x55b62346b03b - core::slice::sort::shared::smallsort::panic_on_ord_violation::h5323cfd9f2ada983
12: 0x55b623b291a1 - core::slice::sort::shared::smallsort::sort8_stable::h9ff573df06b5eaf0
It also looks like not really reproducible, as hovering over the same thing again doesn't break anything. oh well...
I guess it checks out
yep, typst watch lives, tinymist lsp dies
seems like a regression related to a new panic in rust's sort algo. Not in the most recent version but some relatively new version
the primary problem is pretty simple, and to understand the bug doesn't require much knowledge about tinymist. in tinymist, values can occur in a type expression. to normalize type expression, we need to sort a vector of types. then, there is a special buggy case that is easy to understand. it panics when normalizing a type expression Union[Value(b), Value(a)], because typst values only implements partial order (PartialOrd) rather than total order (Ord).
hm, so it's just a matter of adding Ord or something?
though IIRC, partial is free, but full you need to implement yourself?
I just asked something over in off-topic but here might be a better place for it. Has anyone anyone seen a case where opening a typst file in nvim (Linux, Debian or thereabouts), with the tinymist lsp installed via Mason, causes that file to open in VSCode instead ?
OK, seems it defaults to using the 'system default program' for .typst and .typ files, as set in my file manager. Still no idea as to why though.
rg open::
crates/tinymist-cli/src/cmd/preview.rs
163: open::that_detached(format!("http://{static_server_addr}"))
crates/tinymist/src/tool/preview.rs
506: open::that_detached(format!("http://127.0.0.1:{}", addr.port()))
crates/tinymist/src/task/export.rs
758: let do_open = ::open::that_detached;
761: ::open::with_detached(path, "explorer")
it uses xdg-open etc, which use your system config
though it looks like an output file and not source
A pain in the bum if it does that when invoked from another editor...
@oak quest I’m preparing a Typst presentation talk and I’d like to make sure I use your preferred name when crediting you for Tinymist. Should I use Myriad Dreamin, Camiyoru, 紙夜 or some other name?
thank you. it would be nice to use my github name.
No problem, thanks for your answer!
Hook Script
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.
The following example demonstrates how to customize the paste behavior when pasting resources into the editing typst document.
- First, the editor client (VS Code) invokes the
tinymist.onPasteand gets the action $A$ to perform. the action $A$ contains two fieldsdir, andonConflict, wherediris the directory to store the pasted resources, andonConflictis the script to execute when a conflict occurs (i.e., the file already exists). Note thatimportstatements are allowed in the paste script. - Then, the editor client checks the physical file system. If it detects conflict when creating a resource file, it again runs the
onConflictscript to determine next behavior. - After several iterations, the editor client finally creates the resource files and inserts the corresponding Typst code into the document.
Specifically, three script hooks will be supported:
- Hook on Paste: customize the paste behavior when pasting resources into the editing typst document.
- Hook on Watch: customize the watch behavior when a file change is detected in the workspaces.
- Hook on Generating Code Actions and Lenses: adding additional code actions by typst scripting.
Customizing Paste Behavior
You could configure tinymist.onPaste to customize the paste behavior. It will be executed when pasting resources into the editing typst document. Two kinds of script code are supported:
- If the script code starts with
{and ends with}, it will be evaluated as a typst code expression. - Otherwise, it will be evaluated as a path pattern.
Path Pattern
When evaluated as a path pattern, the path variables could be used:
root: the root of the workspace.dir: the directory of the current file.name: the name of the current file.
For example, the following path pattern
$root/assets
is evaluated as /path/to/root/assets when pasting main.typ in /path/to/root/dir/main.typ.
Code Expression
When evaluated as a typst code expression, the script could use following predefined definitions:
root: the root of the workspace.dir: the directory of the current file.name: the name of the current file.join: a function to join path segments, e.g.join("a", "b", "c")returnsa/b/con Unix-like systems.
For example, the following paste script
{ join(root, "x", dir, if name.ends-with(".png") ("imgs"), name) }
is evaluated as /path/to/root/dir/imgs/main when pasting main.png in /path/to/root/dir/main.typ.
The result of the paste script could also be a dictionary with the following fields:
dir: the directory to store the pasted resources.
If the result is a string, it will be treated as the dir field, i.e. { dir: <result> } and the editor client will creates the pasted resource files in the specified directory.
More fields will be supported in the future. If you have any suggestions, please feel free to open an issue.
Customizing Watch Behavior
Note: this is not implemented yet in current version.
You could configure tinymist.onWatch to customize the watch behavior. It will be executed when a file change is detected in the workspace.
For example, debouncing time:
{ debounce("100ms") }
For example, debounce and
- export by a custom handler and postprocess using
ghostscript, - export cover (first page) as SVG.
{ if debounce("1000ms") { (
( command: "myExtension.pdfWithGhostScript" ),
( export: "svg", pages: "1" ),
) } }
And define a custom command at client side (VS Code):
async function pdfWithGhostScript() {
const pdfPath = await vscode.commands.execute("tinymist.exportPdf");
const outputPath = pdfPath.replace(/\.pdf$/, "-gs.pdf");
return new Promise((resolve, reject) => {
exec(`gs ... -sOutputFile=${outputPath} ${pdfPath}`, (error, stdout, stderr) => {
if (error) {
reject(error);
} else {
resolve(outputPath);
}
});
});
}
Hint: you could create your own vscode extension to define such custom commands.
Providing Package-Specific Code Actions
Note: this is not implemented yet in current version.
You could configure tinymist.onCodeAction to provide package-specific code actions. It will be executed when requesting code actions in the editing typst document.
For example, matching a table element and providing a code lens to open it in a Microsoft Excel:
{ if is-func and func.name == "table" {
code-lens(
title: "Open in Excel",
command: "myExtension.openTableInExcel",
arguments: (sys.inputs,),
)
} }
I finished the design about customizing paste and export behaviors in tinymist. To paste in some directory, use a path pattern like $root/$dir/$name (same as that syntax for tinymist.outputPath). This will be stable in future versions. The more complex setting (hook with typst scripting) are in experiment and may be changed in future.
Ohhh tinymist has a image paste feature?
it is definitely provided in vscode tinymist since about v0.13.10+. neovim users may also have some plugin to paste image into a typst document.
Awesome
https://github.com/Myriad-Dreamin/tinymist/pull/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.
Syntax-Only Mode
The syntax-only mode is available since tinymist v0.14.2.
When working under power-saving mode or with resource-consumed projects, typst compilations costs too much CPU and memory resources. From a simple test on a typst document with 200 pages, containing complex figures and WASM plugin calls, editing a large .typ file on a windows laptop (i9-12900H), the CPU and memory usage are as follows:
| Mode | CPU Usage | Memory Usage |
|---|---|---|
| Normal Mode | 5% ~ 12% | 0.9~1.184 GB |
| Syntax-Only Mode | 0% ~ 0.6% | 15.1~16.0 MB |
You can configure the extension to run in syntax only mode, i.e. only performing elementary tasks, like syntax checking, syntax-only code analysis and formatting by setting the tinymist.syntaxOnly to enable or onPowerSaving in the configuration.
The syntax-only mode is known to disable or disallowed:
- typst preview feature.
- label completion.
- compilation diagnostics.
The syntax-only mode will be able to work with following features:
- export PDF or other formats.
- label completion.
If there are any other features that you find it work abnormally, please report issues to the GitHub Issues.
I may have found a typo in the "Tinymist Docs".
Go to:
-> https://myriad-dreamin.github.io/tinymist/frontend/helix.html
-> "Extra Settings"
-> To enable a live preview you can use the preview.background:
[language-server.tinymist]
command = "tinymist"
config = { preview.background.enabled = true", preview.background.args = ["--data-plane-host=127.0.0.1:23635", "--invert-colors=never", "--open"] }
I think line three is missing a double quotation mark before the value true.
preview.background.enabled = "true"
Thank you for your great work!
Run and configure tinymist in helix for Typst.
Features
See Tinymist Features for a list of features.
Finding Executable
To enable LSP, you must install tinymist. You can find tinymist by:
Night versions available at GitHub Actions.
Stable versions available at GitHub Releases.
If you are using the latest version of typst-ts-mode, then...
gemini again found a trivial issue.
shading in embedded pdf gets rendered at very low resolution @oak quest
seems to be because this happens to svg output
I think this is a known issue @rough olive
I think it's not Tinymist specific. Only because Tinymist uses svg
But I couldn't find an issue in the typst repo
Does anybody else seem to have slight text rendering issues with Tinymist in VS Code, at least at small font sizes? The compiled PDF file renders beautifully in Firefox. I use the Tinymist binary bundled with the VS Code extension and the system Typst binary (Gentoo Linux package, 0.14.0). Here are the screenshots:
Okular might be a better comparison, since, like Tinymist’s preview, it doesn’t seem to support sub-pixel antialiasing:
I think the issue is hinting; tinymist renders to SVG where glyphs are drawn as plain paths.
was the preview always svg?
yes, since before tinymist even: https://enter-tainer.github.io/typst-preview/arch.html. the web app renders into an image; that might consider hinting. but tinymist uses SVG
interesting
why dont you just try using typst watch to export it as pdf in that case?
Because that’s not as clean and integrated as the preview panel.
well ya
And I wouldn’t be able to make VS Code fullscreen to hide the titlebar.
Oh 👀
Thanks for the info!
(Now to figure out how to disable hinting.)
wait why would you want to disable it? hinting is what makes it look better in firefox.
Ah, sorry, I misread your first message 😅. Also, at least when using Source Serif to render text on screen (outside of a PDF), hinting makes the letterforms look misshapen to me, which makes sense, since it forces them to align to the pixel grid.
Never had text without hinting look like that though.
even with vscode pdf extensions?
To be specific, I have Source Serif set as my system font and have hinting disabled, yet I don’t get, for example, the weird rendering of the caron on top of c that’s present in the preview panel:
maybe the aa used in vscode for svg isn't tuned for text? At this point you'd have to ask camiyoru / Myriad-Dreamin 😅
Also, now that I think about it, unless you’re saying that Firefox may apply font hinting when rendering a PDF file to the screen, not that the hinting is enabled by Typst or something, I don’t see why hinting would even be desirable for PDF files.
PDF files are usually text. SVGs are usually graphics. Most people like hinted text (debatable, nowadays I think minimal hinting is the default in most places)
I didn’t know such an extension existed 😅. I’ll take a look.
I know, but hinting is only relevant for displaying to the screen, no? I don’t imagine it being useful for printing to paper, which is (at least in my eyes) the primary purpose of PDF files.
its a rendering technology (not baked into the PDF) for screens yes which is why firefox has it; printing is separate.
Ah, so you were just referring to Firefox applying hinting itself.
latex workshop has an integrated pdf viewer that refreshes automatically, at least compared to other ones
https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop
In that case, no hinting is being applied unless Firefox is overriding the globally set value (which it doesn’t seem to be doing, since the shapes look identical to the Tinymist preview, minus some misaligned pixels).
hmm then it's the aa probably? #1260973804637786224 message
again, just guesses since I'm not using vscode. this won't solve your issue probably.
Oh 👀. I actually already have that extension installed, but I’ve never once used it, since I’ve never worked up the courage to learn LaTeX (and then Typst happened) 😅
I have not fully read the conversation. for text's subpixel rendering, there is a known issue.
If you’re referring to greyscale versus sub-pixel, Okular only has greyscale and it still looks better, which is why I included a screenshot of it after the fact. I probably should’ve just omitted the Firefox screenshot in hindisght 😅
no, i was wrong. well, more or less; aa has to do with it but it's not the cause of this being issue. see the github link above
but that is not used even if I implemented for two reasons. one is performance another is it only sharpen edges and I personally think it is still bad in low resolution devices.
Ah, I somehow missed it when searching for “rendering” in the tracker earlier 😅
Thanks for the link!
unluckily tinymist preview cannot copy homework from webapp. in short tinymist compiles and render in two separated processes but webapp do that in a single process (I know it's multiple threaded.)
Even like how Firefox renders it (second screenshot in my first message)?
you could subscribe https://github.com/Myriad-Dreamin/tinymist/pull/1903 to get notifications if there's any progress. because subpixel rendering is very slow so this pr, that runs rendering in web worker, is necessary.
Will do, thanks!
And this is why typing and moving the cursor can feel sluggish at times with the preview open, right?
you said that is pdf so I guess we could find some advanced method in pdf.js but .. I haven't read the code. maybe it is good to discuss with haryo's author (@lau). I don't have time in short future tho.
sure. the vscode in 2025 is still single threaded
haryo is a VS Code extension, or…?
it as a pdf renderer is used by typst.
Oooooh, riiiight. I thought the name sounded familiar 😅
I’ve kinda just been binge-learning Typst for the past week or so, so everything’s a bit of a blur 😅
And yeah, that’s just the PDF file compiled by Typst open in Firefox (file:///home/sandy/[path to file]).
Thanks once again for the info, everyone!
Oh wow, it has some level of Typst support 👀
Like, it literally compiled the PDF file just by telling it to show the PDF file for the currently opened Tpyst file, no further configuration required!
Thank you for bringing the extension up!
Huh, looks like it uses a bundled version of Firefox’s PDF viewer by default. Sweet!
No it doesn't, are you sure you're not using tinymist?
Uhh, I seem to have gotten my wires crossed and thought that the “Show exported PDF” button came from LaTeX Workshop 😅
Only the PDF viewer came from it it seems.
I’ve never used LaTeX Workshop before, so I have no prior experience with what buttons it provides for displaying compiled PDF files 😅
Sorry.
Got a bit too excited there 😅
Hmm. LaTeX Workshop’s integrated PDF viewer, at least when invoked by Tinymist when pressing “Show exported PDF”, doesn’t refresh at all, even with “Enable auto-refresh” ticked in the overflow menu 🫤
(And I am running typst watch […] right now.)
How much of the CPU is Tinymist expected to be taking on average? I saw there's a less demanding version coming soon, so I'm excited for that.
what
does tinymist need an extra flag to resolve symlinks to packages? my setup currently has symlinks in the @local path pointing to the actual template somewhere else and it seems like tinymist does not recognize changes from the target files as real changes while typst watch does
edit: #1266702763539304461 message
Ok I can get suggestions to show up, but only if I add a letter after @ and manually trigger autocompletion (ctrl + space)
is there no way to get suggestions simply by typing @?
okay I found https://github.com/Myriad-Dreamin/tinymist/pull/2233
But that doesn't seem to have been released on vscode
okay I installed rc1 manually with the vsix and now it works
Is it known that jumping back doesn't work well with touying?
With the exception of the first few slides clicking on the preview does nothing
thanks
Is Tinymist doing something weird here, or is Typst’s SVG output at fault?
Which version of typst and tinymist are you using
Typst 0.14.0 and Tinymist 0.14.0 as well I believe.
Ah, looks like Tinymist got a minor update a day or two ago. Give me a sec.
I wonder why Tinymist doesn’t pick up an already open preview tab when reloading the extension host when it does so when reloading the whole window.
Oh, and the PDF and preview were in agreement once again when I reduced the inset by 0.002mm.
Hmm, I can’t reproduce the problem now (“Vrednovanje” doesn’t get broken up at an inset of 4.917mm in the PDF). Weird.
Just updated to latest using cargo install git, the lsp stopped working for me in helix
Any solutions?
This is my config:
[[language]]
name = "typst"
language-servers = ["tinymist", "harper-ls"]
formatter.command = "typstyle"
[language-server.tinymist.config]
exportPdf = "onSave"
is anyone getting this error with firefox when using tinymist?
[[language]]
language-servers = ["tinymist", "harper-ls"]
name = "typst"
[language-server.harper-ls]
args = ["--stdio"]
command = "harper-ls"
[language-server.tinymist]
command = "tinymist"
[language-server.tinymist.config]
exportPdf = "onType"
formatterMode = "typstyle"
[language-server.tinymist.config.preview]
cursorIndicator = true
scrollSync = true
[language-server.tinymist.config.preview.background]
args = ["--data-plane-host=127.0.0.1:3635", "--invert-colors=never", "--open"]
enabled = true
im using nixos, but this is the .config/helix/languages.toml that is generated
can you try replacing https:// with http:// at your url bar?
that was it, thank you!
when tinymist ext in zed?
The typst extension itself uses tinymist (as lsp)
yeah it isn't familiar like vscode.... it doesnt have preview inside it instantly or 1 click export.....
🥀
Oh yeah I get that it's sad but
Zed is still in development so I don't think it can even render a tiny browser or pdf like vscode
On the meantime the most one can is use typst watch with a pdf that reloads or
Initialize the tinymist preview and go to browser localhost which there's an issue in the extension related to it
Is there an easy way to get the full Typst source (with include command resolved) of a Typst file with Tinymist, say to check for spelling errors using a tool?
If you're looking for spell check there are some things that work out of the box such as harper-ls (only English though) or typst-language-tool (any language that language tool can do)
I don't think tinymist or typst have that feature to look at includes resolved
Great, thanks. My idea was to run an LLM over my exercises and look for errors (both spelling and content)
tinymist is not rendering the preview when using vscode web server proxy
so do i have to build it from source?
No, it's not yet solved. Just want to tell you there's a similar existing issue
In the vscode, using Tinymist, I started to get these artifacts on the PDF preview window. I'm not sure what's causing it. Has anyone mentioned any related issues?
I have a formatter question. When using tinymist in neovim, how can we give arguments to typstyle? On the command line I can run typstyle --wrap-text -l 80 myfile.typ for instance. How can I do that from neovim?
Nevermind, I found the info in https://github.com/Myriad-Dreamin/tinymist/blob/main/editors/neovim/Configuration.md. I’ll try to remember to open a doc PR to make this easier to find.
Actually one thing is not clear to me: is the formatterProseWrap only for typstyle or does it apply also to the other formatter?
It works for both typstyle and typstfmt
Thanks. I opened https://github.com/Myriad-Dreamin/tinymist/pull/2322 to propose making all this more visible.
If I have some questions about how to achieve something with reflexo-typst/typst.ts, where should I ask them? Is this a good place?
Would it be possible to preview the HTML format in VSCode (similar to markdown) with tinymist instead of SVG or PDF? It would be great for replacing markdown in many cases and not having to use LaTeX for that :3
Oh! I already found the setting! But the equations still don't render to HTML, I get a lot of warnings 😭
Maybe we need a reflexo post @jaunty kiln
Is there a way to disable autocompletion of parentheses for function names?
I always end up with func()(args) which is annoying
+1
i have a certain function i always call with [] but tinymist autocompletes it with () so i have to either ignore autocompletion or remove the parens afterwards
also happens when typing #show: func
funcy!
oh i actually face that too
elaborate? I don't yet get in which editor which functions will complete func()(|)
In VS Code, by default, if func is in scope as a function, then typing fun| autocompletes to func(|). Very often, I just want func|.
E.g., in items.map(func) or func[content], or if I'm passing a function around by name
Worse, fun|c() autocompletes to func(|)()
for the first case I think it will be smart enough if we get a func completed without parentheses if it is used as a function argument.
I want less smart, not more smart. The editor cannot know if I intend to call the function or just refer to it nominally.
At least it should be configurable/able to be disabled
for the second case you could use func.bracket. I think you have seen some of them in the list of completions
but in the items.map(func) if func returns a content it is never valid (incorrect type) if we complete with parentheses.
Sure, but oftern when func is of type function, I still want to type its name without calling it
Currently, autocompleting a function name requires you to backwards and forwards delete afterwards if you don't want () following the function name, which gets slightly in the way of editing
in which cases? I believe most people will feel convenient if language servers can handle parentheses nicely.
Cases like these, which can be more common in scripting.
so I collect cases to improve it.
Don't you think it would be good to make function call completion a setting so it can be disabled if some people find it annoying?
i often avoid adding options to fix issues, instead I consider only if an option has clear behaviors. of course a completion.funcBraces has clear behaviors because we know we never get braces in results.
Personally I'd consider the completion behaviour of fun| -> func(|) as broken because there are too many false-positives in terms of my intention to insert parentheses
yeah I think if you are not a package developer or a functional programming enthusiast, in 99% cases you could rely on the language server to analyze your code and complete parentheses smartly. therefore I think I should fix some common cases instead of encouraging people to disallow parentheses showing up.
how much you feel about embedding "main file" metadata in source files? Is it kind of against intuition or could there be a simpler solution? example:
// chapter.typ
#metadata("/path/to/main.typ") <main-file-path>
context, the idea is from: https://github.com/Myriad-Dreamin/tinymist/issues/2334#issuecomment-3705402237
If it helps tinymist then why not?
I feel like I'm against it..
I'm working on a document. +- 58 pages, max 5 small images and no CETZ and the like, only text and indeed an index (in-dexter with for the moment 81 terms but that will most certainly increase). Tinymist is, after some hours, using +5,5GB RAM, typst itself 1,1GB with typst watch. is this to be expected as far as memory usage goes? because now my computer can only barely run this but the document has to get longer then this. I know that I can switch to only lsp mode, but that means losing quite some functionality... the more I edit the file, the more the memory usage of Tinymist keeps increasing.
I'm confused. Why are you using both Tinymist and typst watch at the same time?
Tinymist already has preview built in, which will be much faster
And you dont get double the memory consumption
But yeah, it doesn't sound terribly unusual. What you can do is restart Tinymist once in a while.
most of the time I left the compile off, because my computer doesn't have enough memory right now. I just ran typst for 10 minutes at the end of the day.
The lsp functionality already requires the compiler to run
ah, thanks, didn't know that
Coming back to that
I just see the typst watch a bit broken for large documents
Broken as the memory increases really much
If it's reproducible you should report it
Ok so not broken
For small documents is totally fine but there should be an easier way for typst to restart the memory usage after a while
Reduced memory usage is on the roadmap
As for your case, it's basically the issue I had and all I can recommend is just using typst compile, but with task file watch which will watch any typst files you tell it to and it'll simply recompile it, it's a bit slower but it's decent
If typst watch is only using 1.1 GB that shouldn't be necessary
And well disabling tinymist lsp, recently it was added a syntax only feature which consumes little memory and doesn't increase
thanks! the extra features are really nice of tinymist, but I'll have to do that indeed for the time being.
I assume it's directly translated from chinese
ept must be the antithesis to inept? I think tinymist is very ept 😆
I thought it was apt
apparently yes, apt is the antithesis to inept, that's cool
Hey, does formatting work for you in neovim? I followed all the docs but can't make it work, I use nvchad with conform (I don't know if that's useful)
apparently i'm not the only one having this problem.. Also when using vscode, when the formatting runs the cursor goes at the end of the file, is it common?
yes, it does work for me. I did some extra setup of formatexpr though, not sure if it's still necessary
Did you read https://myriad-dreamin.github.io/tinymist/frontend/neovim.html#label-Formatting already?
If yes and it still doesn’t work then we’ll need more information about your configuration.
currently I format by calling typstyle in command line
conform.lua:
local options = {
formatters_by_ft = {
lua = { "stylua" },
-- css = { "prettier" },
tex = { "latexindent" },
typst = { "tinymist", lsp_format = "prefer" },
-- html = { "prettier" },
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_fallback = true,
},
}
return options
lspconfig.lua:
require("nvchad.configs.lspconfig").defaults()
local servers = { "html", "cssls", "ruff", "ty", "clangd", "basedpyright", "rust-analyzer", "markdownlint" }
vim.lsp.enable(servers)
-- read :h vim.lsp.config for changing options of lsp servers
vim.lsp.enable {
-- Python
"ruff",
-- basedpyright
-- "basedpyright",
-- Typst
"tinymist",
}
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend("force", capabilities, require("blink.cmp").get_lsp_capabilities({}, false))
vim.lsp.config("*", {
capabilities = capabilities,
})
vim.lsp.config("tinymist", {
cmd = { "tinymist" },
filetypes = { "typst" },
settings = {
formatterMode = "typstyle",
semanticTokens = "disable",
exportpdf = "onSave",
},
})
if i try to format it says "Formatters unavailable for typst file"
newest tinymist installed?
yes thanks, the config seems to be correct
yes
if i remove the typst = { "tinymist", lsp_format = "prefer" }, line from conform the format command simply does nothing
just for information gathering I would maybe try disable conform and try again
while checking what the set value of formatexpr is
I would expect formatexpr=v:lua.vim.lsp.formatexpr() and that it works with tinymist
thanks, i disabled conform, now how can i get the value of formatexpr^
it's empty
ok, I don't know why that would happen, it should be set when tinymist lsp is activated
the tinymist lsp commands work (i.e. exports)
also, i am using windows
What happens when you directly call :lua vim.lsp.buf.format()?
What if you also set
formatterProseWrap = true,
formatterPrintWidth = 80,
formatterIndentSize = 4,
as shown in the docs?
i reactivated conform
it says [LSP] Format request failed, no matching language servers.
So something is indeed broken in your lsp setup.
added, same results
Is :checkhealth vim.lsp mentionning tinymist at all?
Sure, if the tinymist lsp is not running at all then setting options for it won’t have any effect.
vim.lsp: Active Clients ~
- tinymist (id: 1)
- Version: 0.14.8
- Root directory: ~\Desktop\tesi_phd_TYPST_NUOVA
- Command: { "tinymist" }
- Settings: {}
- Attached buffers: 1
it is mentioned and i have lsp commands such as exports
That’s super weird. It says tinymist is active and then complains it’s not??
yes, i found also other people posted this on reddit but no one had a solution
In desperation, I tried to move to the new lsp-config… Oh boy. This is what I have now: vim.lsp.enable("tinymist") and in .config/nvim/lsp/tinymist.lua, the following: return { cmd = { "tinymist" }, filetypes = { "typst" }, settings = { formatterMode = "typstyle", }, } The LSP works just fine (I can see errors and wa...
What if you insist with lua vim.lsp.buf.format{id = 1}?
[LSP] Format request failed, no matching language servers
do you use mason?
I installed tinymist system wide
Yes, I use Mason.
You can see my full neovim config at https://github.com/PatrickMassot/neovim_config/
A lot of it is completely irrelevant of course, but this is a config I use with tinymist.
thank you, i'll try to find the culprit
There are two classical ways you could go about this: try with a minimal config and then add more and more of your config until it doesn’t work, or go in the other direction, removing things in your config until it works.
maybe nvchad is the problem, because i didnt customize it at all and tried all the combinations
Unfortunately this kind of mess comes with the freedom to mix plugins in Neovim: you’re free to choose but interactions between those choices can be very non-obvious.
or not using mason
Oh, do you simply try to add tinymist on top of a vanilla NVChad? I could try reproducing then.
yes let me try, with mason this time
Ok, I can tell you the following: running git clone https://github.com/NvChad/starter ~/.config/nvchad then putting in .config/nvchad/lua/configs/lspconfig.lua
require("nvchad.configs.lspconfig").defaults()
local servers = { "html", "cssls", "tinymist" }
vim.lsp.enable(servers)
vim.lsp.config("tinymist", {
cmd = { "tinymist" },
filetypes = { "typst" },
settings = {
formatterMode = "typstyle",
semanticTokens = "disable",
exportpdf = "onSave",
},
})
-- read :h vim.lsp.config for changing options of lsp servers
then running
NVIM_APPNAME=nvchad nvim test.typ and :Mason to install tinymist then I get formatting that works.
So really this is using vanilla nvchad with editing only that lsp config file.
Ok, i replicated exactly the same steps, (both using :Mason and :Masoninstallall) and... it doesn't work
it could be a windows problem..
thanks for your availability
** not even in WSL
actually, I tried using your config and it works.... in WSL at least
I retried on my original config, and gq actually works... but the format in nvchad doesnt, what does it mean? does gq use a different system?
i mean, it only wraps the lines
I don’t know anything about Windows, sorry. The most recent Windows I used is Windows 98.
gq has a different fallback, but it should use formatexpr if you have it
Tinymist should add the ability to wrap selected text in an italic or bold environment.
In vscode you have ctrl i or b for easy wrapping
Is that zed? If it is, I think it depends mostly on the extension rather than the lsp for what I mentioned.
has anyone experienced that even with --open, tinymist fails to open the browser preview automatically? this does not happen on my main system but only on my MacBook with iTerm2 and helix
the only log line that seemed out of place is this one
2026-01-14T13:13:41.302 helix_term::application [WARN] Ignoring a client/registerCapability request because dynamic capability registration is not enabled. Please report this upstream to the language server
it does work with helix on my arch system
ok that log line seems irrelevant
2026-01-14T19:48:32.399 helix_lsp::transport [ERROR] tinymist err <- "[2026-01-14T18:48:32Z INFO tinymist::tool::preview::http] preview server listening on http://127.0.0.1:23635\n"
2026-01-14T19:48:32.399 helix_lsp::transport [ERROR] tinymist err <- "[2026-01-14T18:48:32Z INFO tinymist::tool::preview] PreviewTask(default_preview): preview server listening on: 127.0.0.1:23635\n"
this just never gets logged without explicitly starting it myself
I will add a small but fancy change to help develop better typst previewer. https://github.com/Myriad-Dreamin/tinymist/pull/2357
Besides rendering in vscode webview, some other frontend may be supported like Qt. https://docs.slint.dev/latest/docs/slint/guide/backends-and-renderers/backend_qt/
The Qt backend supports practically all relevant operating systems and windowing systems, including macOS, Windows, Linux with Wayland and X11, and direct full-screen rendering via KMS or proprietary drivers.
The backend (tinymist-cli) is not changed, and frontend implementations will get data from the backend using websocket.
Ray traced rendering 🚀
renders nicely with vello gpu (webgpu)
I borrowed some code from https://github.com/voxell-tech/velyst
ok the problem seems to be that open (the crate used to open the browser) is not getting compiled or rather the feature that enables the usage of the open crate is not enabled even though it should be. I've checked this by putting debug logs into the the feature-gated part of the preview code (#[cfg(feature="open")]) which then didnt print when manually recompiling
truly strange since i can see Compiling open v5.3.3... while compiling tinymist
This PR fixes #2361. After splitting crates in #2027, the open feature gate was not set up and propagate correctly.
Thank you!
I will try it in a bit
I haven't tried it, but I fixed it according to your clear report. I'm going to go sleep right now because I have to go to work early tomorrow :).
can confirm now that it works
ok quite frankly idk if that was actually the cause. it does work fine when manually calling tinymist preview ... now but it didnt change anything in helix but then I realized I had been using the preview.browsing.args instead of preview.background.args
and with that it works instantly
idk why i assumed the startDefaultPreview feature would start automatically
This is viewed as a bad design if you had times misconfigured it. I may change it in future, while I need to sit down and explore what I can do to make it better.
i think the main issue was that the docs are somewhat unclear on the precise difference between "default preview" and "background preview" cause both can run "in the background" and both can be started up and both can be appended with the --open flag but only one starts together with the LSP
dont get me wrong, i was a bit of a fool myself there
What I can see that in this case, because the type of body is annotated, then it gives you an extra completion option called foo.bracket that will expand to foo[]
/// - body (content): this is the body's description
#let foo(a: true, b: false, body) = { body }
This previewer now supports multiple pages, most typst elements, scrolling, and bidirectional jump
🐱 for clicking view panel to jump to a source location, I captured raw physical pointer event, calculated bbox of typst elements, and then requested to scroll vsc editor.
In some sense I bind events to the typst elements. I mean I may be on the road of "TypstView". "WebView" serves interactive html and "TypstView" serves interactive typst.
While I'm not the first to achieve interactive Typst (vellyst did so first), my approach is different. Rather than using the Bevy, the game engine, I built it on Xilem, a Rust GUI framework. This makes some differences. For example, there is an accessibility layer in xilem, and I can enrich accessibility of typst elements in the previewer UI. You can nicely select text in the document, and you could let your screen reader to read content loudly.
moreover, xilem has web backend, and we may have both perfect appearance and accessibility for showing typst documents in browsers by this xilem viewer in future.
The following Rust projects already integrate AccessKit:
- Bevy, egui, Freya, Slint, Xilem
😄 but vellyst could also implement accessibility layer for typst elements, because both bevy and xilem use AccessKit. They didn't do it for some reason.
Does anyone know the tools used to create the tinymist documentation website? They are quiet beautiful. (Sorry if off topic)
that would be shiroa; you can see how Tinymist's docs site is built in the CI workflow: https://github.com/Myriad-Dreamin/tinymist/blob/main/.github/workflows/gh-pages.yml
I'm using the tinymist extension on vscode and each time the preview is updated my cursor jumps to it. Is there a way to prevent this ?
Are you talking about this https://myriad-dreamin.github.io/tinymist/config/vscode.html#label-tinymist.preview.scrollSync?
No, it's just that it defocuses the cursor of the editor, so I have to click back each time I update the document
that sounds like a bug on your system
what os, version of vscode, and version of tinymist are you using?
I'm using it on windows 11 with the latest version of vscode (1.109.0) and tinymist(0.14.10)
are u previewing inside vscode or with an external browser?
Okay nevermind I got it
I have to click on the preview text at the beginning of the document and not the pdf icon
Is there a way to use the scrollPreview command on helix?
I find like, one other person with the same question and nobody has answered them
now in helix you could invoke scroll preview command with file path and a cursor position, but I don't know whether helix has some APIs to obtain current position.
you can obtain current byte
sys.inputs.x-preview is set by tinymist both for preview and for PDF export (at least in VS Code through the relevant action). Is that intended? To me it would seem like the export should not be treated as a preview.
this is a known "feature" for two reasons. first the pdf output is used for "pdf preview". second the server needs to compile twice per user edit if it doesn't set x-preview for pdf output but set one for preview, which uses much more resources.
Ah I see, I have the auto export always turned off, so I didn't think about that...
I didn't think pdf was used for preview?
Has that changed?
I guess "pdf preview" in quotes here means paged preview. In any case most intermediate compilation results can be reused between preview and file output.
Heya !
Here's an issue that I'm having on tinymist (latest) on neovim (latest as well). Here are the Lsp Log :
[ERROR][2026-03-11 11:48:42] ...p/_transport.lua:36 "rpc" "tinymist" "stderr" '[2026-03-11T10:48:42Z INFO tinymist::cmd::lsp] tinymist version information: [["Build Timestamp", "2026-01-23T19:03:26.361656266Z"], ["Build Git Describe", "VERGEN_IDEMPOTENT_OUTPUT"], ["Commit SHA", "VERGEN_IDEMPOTENT_OUTPUT"], ["Commit Date", "None"], ["Commit Branch", "None"], ["Cargo Target Triple", "x86_64-unknown-linux-gnu"], ["Typst Version", "0.14.2"], ["Typst Source", "git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist/v0.14.6-rc2#28af048d65cbb7a5fc78f3ca1a20c9e885384a62"]]\n[2026-03-11T10:48:42Z INFO tinymist::cmd::lsp] starting language server: LspArgs { mirror: MirrorArgs { mirror: "", replay: "" }, font: CompileFontArgs { font_paths: [], ignore_system_fonts: false } }\n[2026-03-11T10:48:42Z INFO tinymist::config] ServerState: config update_by_map {}\n'
[ERROR][2026-03-11 11:48:42] ...p/_transport.lua:36 "rpc" "tinymist" "stderr" '[2026-03-11T10:48:42Z INFO tinymist::tool::preview] Stopping all preview tasks\n[2026-03-11T10:48:42Z INFO tinymist::project] ServerState: creating ProjectState, entry: EntryState { root: None, main: None }, inputs: {"x-preview": "{\\"version\\":1,\\"theme\\":\\"\\"}"}\n'
[WARN][2026-03-11 11:48:42] ...m/lsp/client.lua:887 "The language server tinymist triggers a registerCapability handler for workspace/didChangeConfiguration despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[ERROR][2026-03-11 11:48:46] ...p/_transport.lua:36 "rpc" "tinymist" "stderr" "[2026-03-11T10:48:46Z WARN tinymist_analysis::location] LSP position is out of bounds: Position { line: 1, character: 1 }, while only 2 lines and Some(1..1) characters at the end.\n"
Is it a known issue ? I'm on default settings for the LSP
what should we look at in this log? there are 'ERROR' marks there but I would guess that they are not errors.
Sorry, I should have specified better lol
On the last line it says "position is out of bounds"
It seems similar to an old tinymist / nvim issue that I found on the internet (from may 2024) but the "fix" there didn't work
And the commit that should've fixed the issue got merged long ago
oh I see. I scanned from the top and didn't get all the way to the end it seems like 🙂
it still looks to me as if that line has the tag [ERROR] by nvim but the tag WARN by tinymist. Maybe it's that anything from stderr will get the tag [ERROR]
Tinymist does in fact not crash but semantic analysis doesn't work
Did a full clean slate of nvim/tinymist and it seems the issue is gone
I'll try to reproduce it anyway
We really oughta have a "wrap with inline/display math blocks" code action for VS Code.
for inline you can just type $ and it'll wrap the selection (same as other delimiters like ()
Alright, fair enough, but I'm using a Vim-motion extension, and having to switch to insert mode and then highlighting the area I want to wrap is rather tedious. I'd rather have something that can do that in visual mode.
Is it possible to look into getting this PR (https://github.com/Myriad-Dreamin/tinymist/pull/2414) merged soon? It should be a simple change and allows for better relative url handling which allows the preview to be hosted under different paths than the root path.
Q: Is this previewer now built-in or do I need to do any extra tricks?
it will be released as a vscode extension. The binary will be also uploaded to GitHub Releases once it becomes usable. To use it, we will be able to configure tinymist extension to use the GPU-based previewer from the newly installed vscode extension.
But this is Tinymist 14.2.
0.14.12 is the latest stable tinymist version
Hmmm, I'm trying to compile tinymist-task, but I'm hitting
error[E0603]: module `tag` is private
--> C:\projects\tinymist\crates\tinymist-task\src\compute\text.rs:5:31
|
5 | use typst_html::{HtmlNode::*, tag};
| ^^^ private module
|
This issue makes it seem like I should be pinning typst to some specific commit and placing it into a [patch.crates-io] section in my Cargo.toml, but it doesn't seem to want to use the patch for v0.14.0 -- which version should I be pinning to?
Cherry pick the diff commits on this tag to your branch. https://github.com/Myriad-Dreamin/typst/commits/tinymist/v0.14.6-rc2/
Hey @oak quest is there any way to get tinymist to send me something I could turn into a pdf, if I have a websocket connection with it?
tinymist.exportPdf
Can I just... send that through the websocket o.O
That's an LSP command
(I'm referring to the preview server)
Then I guess you can't
You can try RenderActorRequest::RenderFullLatest
Can be triggered by simply sending "current"
But there's no way to directly transform these bytes into pdf
what exactly do you want to do?
In this case it's really not an XY problem 😅
I'm making an in-terminal viewer, not that different from what Myriad-Dreamin is currently working on in the tinymist viewer with vello. The only big feature I'm missing from the web app is export to pdf.
The usecase for me would (hypothetically) be using this over an ssh session, so I'd like to have the pdf readily available so that I can send them across ssh to my client without needing to ssh directly into my machine, export, and scp over. (As for how to send that info across a terminal, see this and set inline to false -- it surprisingly just ends up downloading into ~/Downloads)
why not simply use the typst cli?
Sharing here for added visibility.
Added context: Im doing a monorepo approach with the template and multiple books in the same repo.
Follow-up question regarding point 3, a user mentionned typst database lock which could be use for multi-file projects. I had the follow up question:
I don't really understand that approach. Why does it do this complex history/preview tracking instead of simply letting the user provide roots (like one does in workspace settings for cargo, you explicitely provide members)?
i followed your discussion there a bit, and from emilia's link https://myriad-dreamin.github.io/tinymist/feature/project.html:
The language server will serve the previewed file as the main file when previewing a file.
is there any problem with using this way of looking at each of your multiple books?
when I work with tinymist, including in monorepos, I just preview whatever's the main file and it works fine. Are/were you doing something different or similar, and what specific problems did it cause? I'll reread your messages too
Interesting, I'll keep that in mind thanks.
(pictured repo has no dependencies between projects, but it's worked fine even when it has)
No your understanding is correct. It wasn't clear to me, since I often edit without any preview open (e.g. when working on more code-y aspects)
ahh i see, yeah that would do it
i'm going to repro your thing above but yeah that seems problematic. and possibly solved by the lockfile solution 🤔
ah when i do it, I don't seem to get errors in A.typ either 💀 but yeah it looks like tinymist is still in ways rough around edges
Once a main file is somehow pinned (either via a command or by opening a preview as you suggested) it seems to work good enough for me.
Points 1 and 2 are still are annoying but manageable. Just to confirm, are you aware that these are limitations and not errors on my part? IIUC, the single error thing might just be typst's compiler bailing out on the first error it sees instead of emitting all of them.
- dead functions indeed look unchecked. yeah, that's annoying what the heck.
- only one error, yep. Looks like an issue in the web app as well :/
i agree that the dev/lsp experience in typst seems less polished than what I'm used to (and what you're used to as well, since you at minimum mentioned cargo and thus rust)
Thanks for confirming, I appreciate it 😊
Yeah I work with rust professionally so I am a bit spoiled when it comes to tooling and compilers 😄 Ofc I don't expect the compiler or tinymist to be fully mature, but I thought those were pretty surprising missing features. I couldnt find open issues either, but I didnt look thoroughly tbf.
in future we may write typst script to notify and handle PDF updates, but that is still not through preview's websocket.
I didn't submit a PR because I didn't consult anyone on design or anything, but if you'd like me to, I'm happy to open one 🙂
what‘s the usecase of this exactly?
doesn‘t tinymist itself already allow exporting pdf
When your project lives on a different computer than the one you're actually typing on
Sure, but then I have to go and scp it over, which is more annoying than being able to just press e and get it sent directly into my local downloads folder
I had some issue setting projectResolution to lockDatabase in the Zed project settings. It turned out that tinymist (or rather the typst-zed extension) ignores project settings entirely. However I do wonder why the setting projectResolution is even needed; couldn't tinymist just check whether there is a tinymist.lock file and use it if possible?
Setting it in the Zed settings does work, however the path tinymist tries to load the lock file from seems wrong:
[2026-04-05T11:19:46Z INFO tinymist::route] failed to load lock at "/Users/timo/Documents/University/Background on p-adic Modular Forms/main.typ": tinymist.lock: failed to open: /Users/timo/Documents/University/Background on p-adic Modular Forms/main.typ/tinymist.lock
is there an issue with the cli not refreshing the browser page? every time i run tinymist preview i need to quit and start the program again to get it to update with file changes. is this supposed to happen?
Though if you restart the preview server for some reason ("every time i run tinymist preview") a reload may indeed be required
IIRC it does try to reconnect but I've had issues with that, particularly when running the preview attached to my editor and not via the separate tinymist binary, due to the port changing for some reason. You can probably fix that with configuration though: https://myriad-dreamin.github.io/tinymist/feature/preview.html
i tried it with partial rendering to true but i still get this error
[2026-04-11T13:41:02Z INFO tinymist_preview::actor::webview] WebviewActor: received unknown message from websocket: unsupported message Err(cannot serve_with websocket, with [("err", "WebSocket protocol error: Sending after closing is not allowed")])
i tried with both firefox and chrome
i'm on linux mint
gonna look into the code for this
I searched around and this piece of settings fixed formatter in Zed editor
"lsp": {
"tinymist": {
"settings": {
"formatterMode": "typstyle",
},
},
},
In order to use the formatter I need to install typstyle? Or is it included in the LSP?
Not exactly sure. I have the in-market "Typst" extension in Zed and a portable tinymist binary in my ~/.local/bin. I never heard of the term "typstyle".
I think tinymist bundles the formatter in the binary since a while
The formatter being typstyle
Someone configured formatting with helix so the formatting is done without external typstyle?
I run into an issue with the latest plugin version in VS Code on Windows 10. When I tried to click "Export PDF" text at the top of a Typst file, it failed to run the tinymist.exportPdf action or something. While having no trouble with built-in live preview (though looks like it's not anti-aliased). What's up with that? Is this a config issue?
So...I tried it again, and there is actually "Export" and "PDF." Not only that, but now PDF creation just works. Weird, but perhaps just a reboot helped.
I think on neovim it shouldn't show "Export", because "Export" redirects user to a more user-friendly GUI tool in vscode.
Neovim? It doesn't have this feature in the first place. Unless there is some plugin for that.
you can access tinymist.exportPdf in neovim, it's made into a command by nvim-lspconfig. But I also don't know the context...
This is the context. But the error went away, so I can't reproduce.
Hi, I am running Typst in vscode and now suddenly it stoped working and is saying Tinymist cannot connect and client is not running. Do you know what can be the reason? I upload the output
looks like there's actually something wrong here; it can't resolve a path in your project for some reason. So unless you're in a weird setup where it could be conceivable that the file can't be read, you might be running into a bug
but I'm not familiar with the code base so can't say; @oak quest can probably tell you what the next steps in troubleshooting this are 😅
Ok thank you
if you don't get an answer, I'd file an issue at https://github.com/Myriad-Dreamin/tinymist with that report and any information you can share regarding your project / what steps caused this to pop up if any
hope this can be resolved soon
Thanks man, let's see if @oak quest answers and I tell you
It crashes on the following code:
id.vpath().as_rooted_path().parent().unwrap().to_path_buf()
Seeing the line, it was ever changing main file to the root directory \ 🤔 :
[2026-05-01T17:41:07Z INFO tinymist::input] the task of the primary is changing to TaskInputs { entry: Some(EntryState { root: Some("c:\\Users\\pablo\\Desktop\\UNIVERSIDAD\\Máster\\Cranfield\\Thesis\\Typst\\main.typ"), main: Some(@ws/p1:0.0.0\) }), inputs: None }
while I cannot find a bug intermediately, the log does contain some useful information. I might try to catch the bug in these days.
I leave you here the full output thank you so much @oak quest
Tell me and I share you the whole project
Interesting. Can someone show me how the JSON invert element map works?
there're some examples in the cli help
--invert-colors <INVERT_COLORS>
Configure the way to invert colors of the preview.
This is useful for dark themes without cost.
Please note you could see the original colors when you hover elements in the preview.
It is also possible to specify strategy to each element kind by an object map in JSON
format.
Possible element kinds: - `image`: Images in the preview. - `rest`: Rest elements in the
preview.
By default, the preview will never invert colors.
## Example
By string:
`shell --invert-colors=auto `
By element:
`shell --invert-colors='{"rest": "always", "image": "never"}' `
Hi, all. Is there a way to define the signature of a function? I notice that I can give each argument a description with - arg: description in the docstring. But - arg (type): description does not affect the signature.
@oak quest what is the status of the gpu renderer?
what I can see, the latter does influence the signature in tinymist - it can add type information, but it doesn't override type inference
The ability to fold code in typst files in zed should come from tinymist? Or is it something with Zed?
I wish I could fold sections😅
I believe folds could be provided by the extension as tree sitter queries
Ah no that's code outline
Thanks! So there is any walk around on how to make it?
The docs for language extensions don't mention anything regarding code folding so I figure it must be provided by the editor itself
Presumably by the structure of the tree sitter syntax tree
where does the tinymist compiler store downloaded packages?
i'm on macos;
looked in ~/Library/Application Support and ~/.local/share
there is no typst nor tinymist folders
try ~/.cache/typst
The Typst compiler downloads packages from the preview namespace on-demand. Once used, they are cached in {cache-dir}/typst/packages/preview where {cache-dir} is ... ~/Library/Caches on macOS
I would think Tinymist had it's own separate cache
funnily enough i wouldnt but idk
maybe, but if not, they haven't checked library/caches yet
and i would also assume an lsp wouldn't have a separate cache, but nothing's stopping it ig
Well the lsp is also a typst compiler
tinymist is literally shipping with a forked version of the typst compiler (but the divergence is pretty small)
nop :[
oooooo
that one worked :3
they can still use TYPST_PACKAGE_PATH and TYPST_PACKAGE_CACHE_PATH though
so if I want to work on my local package
do I create a directory 'local' at the same level as 'preview'?
you should store local packages in [the platform dependant dir]..local/share/typst/packages/local
The cache directory is used for universe packages so you can purge them after some time without deleting local work for example; some people run software that does that (semi-) automatically so its very much not recommended to store important stuff there
oh
I guess there is nothing stoping you from using one or the other, but that's the general wisdom so far 😅
i mean .local/share/typst doesn't exist
do i just create it and it should work?
(i'm on macos reminder)
ah wait. no one sec
~/Library/Application Support on macOS
from the link saffronner sent
so ~/Library/Application Support/typst/packages/[namespace]/...
yaaaaaaa
all works
tysm!
yep yep, i found the docs for packaging (at that repo) super nice when i was making my own package
(it answered your exact question here:
Local packages
Want to install a package locally on your system without publishing it or experiment with it before publishing?
:p )
poking around the links there could be big if you're looking to publish or just dev your own package
i mean i also found those docs
but the directories did not exist ;[
so I thought tinymist installed somewhere else
@oak quest Is there any documentation about tinymist/documentOutline? I can see in VSCode server traces things like Received notification 'tinymist/documentOutline'. which strongly suggest that the outline panel content is directly sent by the LSP server, but I don’t know how to catch these notifications in other editors. It seems to be a notification sent by the server, not a response to a request. What makes the server send this notification? I don’t see them in neovim lsp logs.
it will only be sent when preview is enabled
https://github.com/Myriad-Dreamin/tinymist/blob/86d67534fca3043af0be9f829a4a1d50e1417f05/crates/typst-preview/src/actor/render.rs#L370
https://github.com/Myriad-Dreamin/tinymist/blob/86d67534fca3043af0be9f829a4a1d50e1417f05/crates/typst-preview/src/actor/editor.rs#L198
https://github.com/Myriad-Dreamin/tinymist/blob/86d67534fca3043af0be9f829a4a1d50e1417f05/crates/tinymist/src/tool/preview.rs#L482
Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst]. - Myriad-Dreamin/tinymist
Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst]. - Myriad-Dreamin/tinymist
Thanks, but do you know how to enable preview? Is there a request to send? Or some parameter when launching the server?
Two ways of previewing a Typst document are provided: PDF Preview: let lsp export your PDF on typed, and open related PDF by your favorite PDF viewer. Web (SVG) Preview: use builtin preview feature.
Whenever you can get a web preview feature, it is recommended since it is much faster than PDF preview and provides bidirectional navigation featur...
Isn’t this meant to be on whenever using https://github.com/chomosuke/typst-preview.nvim ? I certainly use that preview plugin and I don’t see the outline notification in lsp logs.
no. typst-preview.nvim starts another tinymist process to as a preview server, to make tinymist send tinymist/documentOutline, you should use background preview configuration or tinymist.startDefaultPreview command.
also in VSCode, there're two "outline" panels, the outline panel in the explorer is driven by textDocument/documentSymbol while the one in the tinymist panel is driven by tinymist/documentOutline
for the helix users, is there a nicer way to know when errors come from packages rather than guessing when compilation / preview stops working and i have to hit <space + D> to open the workspace diagnostics picker?
usually i get errors inline, for this template i have an assert that this argument cannot be none under certain circumstances but i would never know that until i notice preview no longer working
and opening space+D
(cc: @buoyant sand maybe)
Nope, I saw this right away, but I don't write typst a lot atm so I don't know.
sadge
im sorry?
ph
*oh
as far as i can tell (i havent been writing typst lately), nope
Maybe i just never bothered fully configuring tinymist on helix though
I think neovim has kind of the same problem, and I've attempted to open and issue about it, but the issue is maybe not well enough explained. (Issue in tinymist)
Are there still performance issues with tinymist?
Thanks a lot for you help. I’m sorry, I really tried but this is not enough to get me unstuck. I tried extending the tinymist options in my neovim config to enable this background.preview but I still don’t see notifications in the Lsp logs. I’m also a bit worried that it sounds like I’m trying to launch preview twice (once to get the outline and once to get the actual preview), which sounds like it will consume twice as much resources. Is there anyone who ever managed to get those notifications emitted without using VSCode?
Also I really don’t understand why this document outline stuff has anything to do with previewing. Why couldn’t we get the outline without previewing the document? This seems to be completely orthogonal concerns. What am I misunderstanding?