#Tinymist

1 messages · Page 4 of 1

hardy grotto
#

Is there a better channel to discuss treesitter for typst?

#

@bluss do you know about :EditQuery?

flint pollen
#

nope

hardy grotto
#

This is very convenient to test your queries.

flint pollen
#

nice, I see

hardy grotto
#

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.

flint pollen
#

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?

hardy grotto
#

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?

flint pollen
oak quest
hardy grotto
#

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.

flint pollen
#

I'm happy you helped me with this, at least I have the typst function text object I wanted 🙂

cursive bough
flint pollen
#

oh ok... I was always on my toes in #discussions

flint pollen
#

@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?

tardy sparrow
#

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!

oak quest
tardy sparrow
#

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!

valid ruin
#

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.

oak quest
oak quest
solemn coral
#

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

gentle bay
#

@oak quest FYI, problem persists in 0.13.20

oak quest
#

i may wait for a bug report to know what is happening.

oak quest
solemn coral
#

I guess I was searching under the "Tinymist:" commands. Why are some commands "Typst:" and others "Tinymist:", or "Typst Preview:"?

oak quest
solemn coral
#

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

oak quest
valid kettle
#

Hi! Do you guys also have problems with tinymist in vscode not updating the preview after a while. No error mentionned in the log

flint pollen
valid kettle
#

Okay it did the update and seems to work now. I will confirm in a few hours if it occured again.

oak quest
#

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.

oak quest
#

The first test that validates the lockfile will forever work.

oak quest
somber drum
#

Thanks a bunch!! Will try on the next opportunity!

oak quest
# somber drum 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 compile can be also set with tinymist compile or typstExtraArgs in 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.1 in a year or two.
solemn coral
#

I'm on 0.13.22 on vscode, it is working fine for me

flint pollen
#

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

oak quest
#

will get merged and appear in 0.13.24

flint pollen
#

oh ok

#

that was timely..

oak quest
#

there had been many times that we finish a fresh feature before people asking for one.

crimson blade
#

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 @local not @preview as in Private packages
  • ❓ Under the path @preview (this might pollute the @preview environment?)
  • ❌ 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!

buoyant sand
#

the local import should work just fine

#

idk what the emojis are supposed to mean

crimson blade
#

It means not working for crosses. Maybe I missed sth so it doesn't work...

#

Usually where is the default @local path in Tinymist?

buoyant sand
#

I think tinymist even has features to put your current project there if you have it open

#

thought i could be mixing something up

buoyant sand
#

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

crimson blade
#

Thanks for the info!
I will check the doc in more details

buoyant sand
#

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

crimson blade
# buoyant sand see the typst/packages repo

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 !

crimson blade
#

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.

jaunty kiln
#

Though you can grant access to paths through the cli. Not sure how it's done in Tinymist

crimson blade
#

thank you a lot!

solemn coral
#

Have you tried a symlink?

crimson blade
#

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 😅

oak quest
#

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.

fathom glade
#

@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
flint pollen
#

@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?

hardy grotto
#

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

olive bison
#

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

flint pollen
#

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

flint pollen
#

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)

cursive bough
#

this is...

#

error lens?

flint pollen
#

there is no diagnostic to highlight on the line we're talking about right now, so I don't see how error lens helps

flint pollen
#

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)

cursive bough
#

Preview in tinymist is broken (vscode). It looks like a font issue, but the pdf-preview works, so I don't get it.

flint pollen
cursive bough
#

oh yeah! I'm on pre-release

#

thanks ❤️

oak quest
#

paran3xus tried fixing a bug and the bug fix bombed preview intermediately.

olive bison
oak quest
#

besides completing well-known files, we could also complete all files to read in the (reading) directory.

#

it is not implemented yet.

olive bison
olive bison
old marten
#

hi does tinymist on vscode support the git version of typst?

cursive bough
old marten
#

Huh

oak quest
old marten
#

thank you

solemn coral
#

is the vscode pre-release version the same as nightly?

oak quest
hoary stag
#

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)

jaunty kiln
#

the # shouldn't go before "annotation"

sick quail
#

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

vital kayak
#

Is there a markdown to Typst command in the LSP?

#

I see there is export to markdown, but I'm looking for import

jaunty kiln
#

But check out pandoc

oak quest
oak quest
sick quail
#

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 like source.fixAll which 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

oak quest
sick quail
sick quail
#

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

oak quest
oak quest
#

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.

sick quail
#

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

oak quest
#

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.

sick quail
#

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

oak quest
#

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.

sick quail
#

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?

solemn coral
#

Would be nice if typst itself could power through most errors, for things such as highlighting all errors

sick quail
#

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

oak quest
jaunty kiln
#

Or do you actually mean the product of a b c and d?

oak quest
oak quest
oak quest
# sick quail btw, i'm thinking about upstreaming a code action that adds spaces in undefined ...

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:

minor moss
#

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))

sick quail
#

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

sick quail
#

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 (?)

oak quest
oak quest
sick quail
#

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

oak quest
sick quail
#

yeah, that's codeaction/resolve in LSP (at least as far as i can tell)

oak quest
sick quail
#

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)

oak quest
#

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.

sick quail
#

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

oak quest
# sick quail mm i think there is a reasonable argument for both sides. such fix-all code acti...

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.typ and import it for foo.
  • creating a let binding #let foo = ${none:0} for foo.
    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 flag tinymist.autofix.experimentalFixUndefinedReferenceInMath (the name needs bikeshedding) that match your needs.
sick quail
#

right of course, i agree this should not be enabled by default

oak quest
# sick quail 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.

sick quail
# oak quest deduplication is surely needed. not sure we should emit errors for consistency. ...

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

sick quail
# fathom glade <@432835220593704981> do you know anything about this? ``` $ cargo insta test -p...

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

oak quest
#

that should be correct. I also noticed the undefined reference error from some reports

#

update: tinymist.wasm can process multiple files now.

lean latch
#

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

flint pollen
lean latch
#

I'm not

#

managed to install sth old now

and works again

#

weird

scenic wolf
#

Trying to install using cargo, what I am doing wrong?

buoyant sand
#

It says right there what's wrong and how to fix it

scenic wolf
buoyant sand
#

Yes

flint pollen
#

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

flint pollen
#

that's just the start of the discussion, more to be done

vast rock
#

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

flint pollen
#

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

oak quest
#

_ prefixed identifiers are even put front. but I guess I can move these identifiers to the end of the completion list.

oak quest
flint pollen
#

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

oak quest
#

not implemented yet.

flint pollen
#

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)

oak quest
flint pollen
#

it looks vaguely like document order actually

#

I think that's it

oak quest
flint pollen
#

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@2 are 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
stone flint
#

How much quicker is tinymist preview than Typst watch?

rough olive
#

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

flint pollen
#

tinymist preview is immediately updating ideally, Typst watch only when you save the file, that's the biggest difference

oak quest
#

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.

stone flint
#

40GB wtf

#

Does Typst really scale that badly?

buoyant sand
#

I think this was an exaggeration

wheat garnet
#

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

jaunty kiln
oak quest
buoyant sand
#

Damn can I have some of your ram

flint pollen
#

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

jaunty kiln
coarse ruin
#

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

oak quest
#

this is a "known feature" that only one previewed document is searched. we may improve it in future.

coarse ruin
#

i see

#

is there a draft pr for this?

rugged copper
#

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…)

oak quest
oak quest
#

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

oak quest
coarse ruin
#

I see thanks :)

signal moss
#

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))

signal moss
#

It also does not autocomplete import @preview

solemn coral
#

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
]
rough olive
#

it's typstyle's

signal moss
oak quest
wraith blaze
#

is there a way to get tinymist to read the "new" (inline) tidy parameter syntax?

buoyant sand
#

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

wraith blaze
#

sosad

#

thanks

strong bear
#

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

flint pollen
#

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

strong bear
#

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?

solemn coral
#

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

flint pollen
# strong bear Another question for you since you seem knowledgeable: Is there a way to configu...

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

strong bear
#

Thanks!

valid ruin
#

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.

oak quest
#

this was caused by an old html was bundled and can be fixed by updated assets. waiting for the nightly maintainer to operate it.

upbeat glen
#

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

oak quest
upbeat glen
oak quest
#

the html class typst-shape hints that the shape owning #000 may be some typst element generated by your code, rather than typst-preview.

upbeat glen
#

as far as i'm aware of, no

upbeat glen
oak quest
#

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.

upbeat glen
#

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

oak quest
#

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".

upbeat glen
#

sounds reasonable

oak quest
#

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.

upbeat glen
#

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

crimson blade
#

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.

solemn coral
#

I believe you can auto complete with .bracket

#

So you could type tdbr

oak quest
#

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.

solemn coral
oak quest
crimson blade
crimson blade
oak quest
crimson blade
oak quest
#

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.

crimson blade
# oak quest It is hard to let package owners learn this feature, but overall there is no pro...

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
oak quest
# crimson blade Thanks a lot. I also wonder where to learn the completion syntax supported (lik...

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.

oak quest
#

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

crimson blade
oak quest
# crimson blade Good to know there's a llm-specific documention! it's going to save a lot of tim...

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

#

In the readme, there is an entry to deepwiki with tinymist. deepwiki will answer questions based on the source code.

crimson blade
#

Thanks! I will check it soon

coarse hearth
#

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!
flint pollen
#

the doc for vim.lsp.enable says

Auto-starts LSP when a buffer is opened, based on the |lsp-config| filetypes, root_markers,
and root_dir fields.
which will work fine when you have filetypes set in the tinymist lsp config (nvim-lspconfig does this for you if you have it)

coarse hearth
#

😄 It's working now .... Thank you.

flint pollen
#

great. what did you need to do to get it working?

scenic wolf
#

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!

languid summit
#

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)

languid summit
oak quest
languid summit
cursive bough
#

what is typlite?

#

right.

#

I see.

subtle wind
#

the symbols panel doesn't seem to work
how do i debug this?

subtle wind
rough olive
subtle wind
rough olive
#

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

oak quest
#

@scenic wolf @buoyant sand

oak quest
languid summit
#

Oki 🙂

buoyant sand
harsh wing
#

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
harsh wing
#

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

oak quest
#

I think it occured in some rc releases, but I reverted it after some tests and I found it totally broken.

harsh wing
#

oh, right, it didn't hit the final release...

coarse hearth
# flint pollen great. what did you need to do to get it working?

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"
stone flint
#

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

flint pollen
stone flint
#

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

flint pollen
#

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

stone flint
#

I also use neovim, so I'll try and get that

flint pollen
stone flint
flint pollen
#

right, I use a plugin (trouble)

flint pollen
hardy grotto
#

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.

hardy grotto
#

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.

scenic wolf
#

Hi,
I'm using tinymist with the Helix editor, and I’ve set it to compile on save. I’d like to ask:

  1. How can I exclude a specific file (my template) from being compiled?
  2. Is it possible to define a custom output folder for the generated PDF files?
    Thanks in advance!
flint pollen
flint pollen
#

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.

hardy grotto
#

Thanks, I'll try this config tonight.

hardy grotto
#

I’ll try editing with this config, but I already see random syntax highlighting using it.

hardy grotto
#

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 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.

flint pollen
#

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.

oak quest
hardy grotto
#

@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?

hardy grotto
#

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.

hardy grotto
#

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.

hardy grotto
#

So it seems LSP uses by default utf16 code units and that 𝒮 is indeed two utf16 code units long.

#

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.

hardy grotto
#

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.

oak quest
#

@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.

oak quest
hardy grotto
hardy grotto
oak quest
# hardy grotto I don’t understand what you mean here. Do you mean you confirm this is indeed th...

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.

GitHub

Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst]. - Myriad-Dreamin/tinymist

hardy grotto
#

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.

oak quest
hardy grotto
#

@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.

stone flint
#

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

lean latch
hardy grotto
#

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).

oak quest
stone flint
#

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

hardy grotto
#

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).

oak quest
#

I ran cd editors/neovim && ./bootstrap.sh editor for test and semantic highlight looks correct now.

hardy grotto
#

@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.

warm kiln
#

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.)

fierce fossil
#

Seems like when raw blocks and $ are used together, it messes up highlighting.

fierce fossil
#

Apparently, this is a problem of codly + tinymist

scenic wolf
#

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"
somber drum
#

outputPath = "$root/output/$dir/$name"

#

I think you need root

#

@scenic wolf

scenic wolf
old marten
scenic wolf
old marten
# scenic wolf 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

#

In assuming root means the project root, and dir well the dir of the typst file?

old marten
gentle bay
#

does 0.14 work with tinymist? assuming the answer is no

old marten
scenic wolf
marsh mortar
#

Curious whether there's a way to run tinymist as a command line linter?

#

ie cargo clippy for Typst?

indigo ridge
marsh mortar
buoyant sand
#

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

jaunty kiln
#

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

hollow mulch
oak quest
# marsh mortar Curious whether there's a way to run tinymist as a command line linter?

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.

oak quest
# jaunty kiln When can we expect this to hit vs code prerelease? 🙂

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

GitHub

Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst]. - Myriad-Dreamin/tinymist

cursive bough
#

@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.. 😄

oak quest
cursive bough
#

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.

scenic wolf
hardy grotto
old marten
#

you have to have Tinymist installed

scenic wolf
old marten
# scenic wolf For this specific project the project directory is at `~/Git/vault/Typst` and I ...

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)

marsh lance
#

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.

oak quest
marsh lance
oak quest
hardy grotto
#

Do I understand correctly that typst-preview.nvim is not yet updated so we cannot yet use Typst 0.14.0 in neovim?

flint pollen
hardy grotto
#

Thanks, I’ll try more documents.

#

Are you able to use 0.14 stuff, like #title?

flint pollen
#

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

hardy grotto
#

Do you mean the dependencies_bin option?

flint pollen
#

yes

hardy grotto
#

I can confirm typst-preview downloads its own outdated tinymist, but I haven’t manage to prevent it yet.

jaunty kiln
#

Or are we talking about something else

hardy grotto
flint pollen
#

The one I use is chomosuke/typst-preview.nvim I don't think it's deprecated

hardy grotto
#

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.

flint pollen
#

no idea, chomosuke has not been very active though so I'd imagine not

hardy grotto
#

There are three commits in October in the repo, it’s not so bad.

lean latch
#

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

harsh wing
#

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
indigo ridge
harsh wing
#

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.

indigo ridge
#

huh, interesting. Maybe it only trips on specific values and Tinymist evaluates those more frequently for some reason.

harsh wing
#

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...

patent ibex
#

"what happened?"

harsh wing
#

I guess it checks out

harsh wing
#

yep, typst watch lives, tinymist lsp dies

flint pollen
#

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

oak quest
#

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).

harsh wing
#

hm, so it's just a matter of adding Ord or something?

#

though IIRC, partial is free, but full you need to implement yourself?

smoky tangle
#

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.

harsh wing
#
 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

smoky tangle
#

A pain in the bum if it does that when invoked from another editor...

hardy grotto
#

@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?

oak quest
hardy grotto
#

No problem, thanks for your answer!

oak quest
#

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.onPaste and gets the action $A$ to perform. the action $A$ contains two fields dir, and onConflict, where dir is the directory to store the pasted resources, and onConflict is the script to execute when a conflict occurs (i.e., the file already exists). Note that import statements 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 onConflict script 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") returns a/b/c on 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.

old marten
#

Ohhh tinymist has a image paste feature?

oak quest
old marten
#

Awesome

oak quest
#

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.

GitHub

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...

#

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.

tropic basalt
#

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!

cursive bough
#

two typos for the price of one!

oak quest
#

gemini again found a trivial issue.

jaunty kiln
#

shading in embedded pdf gets rendered at very low resolution @oak quest

#

seems to be because this happens to svg output

oak quest
#

I think this is a known issue @rough olive

jaunty kiln
#

I think it's not Tinymist specific. Only because Tinymist uses svg

#

But I couldn't find an issue in the typst repo

rocky inlet
#

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:

indigo ridge
#

I think the issue is hinting; tinymist renders to SVG where glyphs are drawn as plain paths.

old marten
#

was the preview always svg?

indigo ridge
old marten
#

interesting

old marten
rocky inlet
old marten
#

well ya

rocky inlet
#

And I wouldn’t be able to make VS Code fullscreen to hide the titlebar.

rocky inlet
#

Thanks for the info!

#

(Now to figure out how to disable hinting.)

indigo ridge
#

wait why would you want to disable it? hinting is what makes it look better in firefox.

rocky inlet
#

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.

old marten
rocky inlet
indigo ridge
#

maybe the aa used in vscode for svg isn't tuned for text? At this point you'd have to ask camiyoru / Myriad-Dreamin 😅

rocky inlet
indigo ridge
#

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)

rocky inlet
rocky inlet
indigo ridge
#

its a rendering technology (not baked into the PDF) for screens yes which is why firefox has it; printing is separate.

rocky inlet
#

Ah, so you were just referring to Firefox applying hinting itself.

old marten
rocky inlet
#

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).

indigo ridge
#

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.

rocky inlet
indigo ridge
oak quest
#

I have not fully read the conversation. for text's subpixel rendering, there is a known issue.

rocky inlet
indigo ridge
#

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

oak quest
#

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.

rocky inlet
#

Thanks for the link!

oak quest
#

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.)

rocky inlet
oak quest
#

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.

GitHub

This will solve the long standing issue that we run rendering tasks in vscode main thread.
Experimental rendering typst documents into OffscreenCanvas
pick 63368103 dev: archive preview rendering i...

rocky inlet
#

Will do, thanks!

rocky inlet
oak quest
oak quest
rocky inlet
oak quest
indigo ridge
rocky inlet
#

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 😅

rocky inlet
#

Thanks once again for the info, everyone!

rocky inlet
#

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!

jaunty kiln
rocky inlet
#

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 😅

rocky inlet
#

(And I am running typst watch […] right now.)

trail obsidian
#

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.

vast rock
#

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

jaunty kiln
#

is tinymist supposed to autocomplete citations?

#

I can not get it to do it

jaunty kiln
#

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 @?

#

But that doesn't seem to have been released on vscode

#

okay I installed rc1 manually with the vsix and now it works

jaunty kiln
#

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

rough olive
jaunty kiln
#

thanks

rocky inlet
#

Is Tinymist doing something weird here, or is Typst’s SVG output at fault?

rough olive
rocky inlet
#

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.

rocky inlet
rocky inlet
#

Hmm, I can’t reproduce the problem now (“Vrednovanje” doesn’t get broken up at an inset of 4.917mm in the PDF). Weird.

scenic wolf
#

Just updated to latest using cargo install git, the lsp stopped working for me in helix
Any solutions?

scenic wolf
cerulean tendon
#

is anyone getting this error with firefox when using tinymist?

cerulean tendon
#
[[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

tribal mesa
cerulean tendon
#

that was it, thank you!

sonic scaffold
#

when tinymist ext in zed?

old marten
sonic scaffold
#

🥀

old marten
#

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

olive bison
#

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?

buoyant sand
#

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

olive bison
#

Great, thanks. My idea was to run an LLM over my exercises and look for errors (both spelling and content)

mellow path
#

tinymist is not rendering the preview when using vscode web server proxy

rough olive
mellow path
#

so do i have to build it from source?

rough olive
mortal holly
#

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?

rough olive
hardy grotto
#

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?

hardy grotto
hardy grotto
#

Actually one thing is not clear to me: is the formatterProseWrap only for typstyle or does it apply also to the other formatter?

rough olive
hardy grotto
young gazelle
#

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?

keen moon
#

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

keen moon
rough olive
sturdy surge
#

Is there a way to disable autocompletion of parentheses for function names?

I always end up with func()(args) which is annoying

subtle wind
wraith blaze
#

also happens when typing #show: func

indigo ridge
#

funcy!

subtle wind
oak quest
sturdy surge
#

E.g., in items.map(func) or func[content], or if I'm passing a function around by name

sturdy surge
oak quest
sturdy surge
#

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

oak quest
oak quest
sturdy surge
#

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

oak quest
sturdy surge
oak quest
#

so I collect cases to improve it.

sturdy surge
#

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?

oak quest
sturdy surge
#

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

oak quest
#

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.

oak quest
oak quest
#

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

GitHub

Motivation I use a template similar to this: #show: ieee.with( ... bibliography: bibliography("refs.bib"), ) #include "content.typ" and have my main content in a separate file. ...

hardy grotto
#

If it helps tinymist then why not?

cursive bough
#

I feel like I'm against it..

brisk umbra
#

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.

jaunty kiln
#

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.

brisk umbra
#

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.

jaunty kiln
brisk umbra
#

ah, thanks, didn't know that

old marten
#

Coming back to that

#

I just see the typst watch a bit broken for large documents

#

Broken as the memory increases really much

jaunty kiln
jaunty kiln
old marten
#

For small documents is totally fine but there should be an easier way for typst to restart the memory usage after a while

jaunty kiln
#

Reduced memory usage is on the roadmap

old marten
jaunty kiln
#

If typst watch is only using 1.1 GB that shouldn't be necessary

old marten
#

And well disabling tinymist lsp, recently it was added a syntax only feature which consumes little memory and doesn't increase

brisk umbra
#

thanks! the extra features are really nice of tinymist, but I'll have to do that indeed for the time being.

cursive bough
#

tinymist is so eptly named.

#

is it tiny? is a mist tiny?

jaunty kiln
flint pollen
#

ept must be the antithesis to inept? I think tinymist is very ept 😆

jaunty kiln
#

I thought it was apt

flint pollen
#

apparently yes, apt is the antithesis to inept, that's cool

red crypt
#

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?

flint pollen
hardy grotto
#

If yes and it still doesn’t work then we’ll need more information about your configuration.

red crypt
#

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"

flint pollen
#

newest tinymist installed?

red crypt
red crypt
#

if i remove the typst = { "tinymist", lsp_format = "prefer" }, line from conform the format command simply does nothing

flint pollen
#

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

red crypt
flint pollen
#

:set formatexpr?

#

with a typst file open

red crypt
#

it's empty

flint pollen
#

ok, I don't know why that would happen, it should be set when tinymist lsp is activated

red crypt
#

the tinymist lsp commands work (i.e. exports)

red crypt
#

also, i am using windows

hardy grotto
#

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?

red crypt
#

i reactivated conform

red crypt
hardy grotto
#

So something is indeed broken in your lsp setup.

hardy grotto
#

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.

red crypt
#

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

hardy grotto
#

That’s super weird. It says tinymist is active and then complains it’s not??

red crypt
hardy grotto
#

What if you insist with lua vim.lsp.buf.format{id = 1}?

red crypt
#

do you use mason?

#

I installed tinymist system wide

hardy grotto
#

Yes, I use Mason.

#

A lot of it is completely irrelevant of course, but this is a config I use with tinymist.

red crypt
#

thank you, i'll try to find the culprit

hardy grotto
#

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.

red crypt
#

maybe nvchad is the problem, because i didnt customize it at all and tried all the combinations

hardy grotto
#

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.

red crypt
#

or not using mason

hardy grotto
#

Oh, do you simply try to add tinymist on top of a vanilla NVChad? I could try reproducing then.

red crypt
#

yes let me try, with mason this time

hardy grotto
#

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.

red crypt
#

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

hardy grotto
#

I don’t know anything about Windows, sorry. The most recent Windows I used is Windows 98.

flint pollen
stray heron
#

Tinymist should add the ability to wrap selected text in an italic or bold environment.

old marten
#

Is that zed? If it is, I think it depends mostly on the extension rather than the lsp for what I mentioned.

vast rock
#

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

vast rock
#

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

oak quest
#

The backend (tinymist-cli) is not changed, and frontend implementations will get data from the backend using websocket.

jaunty kiln
#

Ray traced rendering 🚀

oak quest
#

renders nicely with vello gpu (webgpu)

vast rock
#

truly strange since i can see Compiling open v5.3.3... while compiling tinymist

oak quest
vast rock
#

I will try it in a bit

oak quest
# vast rock 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 :).

vast rock
#

can confirm now that it works

vast rock
#

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

oak quest
vast rock
#

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

rapid juniper
flint pollen
# rapid juniper

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 }
oak quest
#

🐱 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.

somber island
wheat garnet
fluid zinc
#

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 ?

indigo ridge
fluid zinc
#

No, it's just that it defocuses the cursor of the editor, so I have to click back each time I update the document

indigo ridge
#

that sounds like a bug on your system

#

what os, version of vscode, and version of tinymist are you using?

fluid zinc
#

I'm using it on windows 11 with the latest version of vscode (1.109.0) and tinymist(0.14.10)

copper cedar
#

are u previewing inside vscode or with an external browser?

fluid zinc
#

inside vscode

#

I guess I could preview it in the browser

fluid zinc
#

Okay nevermind I got it

#

I have to click on the preview text at the beginning of the document and not the pdf icon

summer mica
#

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

oak quest
summer mica
wheat garnet
#

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.

oak quest
wheat garnet
jaunty kiln
#

Has that changed?

wheat garnet
#

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.

analog tapir
#

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

flint pollen
#

what should we look at in this log? there are 'ERROR' marks there but I would guess that they are not errors.

analog tapir
#

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

flint pollen
#

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]

analog tapir
#

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

stray heron
#

We really oughta have a "wrap with inline/display math blocks" code action for VS Code.

wraith blaze
#

for inline you can just type $ and it'll wrap the selection (same as other delimiters like ()

stray heron
zinc valve
#

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.

GitHub

Since the referenced WebSocket issue is resolved, and all major browsers (I tested chrome, firefox, and safari with this change) supports connecting to websocket with http and https, it would be a ...

stray heron
#

Q: Is this previewer now built-in or do I need to do any extra tricks?

oak quest
flint pollen
#

0.14.12 is the latest stable tinymist version

cloud trench
#

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?

GitHub

Is there an existing issue for this? I have searched the existing issues Platform Apple Silicon macOS (darwin-arm64, Most Common) Editor CLI (Command Line Interface) Editor Version NA Describe the ...

oak quest
cloud trench
#

Ah, sounds good 👍

#

I'll give that a try in a bit

cloud trench
#

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?

rough olive
#

tinymist.exportPdf

cloud trench
#

Can I just... send that through the websocket o.O

#

That's an LSP command

#

(I'm referring to the preview server)

rough olive
#

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

cloud trench
# lean latch what exactly do you want to do? https://xyproblem.info/

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)

lean latch
#

why not simply use the typst cli?

tranquil acorn
#

Sharing here for added visibility.

Added context: Im doing a monorepo approach with the template and multiple books in the same repo.

tranquil acorn
#

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)?

misty hound
#

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

tranquil acorn
#

Interesting, I'll keep that in mind thanks.

misty hound
#

(pictured repo has no dependencies between projects, but it's worked fine even when it has)

tranquil acorn
misty hound
#

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

tranquil acorn
#

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.

misty hound
#
  1. dead functions indeed look unchecked. yeah, that's annoying what the heck.
  2. 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)

tranquil acorn
tranquil acorn
oak quest
cloud trench
#

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 🙂

lean latch
#

doesn‘t tinymist itself already allow exporting pdf

cloud trench
lean latch
#

🤔

#

ic

cloud trench
cursive bough
#

What's tinymist viewer ml

#

?

somber drum
#

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?

somber drum
#

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
craggy coral
#

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?

old marten
#

That shouldnt happen

#

Preview should literally be live preview (watch mode)

indigo ridge
#

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

craggy coral
#

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

craggy coral
#

gonna look into the code for this

languid ginkgo
#

I searched around and this piece of settings fixed formatter in Zed editor

"lsp": {
    "tinymist": {
      "settings": {
        "formatterMode": "typstyle",
      },
    },
  },
scenic wolf
#

In order to use the formatter I need to install typstyle? Or is it included in the LSP?

languid ginkgo
buoyant sand
#

I think tinymist bundles the formatter in the binary since a while

#

The formatter being typstyle

scenic wolf
#

Someone configured formatting with helix so the formatting is done without external typstyle?

harsh wing
#

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?

harsh wing
#

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.

oak quest
#

I think on neovim it shouldn't show "Export", because "Export" redirects user to a more user-friendly GUI tool in vscode.

harsh wing
#

Neovim? It doesn't have this feature in the first place. Unless there is some plugin for that.

flint pollen
harsh wing
cloud citrus
#

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

indigo ridge
#

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 😅

cloud citrus
#

Ok thank you

indigo ridge
#

hope this can be resolved soon

cloud citrus
#

Thanks man, let's see if @oak quest answers and I tell you

oak quest
#

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.

cloud citrus
#

Tell me and I share you the whole project

stray heron
#

Interesting. Can someone show me how the JSON invert element map works?

rough olive
# stray heron 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"}' `

valid ruin
#

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.

jaunty kiln
#

@oak quest what is the status of the gpu renderer?

flint pollen
scenic wolf
#

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😅

buoyant sand
#

I believe folds could be provided by the extension as tree sitter queries

#

Ah no that's code outline

scenic wolf
buoyant sand
#

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

grave grail
#

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

vast rock
#

try ~/.cache/typst

misty hound
#

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

jaunty kiln
vast rock
#

funnily enough i wouldnt but idk

misty hound
#

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

jaunty kiln
#

Well the lsp is also a typst compiler

misty hound
#

oh shoot that's true isnt it

#

hmmm

#

neat

flint pollen
#

tinymist is literally shipping with a forked version of the typst compiler (but the divergence is pretty small)

grave grail
vast rock
#

they can still use TYPST_PACKAGE_PATH and TYPST_PACKAGE_CACHE_PATH though

grave grail
#

so if I want to work on my local package
do I create a directory 'local' at the same level as 'preview'?

indigo ridge
#

you should store local packages in .local/share/typst/packages/local [the platform dependant dir].

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

grave grail
#

oh

indigo ridge
#

I guess there is nothing stoping you from using one or the other, but that's the general wisdom so far 😅

grave grail
#

(i'm on macos reminder)

indigo ridge
#

ah wait. no one sec

#

~/Library/Application Support on macOS

#

from the link saffronner sent

#

so ~/Library/Application Support/typst/packages/[namespace]/...

grave grail
#

yaaaaaaa
all works
tysm!

misty hound
#

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

grave grail
#

i mean i also found those docs

#

but the directories did not exist ;[

#

so I thought tinymist installed somewhere else

hardy grotto
#

@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.

rough olive
#
GitHub

Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst]. - Myriad-Dreamin/tinymist

GitHub

Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst]. - Myriad-Dreamin/tinymist

GitHub

Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst]. - Myriad-Dreamin/tinymist

hardy grotto
#

Thanks, but do you know how to enable preview? Is there a request to send? Or some parameter when launching the server?

rough olive
# hardy grotto Thanks, but do you know how to enable preview? Is there a request to send? Or so...
hardy grotto
rough olive
#

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

vast rock
#

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)

buoyant sand
#

Nope, I saw this right away, but I don't write typst a lot atm so I don't know.

vast rock
#

sadge

misty hound
#

@violet jewel iirc you're a helix user, would you happen to know :0

#

the above

violet jewel
#

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

flint pollen
cursive bough
#

Are there still performance issues with tinymist?

hardy grotto
# rough olive no. typst-preview.nvim starts another tinymist process to as a preview server, t...

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?