#Tinymist

1 messages · Page 3 of 1

oak quest
#

The code currently is very ugly and I will clean code when I implement the block coverage correctly.

marsh lance
#

I think memoization could affect coverage

buoyant sand
#

would coverage colleciton not be possible form typst-eval directly without adding anything to the AST?

#

since that was the problem last time

marsh lance
#

it would, but it would require more design and bikeshedding

oak quest
# marsh lance I think memoization could affect coverage

I thought a typst debugger was also affected by memorization, as well as the layout iteration. But I found we could keep stupid. The control flow with memoization and the layout iteration and so on is exactly what we should understand.

marsh lance
#

I think iterations should be visible but memoization is something a user shouldn't have to be concerned with generally

oak quest
#

Or you mean some coverage will be faked by the comemo.

marsh lance
#

yeah, coverage would be TrackedMut

#

like the Sink

#

or it would be in the sink

#

not sure how much overhead that would incur. could be a lot.

oak quest
#

will it be a problem if we only collect coverage about cold compilation.

marsh lance
#

it's a reasonable approach for tinymist I think

#

for a compiler API it would to handle it

floral adder
#

[[language]]
language-servers = ["tinymist"]
name = "typst"

[language-server.tinymist]
command = "tinymist"

[language-server.tinymist.config]
formatterMode = "typstyle"

[language-server.tinymist.config.preview.background]
args = ["--invert-colors=never"]
enabled = true

I'm trying to get the live preview to work in helix with tinymist, what am I doing wrong?

somber drum
#

You might have to specify the address where to host the preview? You might also be on an older version (background preview is not released yet)

oak quest
#

Maybe we should maintain documentation for each release

#

pdf is great

somber drum
#

How long between the 13.6 rc and the 13.6 stable release? Sadly the zed extension ignores pre-releases :/

oak quest
#

No explicit due, but when we feel confident enough. I'm waiting some feedback from some rc users. Till now, two people said they didn't find regressions in the rc.

oak quest
#

if i could run and report it in ci

oak quest
#

I find some not pretty case, that the unreachable branches are reported as uncovered. There is still a long way to go..

cursive bough
#

What are toy showing us 😃?

buoyant sand
#

Experimental coverage info

#

(which code is actually run and how often)

#

This helps increase test coverage

cursive bough
#

Oh.. I think I get it. That's nice.

cerulean tendon
#

hm im trying to use helix for typst, is there a way to make it automatically open the pdf preview?

somber drum
somber drum
#

I think the background preview is what you mean

cerulean tendon
#

im not sure sure

#

it doesn't really open it

#

this is my helix languages.toml

#
[[language]]
name = "typst"
language-servers = ["tinymist"]

[language-server.tinymist]
command = "tinymist"
config = { exportPdf = "onType", preview.background.enabled= true, startDefaultPreview=true}
somber drum
#

Unless you explicitly installed the pre release that feature isn't available yet

cerulean tendon
#

ah i see

#

what if i changed command?

#

would something like tinymist && mupdf

somber drum
#

Nah

#

Do you just want the pdf?

cerulean tendon
#

i just want the pdf viewer to launch at the same time

somber drum
#

There might be some helix way of doing this

#

Never used it so can't tell

cerulean tendon
#

hm but not really in tinymist?

#

or if it opened the preview automatically that would work as well

#

i don't really use the click features, but they are nice to have

somber drum
#

You can have the pdfs generated automatically

#

But tinymist can't open them automatically, although the preview might be able to?

oak quest
somber drum
#

I am trying to use the new update in Zed but I can't seem to get the background preview to work

#
"tinymist": {
      "initialization_options": {
        "exportPdf": "onType",
        "formatterMode": "typstyle",
        "outputPath": "$root/output/$dir/$name",
        "preview": {
          "background": {
            "enabled": true
          }
        }
      }
    }

This is the tinymist lsp settings, did I do something wrong here?

oak quest
#

what did the log say?

oak quest
#

I translated all titles of commands in vscode using LLM.

#

Looks great but I don't really know how actually good it is.

cursive bough
#

da = "Eksporter den åbnede fil som PDF"
Hmm.......
maybe da = "Eksporter den nuværende fil som PDF".

#

DeepL says:

#

I'd try to use DeepL for the translation if you can. In Danish, both of these suggestions are more accurate than what's in the PR. But this is just for Danish.. I don't know anything about the rest.

oak quest
#

I use LLM because it is pretty quick. I was simply telling LLM to generate them and I wrote 0 lines of code. Might correct them later.

#

perhaps I will only translate the code that I know well, and left rest of languages for people who use them.

vital kayak
#

I'm using tiny mist to create layouts, these layouts import JSON files from sys.inputs and build a pdf, I would like to provide a JSON schema that tiny mist can then use for type validation.
Is there anything similar on the roadmap

oak quest
#

Couldn't you enforce them by installing JSON scheme support in your editor? To validate them when building PDF, you could make some typst packages or plugins by yourself.

vital kayak
#

The pdf is built at runtime, actually it's an app that creates pdfs for invoice data. Each invoice has different data of course but the shape of the data remains the same.
I could provide an example JSON file but that won't allow me to cover the whole range of possibilities the data can have

#

I want to validate that the Typst code is properly accessing this JSON data based on the schema (doesn't have to be JSON schema, can be any typed schema)

oak quest
vital kayak
#

Does tiny mist infer the schema by Valkyrie and does type checking

#

Then I could define the expected schema inline and further code could be typechecked

cursive bough
oak quest
#

I can but I haven't. I would rather make type checking when typst introduce official syntax and semantics of type annotations. Currently it is painful to make type checking work without any annotations.

vital kayak
hoary stag
#

@oak quest many thanks for the ongoing work on supporting simple editors! I'm trying the background preview feature with helix and so far it's awesome!

#

For other helix users who want to try it: you can use something like this:

[language-server.tinymist]
command = "tinymist"
config.preview.background.enabled = true
config.preview.background.args = ["--data-plane-host=127.0.0.1:23635", "--invert-colors=never", "--open"]

in your languages.toml and it wil automatically open a browser tab with instant preview when you open a typst file

#

while startDefaultPreview is an LSP command you can emit manually from the editor, by running :lsp-workspace-command (this wasn't immediately clear to me)

harsh wing
#

Since now on NixOS MuPDF doesn't update instantly for some reason, I think more and more about creating a Tauri app that will be minimal, potentially statically linked and have the minimal UI to maximize the free screen real estate. And it should consume much less resources compared to a full-fledged browser (or electron).

#

Since browsers are bulky and it isn't easy or it's impossible to make it only show the content without any UI (fullscreen-like), and the next browser session will open it in with the same geometry (half-screen), I don't wanna use any browser-based previews.

hoary stag
#

But I don't want to talk you out of making a cool Tauri app that does the same thing with fewer resources and in a way that's cleaner and easier to package 🙂

harsh wing
#

I mean, Tauri is kinda a bare-bones browser, but you can make it a better UX by providing a good CLI. Though without much thinking I don't know if there is actually something that needs to be implemented, since it already uses WebKitGTK (I think), which is 99% of work done.

cerulean tendon
#
[[language]]
name = "typst"
language-servers = ["tinymist"]

[language-server.tinymist]
command = "tinymist"

config.preview.background.enabled = true
config.preview.background.args = ["--data-plane-host=127.0.0.1:23635", "--invert-colors=never", "--open"]
config.exportPdf = "onType"
config.formatterMode="typstfmt"
config.preview.cursorIndicator=true
config.review.scrollSync=true
somber drum
#

Also doesn't work for me in Zed :/

Update: works on latest Zed version

modern falcon
oak quest
oak quest
oak quest
#

but you'll get a new preview tab every time you open the helix editor. I was thinking that you could keep using a single tab listening the port on 23635 where the background preview will be on.

#

if you love the open flag, I guess you could open multiple background preview with telling to use a random port:

[language-server.tinymist]
command = "tinymist"
config.preview.background.enabled = true
config.preview.background.args = ["--data-plane-host=127.0.0.1:0", "--invert-colors=never", "--open"]
hoary stag
harsh wing
#

Can tinymist work with TYPST_ROOT? Right now it's my only problem, when I have a root that is not where the main file is.

somber drum
#

It is pretty slow with Safari but works better in firefox, maybe chrome would be even better? (Don't really use chrome at all tho)

somber drum
fathom glade
#

should this not be in a rustfmt.toml?

oak quest
#

vscode ignores rustfmt.toml

fathom glade
#

._. why

#

damn looks like the lsp format protocol doesn't always give a path maybe

coarse hearth
#

Hello, I'm testing new text editors with Tinymist.

I've successfully tested neovim and helix but I'm having trouble getting zed to work.

Can you help me?
I can only get the LSP to work with the marketplace extension, not manually. As a result, I can't configure the LSP options. Additionally, how can I access the preview window?
Thank you

coarse hearth
#

I tried

"lsp": {
    "tinymist": {
      "initialization_options": {
        "exportPdf": "onType",
        "outputPath": "$root/$name",
        "preview": {
          "background": {
            "enable": "true"
          }
        }
      }
    }
  }
#

I have compliation on type, I don't have the preview feature.

coarse hearth
#

Indeed, I encounter some problems on helix.

#

LSP lauch, exportPDF on type works, but inverse search from web view doesn't work. and formatter doesnt work...

Here is my config

[[language]]
name = "typst"
language-servers = ["tinymist"]

[language-server.tinymist]
command = "tinymist"
config.preview.background.enabled = true
config.preview.background.args = ["--data-plane-host=127.0.0.1:23635", "--invert-colors=never", "--open"]
config.exportPdf = "onType"
config.formatterMode="typstyle"
config.preview.cursorIndicator=true
config.review.scrollSync=true
somber drum
#

Make sure to only have those settings, it doesn't work at all when I override the args

#

It does work most of the times for me but it is still a little inconsistent

#

I am on MacOS and installed Zed via nixpkgs and used home manager for configuration

#

If you are on Linux (or Windows?) there might be some platform inconsistencies

coarse hearth
#

It doesn't work at all.
I'm on mac too.
The lsp is launched, but i cant compile...

somber drum
#

You mean the pdf compilation doesn't work?

#

Also make sure to use the latest Zed version, it only started to work for me with 0.177.7

coarse hearth
#

yes the pdf compilation doesn't work. I have the latest version I think.
I installed zed with homebrew

#

Did you install market expansion for typst ?

somber drum
harsh wing
#

I was about to say that GitHub's notification become ridiculous, but apparently it's due to a config error. I guess they didn't know that you better add this to the reasoning in the email.

coarse hearth
coarse hearth
#

from my helix config

#

can't make the formatter work

oak quest
oak quest
oak quest
harsh wing
#

When I was trying to get the MRE for the latest issue, I found that I get all the relevant items on top if I remove the closing parenthesis before triggering the autocompletion.

#

I still think that it has something to do with tinymist.

oak quest
#

it is very challenging to make completion on the file containing syntax errors. not all cases are handled, and it can be an improvement.

harsh wing
#

I'm talking about completing #set text(|).

oak quest
#

but you missed a right paren.

harsh wing
#

Because this way it shows fields on the top.

#

#1260973804637786224 message

oak quest
#

okay I misread it. you mean the problem is that all completions are shown, though I'm not getting how I can improve it.

harsh wing
#

The server gives the order of the items?

oak quest
#

I see a content completion which is a positional argument, which I should remove in future.

oak quest
harsh wing
oak quest
harsh wing
#

you mean the mirror.json?

oak quest
#

by your skill. It is fine by capturing it using --mirror.

harsh wing
#

by your skill.
What?

#

I did imply using --mirror mirror.json.

oak quest
#
{"method":"textDocument\/completion","params":{"position":{"character":7,"line":0},"context":{"triggerKind":2,"triggerCharacter":"("},"textDocument":{"uri":"file:\/\/\/tmp\/a.typ"}},"id":21,"jsonrpc":"2.0"}
{"method":"textDocument\/completion","params":{"position":{"character":7,"line":0},"context":{"triggerKind":1},"textDocument":{"uri":"file:\/\/\/tmp\/a.typ"}},"id":24,"jsonrpc":"2.0"}
#

This is the difference:

- "context":{"triggerKind":2,"triggerCharacter":"("}
+ "context":{"triggerKind":1}
#

When adding a lparen, the completion is triggered by "triggerKind": "triggerChar" and triggerCharacter: "(". When removing a rparen, it is triggered by "triggerKind": "invoke" and triggerCharacter: null.

harsh wing
#

@oak quest, do you know if a server can send a warning message to a client? In Neovim you can send different levels of messages to display it.

#

Oh, wait, I think the warning from logs would probably be displayed, yeah.

oak quest
oak quest
#

bad news: window/showDocument will replace the preview panel to the document to show, instead of show it beside the preview panel...

#

good news: when you open preview in browser, this doesn't bother anymore.

coarse hearth
oak quest
#

#1261622502598377545

harsh wing
#

That's not the lsp command.

But the lsp command doesn't have that root dir argument, which is very confusing. It uses LspArgs. I did find that there is some weird connection between them, but it was soo hard to undrestand what is beign called that I gave up. The problem is that in the printed config it shows the same root in multiple places, which means I either have to fix all of them, or find some magical place from where they are all being copied and fix it once.

oak quest
#

If you are not familiar with programming or background, you usually only check the related code instead of starting with the main function.

harsh wing
oak quest
#

I don't want to talk more about such not important things. You don't have to read code of the main function if you only care about the root configuration.

harsh wing
#

If I'm not familiar with a code base, that is the only sensible way to get to the bottom of this (with LSP jumping and/or debugger), at least if (in this case) the root arg is used in a bunch of different places and it's not clear where it's being grabbed into the init config for the server. This is partially how I recently figured out how a few chunks of Typst logic work.

I think you are talking with a bias of knowing exactly how your project is constructed and where all things live. I have no idea where the root configuration is taking place nor do I know how (exactly) everything else work in tinymist.

#

But the link to the related lines of code looks helpful, so thanks for that.

oak quest
#

sorry I usually become less patient when I'm on my real life's work time. I personally never read code from main function but only do regex or type search on code base, so I felt it is not important to discuss what the main function actually does.

harsh wing
#

maybe you're just a 10x engineer?

modern falcon
harsh wing
#

suggestion? a guess? a hunch?

somber drum
#

Does the implementation of window/showDocument aim to make the switching between documents better?

oak quest
#

surely, but it is a standard lsp request, so we can only improve it to fit for all language servers.

somber drum
#

That's pretty cool, wouldn't that sort of make background preview redundant or in the very least not necessary anymore for helix/zed?

#

Also, is there some way to lock the preview to one file in those editors? It's quite annoying when developing a template

harsh wing
#

I use this:

    PinMain = {
      function()
        vim.lsp.buf.execute_command {
          command = "tinymist.pinMain",
          arguments = { vim.api.nvim_buf_get_name(0) },
        }
      end,
      description = "Pin main file for better autocompletion/error messages",
    },

Though not always.

oak quest
# somber drum Also, is there some way to lock the preview to one file in those editors? It's q...

default background preview is suitable for single-file documents whose imports are all package imports. for multiple-file documents, locking isn't an ultimate solution. you perhaps need to combine this lock feature. https://github.com/Myriad-Dreamin/tinymist/issues/1527#issuecomment-2729215164

GitHub

Motivation I'm creating Typst files that are not meant to be rendered directly, e.g. a document split into files per chapter, or some sort of library file that doesn't output content itself...

#

Using the lock database will produce a lock file in the root, so I don't enable it by default.

oak quest
harsh wing
#

I showed the LSP command

oak quest
harsh wing
#

not usable?

#

because those editors don't implement some client side thing?

#

I thought it would work anywhere.

oak quest
#

helix doesn't allow command with arguments, and zed doesn't support to call lsp command

harsh wing
somber drum
#

Hey, that looks good! When will it release? This command doesn't seem to exist in 0.13.8 and there is nothing in the 0.13.10 changelog about it

#

That lock file is also respected by the preview, right? Or is some extra argument needed?

oak quest
oak quest
somber drum
#

It does not work

#

The tinymist CLI doesn't use the options I set in Zed, right?

#

I have only set this in the project settings

  "lsp": {
    "tinymist": {
      "initialization_options": {
        "projectResolution": "lockDatabase"
      }
    }
  }
#

(Alongside my global settings:

    "tinymist": {
      "initialization_options": {
        "exportPdf": "onType",
        "formatterMode": "typstyle",
        "outputPath": "$root/output/$dir/$name",
        "preview": {
          "background": {
            "enabled": true
          }
        }
      }
    }
#

One thing I had before was some longer update delay when using preview in zed + safari, that seems to be completely fixed now

#

tinymist.lock is supposed to be a file in the project, right? Because there doesn't seem to be one

#

Will try it in helix

somber drum
#

I also doesn't work in helix, there doesn't seem to be any lock file

oak quest
#

try this option perhaps --save-lock

#

I'm in bed so I cannot test it soon for you.

oak quest
somber drum
somber drum
#

Using --save-lock does indeed generate this lock file:

# This file is automatically @generated by tinymist.
# It is not intended for manual editing.
version = "0.1.0-beta0"

[[document]]
id = "file:elliptic-curves/main.typ"
inputs = []
main = "file:elliptic-curves/main.typ"
root = "file:."
system-fonts = true

[[task]]
document = "file:elliptic-curves/main.typ"
id = "file:elliptic-curves/main.typ"
type = "export-pdf"
when = "never"
#

But preview doesn't seem to use this, it still switches between files

#

Works in neither Zed nor Helix

#

Also can't find any preview options to force usage of the lock file or specify its path or something

#

One more thing to note: setting tinymist.background.preview.args completely breaks the preview in Zed, even with the default setting. Would be cool to set the --open flag.

oak quest
celest lily
#

Has anyone noticed freezes (the editor becoming unresponsive) when entering a new line ? Hitting Enter produces nothing for several seconds and then it suddently works. If you spam Enter out of impatience, the newlines eventually appear about a minute later, slowly (one every few seconds or so). It sometimes goes away for hours, sometimes comes back. When it happens, it makes Tinymist utterly unusable. It never happens with Tinymist disabled. I will test removing other extensions by bisection this afternoon, as this sounds like a me problem, but has it ever happened to anyone else ?

wheat garnet
celest lily
hoary stag
#

@oak quest thanks for another great release, I love the new showDocument feature

#

it works great in helix

#

Maybe tinymist could react to changes in the document, and move the preview to always have new changes visible? This is more or less what https://github.com/tmistele/typst-lsp was doing, and it worked well for me: I just start typing somewhere in my source file, and the preview automatically jumps to show the region of the document where I am making changes

oak quest
#

I may consider the latter one rather than providing a button as the latter one is easier

hoary stag
#

maybe this feature can ignore any change that hits several files (or several locations in the same file)?

oak quest
#

I'll try as long as it can, editor might also split changes into parts tho. I'm not really like we have to depend on inferring user behaviors from the LSP requests or notifications, which is hacking the LSP protocol.

hoary stag
#

yeah I wish helix had better LSP support

#

Unrelated question: what's the difference between tinymist-linux-x64 and tinymist-x86_64-unknown-linux-gnu?

#

both seem to link the gcc libraries

oak quest
# hoary stag Unrelated question: what's the difference between tinymist-linux-x64 and tinymis...

v0.12.14 - [2024-12-25]

We now use cargo-dist to build, attest, and release binaries. The package publishers should prefer to use these binaries and validate them along with checksum. If you have any problems with changes, please report them to GitHub Issues.

These following suffixes are used for VS Code (or VSCodium) extensions: win32-x64, win32-arm64, linux-x64, linux-arm64, linux-armhf, darwin-x64, darwin-arm64, alpine-x64, alpine-arm64, and web. The rest are used for other editors (e.g. Neovim).

We also start to release VS Code extension targeting universal platform. The universal target only doesn't bundle the binary. This is suitable for other platforms like RISC-V (riscv64) or LoongArch (loong64). Users of that must install tinymist by themselves. Note it introduces risk to use unaligned version of the extension and the binary, but we can mitigate it in future.

https://github.com/Myriad-Dreamin/tinymist/blob/main/CHANGELOG/CHANGELOG-2024.md

GitHub

📦 shippable application packaging. Contribute to axodotdev/cargo-dist development by creating an account on GitHub.

GitHub

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

#

No intended difference, the linux-x64 one is what we exact pre-build for vscode.

#

And since v0.13.12, tinymist-linux-x64 is aliased (a copy) from tinymist-x86_64-unknown-linux-gnu.

hoary stag
#

they're not quite the same though:

~/Downloads $ du -b tinymist-x86_64-unknown-linux-gnu/tinymist tinymist-linux-x64
58406600        tinymist-x86_64-unknown-linux-gnu/tinymist
57183184        tinymist-linux-x64
oak quest
#

v0.13.12 is not released

hoary stag
somber drum
#

@oak quest opened an issue about the lock file/preview

jaunty kiln
#

does tinymist support live share in vscode?

oak quest
jaunty kiln
oak quest
#

to support vfs, we will have similar code changes.

#

around 1k code changes.

#

looks like they have problem on the synctex, but we will not if we use the integrated typst preview

jaunty kiln
#

I'm not particularly interested in live share, so no need to spend development time on it for my sake 🙂

#

was just curious

rugged copper
#

Is there any way to have tinymist also suggest local packages in custom namespaces?

harsh wing
#

Custom namespaces are not supported. Though I've never tried.

rugged copper
#

not supported by tinymist you mean?

#

it does display every information and also suggests imports from packages in a custom namespace, it just doesnt suggest packages when writing smf like "#import "@custom/"

harsh wing
#

wow, it does work... I guess this is why you can override preview namespace locally.

rugged copper
harsh wing
#

yeah, then it is a feature request, I guess

oak quest
#

It is not encouraged so we even didn't support it.

#

The @local package completion was moved from typst-sync package. I didn't check it but it should be easy to be adopted for completing packages in @custom namespace.

rugged copper
oak quest
#

I guess in future the namespaces will be exact for some organizations or personal names. I don't know whether you have to finally rename your packages from @work/awesome to @your-name/awesome.

#

It is welcomed to make a feature request to complete all namespaces tho. Nothing is preventing it, but there is simply lack of a person cooking the feature.

rugged copper
#

ah, okay, got it, I'll try to make one when I have a bit more time :)

coarse hearth
#

Hello, I'm having some issues with reverse search in Neovim.

It lacks precision, sometimes there can be a discrepancy of several lines.
Additionally, in certain places, clicking for reverse search does nothing. I think this is due to the lack of precision in the reverse search.

In VSCode, there are no issues.
Surprisingly, there are also no issues in Helix. The reverse search is character-precise.

#
lspconfig.tinymist.setup {
  single_file_support = true,
  root_dir = function()
    return vim.fn.getcwd()
  end,
  on_attach = nvlsp.on_attach,
  on_init = nvlsp.on_init,
  capabilities = nvlsp.capabilities,
  settings = {
    exportPdf = "onType",
    outputPath = "$root/$dir/$name",
    formatterMode = "typstyle",
  },
}
#
{
    "chomosuke/typst-preview.nvim",
    lazy = false,
    config = function()
      require("typst-preview").setup {
        open_cmd = "open -a Firefox %s",
      }
    end,
  },
#

I'm on Mac and tinymist is installed in its latest version via Homebrew.

harsh wing
#

There is now vim.fs.abspath(), which I think means that I no longer need plenary to set the root dir.

coarse hearth
#

Ok. Solve when using Tinymist from Mason, not from homebrew...

urban grove
#

🥲

lilac galleon
#

Hi guys, I just try to switch from web app to tinymist + vscode, somehow auto complettion does work within math mode, any suggestion?

jaunty kiln
oak quest
#

How do you view a "stepless" symbol completion? Would you like to make it opt-in or opt-out? Currently, this will be opt-in.

harsh wing
#

Depends on how accurate it is. Also how accurate the suggestions if you want to search through dot notation. I would think that they can be worse. But if it's opt-in, then it definitely would be nice for the longer ones.

oak quest
#

While it is stepless, it prioritizes shorter steps.

buoyant sand
#

That's usually called fuzzy search btw

oak quest
#

it depends on your editor. I only provide a list of expanded symbols.

oak quest
#

The first try to make a linter using static analysis.

oak quest
#

will it annoy somebody who doesn't care such "bugs"? All the following f function always return none and don't affect outer context.

vast rock
#

It could be difficult to make a distinction between the lints you want the user to see

#

But the discarded returns are logic errors so that seems like it's relevant

#

cargo check would show that

#

cargo clippy is more about idiomatic paradigms

oak quest
#

I consider making some linter configuration before enabling it by default.

native plover
#

While exporting to HTML, this is thrown.

#

Any help?

oak quest
#

you could find and debug errors in the html export by changing the exportTarget to html.

#

the specific error in the screenshot is very much related to some set page is applied when export ing html.

native plover
#

I did some config-pages though

#

Like changing margins and stuff

#

I am total noob, lol

oak quest
#

that is not the same way. touying exporter embeds svg images into html files while exporting html means to use the experimental html feature.

native plover
#

I was fine with the pdf but this presentations have some gifs into it, which pdf doesn't support so have to use html

oak quest
#

why not using the touying exporter when finishing the writing?

native plover
#

I am using it for now but I saw that Tinymist has it by default so thought would be nice to just use Tinymist

vast rock
#

yea

#

though probably just need to change the typst-py version in pyproject.toml

oak quest
#

im not using touying tbh. my slide documents still stick to polylux 😂

vast rock
#

just need to merge this ig

vast rock
#

but the exporter works with polylux too

oak quest
#

didn't know it.

vast rock
#

yea i tried it and it worked. since its just svgs crammed into impress.js, the package used doesnt really matter

jovial saffron
#

Not sure if there is anything you can do about it, but Cortex XDR (a security app monitoring anomalies on my work MacBook Pro) terminated VSCode repeatedly during the weekend immediately when I typed a character in a Typst document while having Tinymist active. Disabling Tinymist stopped it.

Ie. it thought Tinymist is malware.

It uses some heuristics for detecting possible malware. Now it works just fine, but I'm not sure if Tinymist was whitelisted or not. I was contacted by our IT and reported that Tinymist can be whitelisted - if they didn't do it already.

Anyway, just to let you know if similar thing is being reported later.

oak quest
# jovial saffron Not sure if there is anything you can do about it, but Cortex XDR (a security ap...

There is a similar issue: https://github.com/Myriad-Dreamin/tinymist/issues/1394
No particular good solution I guess, other than I pay some money to ask Apple and Microsoft for stopping spam it as a malware, by sign it with some trusted certificate.

GitHub

Describe the bug Can't run any commands in Tinymist. When installing the extension, VSCode shows the following error: Failed to activate tinymist: Error: Could not find a valid tinymist binary....

oak quest
#

Today's random linter stuff.

#

I only matched the pattern x logic_op y, there would be perhaps some other pattern like type(t) in ("string", "integer").

jovial saffron
oak quest
oak quest
vale axle
#

Although, after this, I'm then supposed to build the vsix in contrib / .... / vs-code and it will use that tinymist.exe automatically?

oak quest
#

you could start a drafting PR, so that we could discuss and solve it concretely. The only reason we are not actively publishing nightly releases is simply caused by we don't have bandwidth to do that. If you start a PR, volunteers may participate to make a nightly release together.

vale axle
oak quest
vale axle
oak quest
#

Clicking the checkmark on the PRs, and drag down to the summary page, and you will see them, .

harsh wing
oak quest
#

I'm communicating with prettypst to replace typstfmt. https://github.com/antonWetzel/prettypst/issues/9

typstfmt is awesome and has stayed with us for 2 years, but it should be unfortunately replaced as it is eating my time to maintain tools.

because as typst changing its syntax, it becomes non-trivial to upgrade typstfmt to support new typst.
prettypst is another formatter made in early times, it was proposed to get merged in typst/typst but that PR was not merged successfully. I'm not sure its code quality, but it should be much more easy to migrate some features from typstfmt to prettypst, especially those missing in the typstyle. This could be an alternative solution of typstyle.

GitHub

I'm impressed that you keep maintaining this formatter for typst. I'm considering deprecating typstfmt and adding another formatter competing to typstyle. I have questions before adding it:...

jaunty kiln
#

It can use tree sitter grammar for formatting

oak quest
#

sounds like a promising (to be complete) but heavy solution. Is it ever used by someone?

oak quest
# jaunty kiln It can use tree sitter grammar for formatting

For the ML languages. OCaml is a language Topiary can handle, but the sheer complexity of languages like Haskell place them well out of scope for a "Good enough" formatter. I.e. the effort to make a "good enough" formatter is not far removed from making a "good" formatter.

We are still in a phase where the allowed capture groups aren't set in stone yet, and maybe Topiary will become powerful enough to take on larger challenges like Haskell in the future, but for now we our focusing our effort on what we consider languages with less complicated style preferences.

topiary has to handle code style for languages. typst is likely not suitable. topiary on markdown could answer this, but I didn't find it from quick search.

https://www.reddit.com/r/rust/comments/11mt3dn/topiary_a_code_formatting_engine_leveraging/

Reddit

Explore this post and more from the rust community

jaunty kiln
#

I know the devs showed up here early on and mentioned that they'd be interested in adding typst support if someone else did the grammar

#

I'll see if I can find the thread

#

It's in #old-showcase. For whatever reason I'm not able to link to it

cursive bough
#

since typstyle has reached full maturity, and is being deligently maintained, why not stick with typstyle? even make it the default option?

jaunty kiln
#

Isn't it already the default?

#

Anyway having options is always good

cursive bough
oak quest
oak quest
cursive bough
earnest grove
#

hello! i'm looking for some help with a multi-file project, specifically importing styling, e.g. headings, from parent directories into a subfile
i've looked at the resources mentioned in this support post https://discord.com/channels/1054443721975922748/1318273312383565934
but still can't figure it out
currently i have the output of LspTinymistGetServerInfo giving the proper root dir, as is obtained by nvim-lspconfig by the presence of a .git folder
but the relative imports from subfile say:
failed to load file (access denied); Cannot read file outside of project root.
end goal is to have a shared preamble
if anyone has any place to redirect me for support, that would be much appreciated; thank you!

oak quest
earnest grove
#

root/class/premable.typ
root/homework/.../hw1.typ

oak quest
#
  • root/class/preamble.typ
  • root/homework/x/hw1.typ
    How do you import the preamble.typ in hw1.typ? If the root is set to root/, it should be either or:
// in /homework/x/hw1.typ
#import "/class/preamble.typ" // or
#import "../../class/preamble.typ"
earnest grove
#

the first way tries to path from the dir of hw1.typ, the latter way gives access denied error
altho, as above, the root dir environment seems right, but then i wouldnt need relative pathing so it's probably not actually

oak quest
#

Then, I only know you haven't set the root correctly, which is not a problem about multiple-file projects. This should be handled by nvim-lspconfig tho.

earnest grove
#

hmm, ok; ill keep trying.

thank you for the help!

earnest grove
#

just for the record, deemed the appropriate way to manage styling like this is to create a local package and import it
(am just symlinking to local pkgs from parent dir)

oak quest
jaunty kiln
#

@oak quest the link to "harper" on the github page is broken

oak quest
#

ic

earnest grove
#

happy to report all works well on helix!

lapis scarab
#

is there a way to live preview in a pdf viewer (sioyek) instead of the browser? ( i use helix as my editor )

lapis scarab
#

ok so i read the docs and i used config = { exportPdf = "onType" }. but sioyek seems to crash onType

#

fish: Job 1, 'sioyek a1.pdf' terminated by signal SIGSEGV (Address boundary error)

lapis scarab
#

nvm i just switched to zathura

#

works flawlessly

buoyant sand
#

Lol

#

Sioyek seems a little unstable at times

#

I get random crashes with it even without export on type

lapis scarab
#

thats sad, i was kinda liking sioyek

hoary stag
#

Can I configure tinymist to treat the first opened Typst file as the project file (so that it's used for preview until I quit the editor)?

#

Currently I set typstExtraArgs = ["main-file.typ"] in .helix/languages.toml, but I have many projects with several documents in the same directory (for example lecture notes, exercises and slides).

#

It's annoying having to edit .helix/languages.toml to work on the lecture notes, then edit it again when I need to work on the exercises. I'd prefer if I can open the lecture notes in a helix instance, the exercises in another instance

harsh wing
#

In Neovim you can totally do this, but I guess it could be also possible to deligate this to the server with a new option.

hoary stag
harsh wing
#

Well, Neovim also doesn't provide this, but I can set it up for this.

  commands = {
    PinMain = {
      function()
        vim.lsp.buf.execute_command {
          command = "tinymist.pinMain",
          arguments = { vim.api.nvim_buf_get_name(0) },
        }
      end,
      description = "Pin main file for better autocompletion/error messages",
    },
  },
hoary stag
harsh wing
#

I'm sorry that I use a superior editor. 😎 ||just more mature||

hoary stag
harsh wing
oak quest
# hoary stag Can I configure tinymist to treat the first opened Typst file as the project fil...

very much believe that the clean solution will be using the projectResolution = lockDatabase. I have finished most of it, but it lacks of testing. I will continue developing it in near future. some related issue: https://github.com/Myriad-Dreamin/tinymist/issues/1697

GitHub

Is there an existing issue for this? I have searched the existing issues Platform x64 Windows (win32-x64, Most Common) Editor VS Cod(e,ium) Editor Version Version: 1.99.3 (user setup) Commit: 17baf...

hoary stag
#

something I wonder since it's based on lockfiles: would this allow me to open lecture-notes.typ in one helix instance and exercises.typ in another helix at the same time? (when lecture-notes.typ and exercises.typ are two "main" files in the same directory)

oak quest
vast rock
#

from what i understand, it does

#

youd have to build from source though

hoary stag
#

with the following helix config I can press Ctrl-P to pin the current buffer as main file:

[keys.normal]
"C-p" = ':lsp-workspace-command tinymist.pinMain "%sh{pwd}/%{buffer_name}"'
vast rock
#

nice

hoary stag
#

Now I'm trying to call scrollPreview from helix but it seems I must give a string as first argument (before the panelScrollTo event)

#

any idea what this string is?

flint pollen
#

hi. if I write a function docstring like this:
/// Each row is passed as one markup block (`[...]` syntax)

Then the [] brackets are not shown in the hover text. Is this a neovim side issue do you think or is it something tinymist does, that the ] get lost? With [[...]] in the source text they come through as [...] in the doc text

buoyant sand
#

the typst docs itself use `[...]` to render markup, `{...}` to render code and `$...$` to render math

#

could be that tinymist follows that convention

#

to be specific it's used to show values as source code in those modes, not necessarily to render the content itself

#

i.e. `{11pt}` shows 11pt in that red tone the webapp uses for length literals

flint pollen
#

aha that's neat

#

there's way more smarts there than I thought

#

sounds like double [[ is the right answer then

#

hmm no, {[...]} would be the one because it's illustrating an argument like table([...])

#

thanks!

earnest grove
#

probs not exactly the right thread for this, but my 2¢ related to the above convo:
nvim better than helix for typesetting until helix gets support for unicode concealment and snippets (properly out of the box)

buoyant sand
#

It wasn't really related to that though was it, it was about doc comment syntax supported by tinymist

scenic wolf
#

Hi.
How I can format my files within helix?

vast rock
#

should work

#

you might need to install typstyle separately but i think it's part of tinymist when u install it

#

then you can do :fmt

#

(or whatever other settings you need to make it format on save)

scenic wolf
#

Thanks!

harsh wing
#

I noticed that #1.1.to-bytes() is not completed. Can float.to-bytes.size be completed with 4/8?

jaunty kiln
#

Casually dropping latex export

harsh wing
harsh wing
#

Sorry for the hustle..

oak quest
#

Latest release has last remaining todo list:

  • the markdown converter (typlite) doesn't like examples in fletcher docs, but I should be able to make it happy with few LoC changes.
  • I would like to make it work, Sample workspace to Make and Prepare for Submitting IEEE Papers
  • I found many compile errors in cetz and fletcher docs, it shouldn't prevent release but I can send issues to them.
flint pollen
#

There's a couple of incompatibilities between tinymist and tidy's doc syntaxes. That you know of course, but even if using old-syntax: true in tidy, they disagree on these points:

  • Tidy wants documentation for parameter named ..args while tinymist wants this parameter to be named args in the list. Worse, tidy trips an assertion if you name this parameter args (because it doesn't find the corresponding thing in the function signature)
  • Tinymist uses {...} and [...] conventions and tidy does not. Compatible option that works with both: [ A B C ] (extra spaces, yes I want to show the [] things in the raw code)
/// - args (arguments): Rows like `{[A & B & C]}` and other positional or named table function parameters.

Example above of a good doc comment for tidymist.

I know it doesn't necessarily make sense to "complain" here. I want to hear if others are looking at the same thing and have a good way to work with both in harmony

oak quest
oak quest
flint pollen
#

I'm setting up doc generation with tidy now. The end result is very nice, it looks good. I still think that LSP/hover available documentation is more important than a nice pdf manual, so I'm trying to have both work as well as possible.

In many places I've updated to use for example This syntax: `typst none` (triple backtick) which works fine in both places and adds syntax colors to none in tidy.

oak quest
#

may be there should be a formal syntax to help achieve flawless consensus.

sturdy surge
#

What Tinymist setting disables inline argument name previews? I find them a bit annoying.

harsh wing
#

I think it's only editor-specific setting.

sturdy surge
#

Ah. They're called "inlay hints" and are a global VSCode setting

oak quest
#

I think it is disabled by default.

buoyant sand
#

Speaking of, does LSP provide any way to configure which of them are shown? I think it has a distinction between type and parameter inlay hints but all other hints are just whatever to LSP right?

#

I wonder how tightly one might control them because I like some of them but find other irritating and I have a keybind to turn them all on and off as needed

oak quest
#

it doesn't have way to show part of inlay hints.

#

i recent find some inlay hints could be useful for most people. like content preview of label links, it is useful for note taking.

#

and resolve autos and place the value around.

harsh wing
oak quest
#

totally not the same. shiva parses other markup and converts the markup into typst source code and generates pdf by typst.

harsh wing
#

What? I thought it converts between formats.

flint pollen
#

these don't build for me: cargo +stable install [email protected] and cargo +stable install typlite. Do I need to use a nightly compiler or something?

#

the first error for the rc2 build is like this

error[E0432]: unresolved import `tinymist_derive::TypliteAttr`
 --> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/typlite-0.13.14-rc2/src/attributes.rs:4:5
  |
4 | use tinymist_derive::TypliteAttr;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TypliteAttr` in the root
high cypress
buoyant sand
flint pollen
#

yeah good call, I should have tried locked too. I'll try both 🙂

#

one at a time...

high cypress
buoyant sand
#

Lol

#

The publishing step seems to have been fine though

flint pollen
#

(locked did not help, stable rust, current "stable" typlite published)

#

I see that you added typlite to dist.toml - so I guess it builds binaries, where do I find those?

high cypress
flint pollen
#

if it's ok I'll report the first bug I found in .typ -> md conversion 🙂

hardy grotto
#

As instructed, let me move the discussion from the discussion channel (the one that is not meant for discussions).

#

I was telling to @devout tree :

While you’re here answering my questions (which is much appreciated): another thing I couldn’t find how to do with tinymist is changing the surrounding environment. A very basic operation is: you are editing a lemma and suddenly feel the need to turn it into a theorem. In vimtex that would be cse (change surrounding environment) anywhere in the lemma and then type theorem. Again I was able to use treesitter to get that, but I couldn’t see how to do that with tinymist.
#

and

Even more basic: I couldn’t even find how to open a table of content for my typst file (this I’m not yet done emulating it).
devout tree
#

although toc I feel should be doable one sec

cursive bough
hardy grotto
#

Thanks, I’ll try to remember for next time.

devout tree
#

you can also forward messages now

devout tree
vast rock
devout tree
#

all features are new features until they aren't

hardy grotto
cursive bough
# devout tree

I want to be your friend.. We can talk about discord features!

devout tree
hardy grotto
#

Anyway, the interesting part is really to learn how to have a nvim+typst setup that is (at least!) as good as nvim+latex.

#

Do you have nice auto-completion when using typst? For instance for references or citations?

#

What do you use for preview? I see in your config exportPdf = "never",

cursive bough
#

Neovim plus typst sounds nice actually.. Atleast when I watch neovim users on YouTube I think it looks cool.. But maybe it would be natural with typst to do the whole terminal warrior bit.

#

It's good that you're trying this out @hardy grotto

flint pollen
#

in neovim I use chomosuke/typst-preview.nvim for preview

hardy grotto
#

I’m sure nvim+typst can be glorious, I simply don’t have the right config yet.

devout tree
hardy grotto
#

And you never refer to a previous lemma or equation?

devout tree
#

uncommon enough that i do it manually i think?
don't really remember, tinymist may have autocompleted it

flint pollen
#

also I've done next to no typst specific configuration of the LSP, the generic config seems to work well

devout tree
cursive bough
flint pollen
#

magic. Can it do tables?

devout tree
hardy grotto
#

My computer doesn’t like your config 😢

devout tree
devout tree
hardy grotto
#

It says “E5113: Error while calling lua chunk: /home/pmassot/.config/wumpy/lua/config/colorscheme.lua:1: attempt to call global 'nixCats' (a nil value)”

devout tree
#

yeah requires all my nix stuff

#

if you have nix installed you can just nix run it

#

includes all LSP deps and stuff, makes me happy

hardy grotto
#

This is from simply putting you nvim folder on my machine and telling nvim to use it.

devout tree
#

yeah that won't work

hardy grotto
#

I don’t use nix, so I’ll try other ways to investigate.

#

Because I still get the lsp getting out of sync.

#

Which version of nvim are you using?

devout tree
#

some random nightly v0.11

#

v0.11.0-nightly+1351383

hardy grotto
#

I’m on v0.11.0 so it probably doesn’t make a big difference.

devout tree
#

likely not

#

you're possibly on a newer version even

hardy grotto
#

I’ll try chomosuke/typst-preview.nvim to see if it fixes my issue. I discarded it when I searched for typst related stuff since I really don’t care for instant preview (I only find it distracting if something is blinking next to my text editor when I type).

hardy grotto
devout tree
hardy grotto
#

typst-preview is cool, but it doesn’t fix my LSP synchronisation issue…

#

I should have installed it earlier: today my 11 years old daughter prepared her first Typst presentation and I told her she needed to save the typst file to see the updated pdf.

#

I cheated by writing the preamble but then she found that writing the slide was way easier than in Libreoffice Impress!

flint pollen
#

I mean I just had an existing lsp configuration for neovim when I started using tinymist so nothing really needed configuring except preview

hardy grotto
#

Is your neovim config publicly available?

flint pollen
#

nope, sorry

hardy grotto
#

Are you on neovim 0.11? I think it used to work in 0.10, but then I had no time to try more typst before I upgraded.

devout tree
#

just to clarify: what is your lsp sync issue?

#

only updating on save?

hardy grotto
#

No, it’s the LSP getting out of sync. Say I make some mistake and there is an error message. Then I fix the mistake and, very often, the error message sticks around until I do :LspStop and LspStart.

#

And when it does that the syntax highlighting also gets crazy.

devout tree
#

syntax highlighting also getting weird implies treesitter is broken no?

hardy grotto
#

Probably yes.

#

But InspectTree is still working, so it’s really weird.

#

I must have a crazy conflict somewhere.

#

I should try to minimize my config to see when issues start appearing.

hardy grotto
#

Ok, I cloned the kickstart config and added tinymist, and things seem much better. So there is a clear action path for tomorrow night: I need to clean up my main config. This is a good thing to do from time to time anyway.

#

Thanks everybody!

oak quest
harsh wing
harsh wing
# hardy grotto Do you have nice auto-completion when using typst? For instance for references o...

Tinymist supports reference completion, but a lot of times I don't get autocompletion, or a good list of suggestions, because of something. Like I need to sometimes re-insert @ for it to work. And when completing function arguments, they always appear at the very bottom of the list, but above colors, I think. When completing strings, it often will insert first character and ", so it becomes "s"something", which I have to manually fix.

#

I don't think I had these issues with other LSs, but it's definitely not ideal yet.

oak quest
#

it is probably more or less because you have many settings different from the usual ones like you say "because of something."

harsh wing
oak quest
#

for example I remember you say the order of completion items are not perfect, but that is because neovim client rearranges it by itself.

harsh wing
#

The only settings that are different for Typst are

    vim.opt.iskeyword = "a-z,A-Z,48-57,_,-,192-255"
    vim.opt.spell = true
    vim.opt.colorcolumn = { 80 }
    vim.opt.backupcopy = "yes" -- `typst watch` notify issue

And the stuff like --mirror, root_dir, PinMain, and typst_syntax_highlighting_colors().

harsh wing
oak quest
#

So why should it rearrange the items?

harsh wing
#

That's what I'm trying to understand.

#

I'm not into LSP, so I only know that it's somewhere between Neovim, hrsh7th/nvim-cmp(, neovim/nvim-lspconfig), and Tinymist.

oak quest
#

From my knowledge nvim-cmp has to reorder items because it accepts multiple completion sources and combines them into one, but for the reason it reorders the items in the end.

harsh wing
#

It does accept multiple completions sources, but they all provide very few items, so like 95% of items are from LS.

#

There are usually snippets near the top, a bunch of different "variables" at the very bottom, and fields/parameters are right above those variables, basically near the very bottom.

#

Here is the top

#

Here is the bottom

oak quest
harsh wing
#

Is this copilot?

oak quest
#

this is lsp

harsh wing
#

So you just placed cursor to the left of above:?

#

or is this how your completion behaves?

oak quest
#

the transparent text is "inline completion" (or you can imagine it is previewing completion)

harsh wing
#

hm, ok

oak quest
#

@harsh wing I'm not going to be offensive, but I'm judging your settings from my little knowledge about neovim. It is great if you find lsp bugs and let me know.

harsh wing
#

If I make a test case with Nix, will you look into it?

#

I don't like the docker, because it's a big hustle and overhead. Nix is nicer, and more customizable.

oak quest
#

I'm a fun of nix, but I have no time to setup nixos because it might consume my time. I may use nix as my next OS but I don't know.

harsh wing
harsh wing
oak quest
#

The same reason for looking into neovim settings. This is slightly better because I have neovim installed in my PC.

harsh wing
#

Especially since you don't need a window server, unlike for Firefox, VSCodium, etc., it should just work on any UNIX-like OS.

oak quest
harsh wing
#

You can install Nix with basically one prompt on any OS.

oak quest
#

I thought it is an os

harsh wing
#

nah, that's an OS overlay on top of Nix.

#

Nix with (a lot of) extra steps.

oak quest
harsh wing
#

Well, nothing. I just wanna make a reproducible Nix config so that we know exactly what is used.

#

Not everyone is into Nix.

#

With a flake.nix and flake.lock you can do almost anything.

oak quest
#

I just ran hello world so I feel confident. I can take a look if you make a test case in nix, but I don't ensure the due date of seeing it.

harsh wing
#

https://nixos.wiki/wiki/flakes:

Other Distros, without Home-Manager
Add the following to ~/.config/nix/nix.conf or /etc/nix/nix.conf:

experimental-features = nix-command flakes
flint pollen
vale axle
#

is there still interest on doing work to get tinymist to work with latest version of typst / has such stuff been done yet?

oak quest
white solar
#

i have no idea how to set invert-colors=never in the helix language config. did anyone manage to set it?

buoyant sand
#

how is it set in the vscode json config? It should be the same thing, just as toml, really.

white solar
white solar
#

i still didnt get it working :(

#

i tried adding this to the config

preview.background.args = ["--data-plane-host=127.0.0.1:23635", "--invert-colors=never"]
buoyant sand
#

I have a proprietary doc which I can't share for which tinymist preview seems to be in a waiting for message document is not ready loop

#

is this a known issue?

#

Using ```
tinymist
Build Timestamp: 1980-01-01T00:00:00.000000000Z
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.13.1
Typst Source: git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist/v0.13.10#946ea31fb554bcf62e3215f64ddda87d70b026af

#

I found out there was a compile error in an old package

oak quest
#

I noticed the warning in new neovim, may be useful information:

The option definition `plugins.lsp.servers.tinymist.rootDir' in `/nix/store/via5xff0d3fbwg5nfxwpy0lijxbg9n3i-test-sources/plugins/lsp/_lsp.nix' no longer has any effect; please remove it.

https://github.com/nix-community/nixvim/pull/3220

GitHub

Users on matrix have reported issues when rootDir is defined.
nvim-lspconfig historically used root_dir, along with util functions like root_pattern.
Now that neovim's own LSP API is used, ...

white solar
#

sorry if im not understanding something correctly
in vscode:

"tinymist.preview.invertColors": "never"

and in helix:

[language-server.tinymist]
command = "tinymist"
config = {preview.background.enabled = true, formatterMode = "typstyle", preview.invertColors = "never" }

it doesnt work in helix tho :(

hardy grotto
oak quest
oak quest
vast rock
#

Cause I managed to make it work at least for the default preview

white solar
#

i got it (finally)
adding it to the docs would be helfpul :)

cursive bough
white solar
#

ye ill make a pr

cursive bough
#

Epic.

hardy grotto
oak quest
oak quest
#
GitHub

We would like to build a canonical lsp client implementation in, for various purposes:

A heavily documented LSP client code can help people create new LSP client plugins.
We don't see big ...

GitHub

For feat: add a neovim plugin as the canonical lsp client implementation #1842

flint pollen
#

do you know if there's a good way using typlite to:
Have a grid in .typ to put two things side by side (raw typst source and the rendered output side by side)
and export this to markdown, still having it side by side, like in a table?

flint pollen
oak quest
flint pollen
#

I'm reporting a bug I found that's not directly about grids. You'll see it in a minute

#

Another thing about grids in typlite is that if I put block elements inside a grid, then the block elements are dropped outside the markdown table syntax. (I have not reported a bug about that).

I created a side-by-side layout using grid successfully using the following (The raw blocks should use triple backtick, but I can't do that here because of discord)
So that demonstrates what I wanted to do.

#let x-target = sys.inputs.at("x-target", default: "pdf")
#let show-if(cond, func) = body => if cond { func(body) } else { body }
#show grid: show-if(x-target == "md", it => {
  let columns = it.columns.len()
  html.elem("table", attrs: (x: "test"), {
    for row in it.children.chunks(columns) {
      html.elem("tr", {
        row.map(cell => html.elem("td", cell)).join()
      })
    }
  })
})

#show raw.where(block: true): show-if(x-target == "md", it => {
  html.elem("pre", html.elem("code", it.text))
})

#grid(
  columns: 2,
  `
  Raw block 1
  `,
  `
  Raw block 2
  `
)
oak quest
flint pollen
#

do you mean that it's a bug in typlite? Or that I can't do that, I shouldn't put markdown verbatim inside a html td element?

oak quest
#

you can't do that.

flint pollen
#

ok, so user error

#

but the reason I'm trying that is that I need to apply some html rule to the raw block. And wrapping it in pre doesn't actually work for the markdown output

oak quest
#

I didn't consider how m1verbatim should work in md export, so it might not work nice. A subtle thing is that we can output an element in either md or html syntax, and md syntax cannot be nested in html syntax. you hit it in a day we release the typlite 😂

flint pollen
cursive bough
oak quest
#

maybe we should keep m1verbatim as is regardless where it is put in a typst document, which is exactly how it is named.

flint pollen
#

I guess for this small thing it's a bit silly to use typlite but it would have solved some problems - makes it easy to have many examples of the package in the readme

oak quest
#

yeah it is good to write typst docs once and show it on github with rendered md, no more duplication by hand.

flint pollen
#

the fallback here would be to write .md directly, have a script that extracts and renders the examples to svg, which is also ok. But for packages if as much as possible can be rendered to md/html it saves precious space in typst/packages

oak quest
#

having one or two small examples might be good enough, and as you said it will be expensive to render all of them.

#

I think full documentation could be rendered in html and deployed on github pages.

#

and only keep short documentation and highlighted use cases in readme.

flint pollen
oak quest
#

just like what I show in tex export.

#

it will take ten year to build typlite to let it fully understands and emits correct tex macros. before that, only verbatim saves all the life.

#

@flint pollen I think we can let
typst grid element work with raw blocks. I understand you didn't use it for some reason

flint pollen
#

similar for any block level element I think

oak quest
#

this is a bug.

flint pollen
#

ok, I can report it

vast rock
#

Since this is resolved due to https://github.com/helix-editor/helix/pull/12527, can we expect :lsp-workspace-command to take the fitting arguments soon like the current buffer file for pinMain? Similar to how it is with neovim? I think I can already add a keybind for this manually but yea

#

(granted this is only on helix main, not on a release but still)

hoary stag
vast rock
#

yep that but built-in

hoary stag
#

I don't think the new helix feature changes what tinymist can do automatically? if it can get the current buffer name without the user adding it themselves to the lsp command, presumably it could have done that earlier already?

#

I mean for helix tinymist is only the server side, it doesn't ship any client

#

(I guess that could change once helix finally gets plugins)

oak quest
oak quest
#

i'm more seeking the lock file as a game changer, that remembers your compilations (export pdfs, or preview) and infers main files for any files smartly. i'm still not sure whether people will like a lock file in roots but it will always be an opt-in feature, by a config per workspace or in global, so I don't quite worry.

buoyant sand
#

I would personally love it

#

I'd also like having typst.toml to mark these things in general

#

Any sufficiently complex document should have one

oak quest
#

laurenz personally prefers single-file documents, and modules can be created and maintained as packages. I think it is good as well.

#

in the cases, we shouldn't and don't have to generate lock files to guess the main files.

buoyant sand
#

I agree for simple documents

#

But a thesis is not a simple document and the churn of having to reconfigure the root or main file all the time is more annoying than having a typst.toml that lists these

#

Which is why I said sufficiently complex documents

autumn sandal
#

Hey, I'd like to have a pre-compile hook that would run a script before compiling the typst document.
This is useful for implementing features that are not possible from within the typst document (say perhaps: https://discord.com/channels/1054443721975922748/1387248729169334353)
While I could make a script to do some pre-compile step, then run the typst compiler, it wouldn't work as smoothly as a hook inside tinymist, for previewing within vscode.

Is this already a feature / is there already an issue for this?
If its not already a feature, I'd be happy to implement it.

#

either a precompile hook, or a way to call a different compiler (which could just be a script that forwards arguments to the actual compiler)

jaunty kiln
#

I don't think creating documents that are compilable only in Tinymist is a good idea

autumn sandal
oak quest
# autumn sandal Hey, I'd like to have a pre-compile hook that would run a script before compilin...

This is very much like a custom task and we are on the road of making it. The next steps:

  • let the server understand vscode tasks, to run them at server side.
  • watch and run query tasks and post the query result to your script.

https://myriad-dreamin.github.io/tinymist/feature/export.html#label-Hello World Example (VSCode Tasks)

oak quest
autumn sandal
oak quest
#

how?

autumn sandal
#

maybe an example would help me to understand. Perhaps this syntax?: ```json
{
"version": "2.0.0",
"tasks": [
{
"type": "typst",
"command": "export",
"export": {
"format": "query",
"query.format": "json",
"query.field": "value",
"query.selector": "<git-tracked-source-file>",
"query.pipeTo": "${workspaceFolder}/my-script.sh"
},
"runOptions": {
"runOn": "typstPreCompile"
}
}
]
}

this would run my-script.sh with the output from the query?
#

hm ig that could maybe work, since the runOn could be used for any task

#

lemme see if thats an actual thing you can do in vscode tho

oak quest
#

just let you know that, you may not have to rely on watch query. I ever ran the query tasks to make RPG games using typst.

autumn sandal
oak quest
oak quest
autumn sandal
oak quest
oak quest
autumn sandal
oak quest
autumn sandal
#

huh

autumn sandal
oak quest
#

likely

#

we might not be able to contribute a new runOn option

#

But may look like this for a watch task:

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "typst",
      "command": "export",
      "watch": true,
      "input": "main.typ",
      "export": {
        "format": "query",
        "query.format": "json",
        "query.field": "value",
        "query.selector": "<git-tracked-source-file>",
      },
      "runOptions": {
        "runOn": "folderOpen"
      }
    }
  ]
}
olive bison
#

Tinymist works so well in VS code, its really a pleasure to use it. Thanks for your work on this!

oak quest
#

i built the first neovim integration tests. ideally every issue will be made a corresponding regression test.

keen moon
oak quest
keen moon
#

Oh, OK! I see! I was just referring to VSCode Remote Server. Thank you very much!

somber drum
#

Has anyone gotten the background preview to work in Zed lately? It doesn't seem to work for me at all anymore

minor moss
#

Hello, I hope this is the right place to ask. Is there a way in VSCode with Tinymist to get a list of local packages when "Initializing a new Typst project based on a template" ?
Right now one needs to know the exact syntax / package name / version and type "@local/packagename:0.1.3".
I see that Tinymist already recognizes local packages in the VSCode interface.

#

It's not that big of a deal, but it would make the process easier on my side when creating new documents from local templates.

wheat garnet
minor moss
#

I'm thinking about this feature in the command palette.
You select it, provide the name of your package, and it creates a folder and creates a "starter" document based on how the template defined it.

It would be perfect if that box suggested the available local templates, in the same way there is the autocompletion on typing "#import ..."

minor moss
#

👀 😁

oak quest
#

I admit I don't know why I did that

#

but pour down hundreds of templates for completing here is also not good.

minor moss
#

Ok so that is indeed a potential solution, however I'm interested in local templates. (I'm managing a template for my company with some private info I can't put on @preview)

#

From what I understand, that is not possible in the current state. I let you tell me if you think that could be an interesting feature request. But I do get it if it is not a priority or direction you want to go to !

oak quest
# minor moss From what I understand, that is not possible in the current state. I let you tel...

I have many other things to do, but I'll love to review if you open a feature request.

We can get list of @local/@preview packages from language server in vscode easily:
https://github.com/Myriad-Dreamin/tinymist/blob/5c6c118b9c73e69a196fa98f6b256aa5bb7cbcc3/editors/vscode/src/features/package.ts#L82-L83

And we can have completion by not using getUserPackageData(context) but using that from language server:
https://github.com/Myriad-Dreamin/tinymist/blob/5c6c118b9c73e69a196fa98f6b256aa5bb7cbcc3/editors/vscode/src/extension.ts#L478

In template gallery, we didn't use a list passed from the vscode, but fetch one from typst universe in place. This looks not food if you maintain @preview/@local packages for you company.
https://github.com/Myriad-Dreamin/tinymist/blob/5c6c118b9c73e69a196fa98f6b256aa5bb7cbcc3/tools/editor-tools/src/features/template-gallery.ts#L331-L333

#

I notice that you said feature request

#

instead of pull request

#

feel free to open an issue and I can make it when I have time, but I don't ensure a ddl.

minor moss
#

So yeah I meant an "issue" requesting a feature. And of course, absolutely no pressure on doing it, or not, at any time ! It really is not a big deal and a small QoL feature.
Since you pointed at some parts of the code, I'll take the time to look into it and see if I can make some not too educated trials on my side.

#

Thanks for your time !

#

And thanks for the awesome work !

empty girder
#

Is there a way to debug with Tinymist a “layout did not converge within 5 attempts”? I get that very fast with Alexandria and Glossy, I noticed that the Tinymist preview still manages to compile the document but the Typst CLI does not

flint pollen
#

layout did not converge is a warning, so if they both produce the same warning they should both make some kind of document output..

empty girder
#

Oh cool, thank you!

empty girder
flint pollen
#

oh it would be cool to have better tools to debug this, I did a lot of debugging without understanding (and a little bit of using layout-ltd, but it doesn't give so much more info)

#

Using layout-ltd and mapping out the final value of a state with different iteration counts could be useful..

#

@oak quest there's no sidechannel to give us debug logs in tinymist, from the document itself? For example to log state values in different iterations 😺

oak quest
#

only having PDF output after each iteration might not be very useful.

flint pollen
#

The thing I learned from my last bout of this is that state values need to converge. In my case it was floating point accuracy problems, worst kind of problem

oak quest
flint pollen
#

and hover info shows all lengths with 2 decimals but my problems where in the 12th and 13th decimals, so I was kind of blind to it (until Eric helped out) 🙂

flint pollen
oak quest
#

I'm wondering whether we can have a counter updated per layout iterations

#

and we will be able to sample the values according to the counter, like this:

#if layout-iter() == 0 {
value // hover me
} else if layout-iter() == 3 {
value // hover me to get the value in the 3-rd iteration.
}

flint pollen
#

that's nice

oak quest
#

layout-itd:0.2.0 😁

flint pollen
#

it could maybe be an lsp command? region -> sampled values per iteration? (I don't know what's possible)

oak quest
#

no need for a lsp command. But either a user must implement a layout-iter or the compiler must provide one.

#

since the second value is only reachable in the 3rd iteration, you surely can see what value is used by hovering on it.

flint pollen
#

layout-ltd uses something close to that, but it's abusing count.final() and then updating it based on the final value to force another iteration. I don't think count.final() can be used for this unfortunately

flint pollen
oak quest
#

I think I cannot implement a layout-iter at once, because typst layout doesn't work as I imagine.

#

No, but with layout-limiter(n), you can hover to get the value in the n-th iteration.

flint pollen
#

?r I think this is the whole tree. But we don't get sampled values in the intermediate iterations?

#let mystate = state("teststate")
#mystate.update(0)

#context {
  let empty = [#metadata(none)]
  let x1 = query(<x1>)
  let iteration
  if x1 == () {
    // iteration 1
    iteration = 1
    let _y = mystate.get()
    //_x
  } else {
    let _y = mystate.get()
    
    let x2 = query(<x2>)
    if x2 == () {
      iteration = 2
    } else {

      let x3 = query(<x3>)
      if x3 == () {
        iteration = 3
      } else {
        let x4 = query(<x4>)
        if x4 == () {
          iteration = 4
        } else {
          iteration = 5
        }
        [#empty<x4>]
      }
      [#empty<x3>]
    }

    [#empty<x2>]
  }
  [#empty<x1>]

  [Finished at iteration #iteration]
}
flint pollen
#

Nice, layout-limiter confirms that the iteration count is actually correct as written in that code

oak quest
#

you can only get samples in the last iteration.

#

not convenient though

flint pollen
#

convenient doesn't matter when we are exploring if it's at all possible

#

first invent then make convenient 🙂

flint pollen
#

this typst package readme is generated from .typ -> md by typlite https://typst.app/universe/package/tabbyterms
I think it rendered really nicely. But it's using some custom m1verbatim stuff to emit HTML tags to enable tables in tables and raw blocks in tables.
And apart from tables inside tables, there's almost nothing advanced that it needs to show, just that a table was created and using strong emphasis..

oak quest
#

My today dev on README.typ:

= Installation

#let typlite-ver = toml("/crates/typlite/Cargo.toml").package.version
#if type(typlite-ver) == dictionary and typlite-ver.workspace == true {
  typlite-ver = toml("/Cargo.toml").workspace.package.version
}

== Install prebuilt binaries via shell script

#raw(lang: "sh", block: true, {
  "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Myriad-Dreamin/tinymist/releases/download/v"
  typlite-ver
  "/typlite-installer.sh | sh"
})
flint pollen
#

nice, reading toml is a great trick for .typ files

oak quest
#

I find I can also query shell scripts in the readme to test them in CI:

λ typst query 'docs/tinymist/crates/typlite.typ' --root . --features=html '<shell-script>' --field value
["curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Myriad-Dreamin/tinymist/releases/download/v0.13.14/typlite-installer.sh | sh"]
#

everyday feels better with typst..

#

The bad thing was that:

λ typst query ... 'raw.where(lang: "sh")'
error: raw is not locatable

The good thing was that:

show raw.where(lang: "sh"): it => [#it#metadata(it.text)<shell-script>]
#

luckily all of the package.json and Cargo.toml files can be read by typst

tall wadi
#

hi, all, how to check the version of Typst used bu tinymist?

oak quest
tall wadi
#

Can we use our own compiled Typst binary?

wheat garnet
oak quest
pine bloom
#

Clicking on a figure in the preview doesn't jump to the text in the editor and viceversa, putting the cursor in a figure doesn't jump to the corresponding place in the preview. Is that a known limitation?

oak quest
#

might be a regression, but I cannot judge it without a concrete case. preview jump is only served in best effort.

flint pollen
#

Is this expected in tinymist? I'm using neovim. If I have some code with a compile error like this:

// This is other.typ
#let test-func(enable: false) = {
  if not enable { }   // error: cannot apply 'not' to integer
}

// This is in main.typ
#test-func(enable: 1)  // I want a hint diagnostic here

The code is in two different files. I would like to have a hint/warning diagnostic on the indicated line in the main file. Because compilation is failing but no diagnostic says why (in the main file). Currently I only see one diagnostic, an error, and it is on the indicated line in other.typ

#

The webapp does it for this particular test case

flint pollen
flint pollen
#

The listed workarounds didn't work well.. but I managed to fix it in my nvim config... RIP my sanity, that was tough 🪦

flint pollen
flint pollen
#

as you know I reported an issue for this. My understanding now is that it would be best if tinymist could emit a separate diagnostic for the thing that's in relatedInformation right now. Especially because it's in a different file.

oak quest
#

today i'll prepare for tinymist v0.13.16

oak quest
flint pollen
#

also seen in typlite land:

The _term list_<tl> is the following syntax in typst:
....
#show <tl>: link.with("https://typst.app/docs/reference/model/terms/")

we're reStructuredText now 😏

oak quest
#

@flint pollen the main contributor of typlite is busy, so we cannot fix the typlite bug in this release.

oak quest
#

This looks better

#

?r


#let extern-link(target, href) = body => {
  [#place(hide[#figure(kind: "link", supplement: "link", href)#target])]
  show ref.where(target: target): it => link(href, it.supplement)
  body
}

#show: extern-link(<tl>, "https://typst.app/docs/reference/model/terms/")

The @tl[term list] is the following syntax in typst:
....
flint pollen
#

that looks cool, will experiment with that

flint pollen
oak quest
flint pollen
# oak quest This looks better

I'll hack on something derived from this. I was trying to understand and it works when just deleting the figure 😄 so that one doesn't look necessary?

oak quest
#

the figure is only a hint for auto-completing the reference.

flint pollen
#

ohh

#

?r the code is getting too complicated (it's not so satisfying) but I would prefer to write a document where it was like this - link targets can go after the link itself

#let linktarget(label, href) = {
  [#metadata((linktarget: true, href: href))#label]
}
#let linkrefs(body) = context {
  let links = query(metadata)
    .filter(mt => type(mt.value) == dictionary and mt.value.at("linktarget", default: false))
  let labels = links.map(lt => lt.at("label", default: none)).filter(l => l != none)
  show selector.or(<__linkrefs_dne>, ..labels.map(l => ref.where(target: l))): it => {
    for link in links {
      if link.has("label") and link.label == it.target {
        let supplement = if it.supplement == auto { "<link>" } else { it.supplement }
        std.link(link.value.href, supplement)
        return
      }
    }
    it
  }
  body
}

#show link: underline
#show: linkrefs

The @tl[term list] is the following syntax in typst; see also @bl[blocks].

#linktarget(<tl>, "https://typst.app/docs/reference/model/terms/")
#linktarget(<bl>, "https://typst.app/docs/reference/layout/block/")
flint pollen
#

using ref syntax is good though. I kind of like the "original" _term list_<tl> too

flint pollen
oak quest
#

while tinymist doesn't show dots in the same way.

flint pollen
#

hm. I don't see how that matches the scenario in the report, where it's across two different files

#

the diagnostic is placed in an auxiliary (or library) file but the user is most interested in the bug which from the user's perspective was in their own code in the main file, that's where they need to go to fix the problem

#

That's why it's high impact to fix this, if I understand correctly. The diagnostic is in file B but the user needs to edit the code in file A to fix it. (So it would be great if the diagnostic helped point the user to the right location in file A)
I don't use vscode, maybe the user experience is already good there in the same scenario.

#

(will test vscode now 🙂 )

oak quest
flint pollen
#

ok testing vscode was fast to set up. I think the same problem is present there as well?

oak quest
#

yes.

#

and rust-analyzer in fact is placing dots on the hinted code, while tinymist doesn't do it in the same way.

flint pollen
#

ok. sorry for writing too much about this, just want to clear up miscommunication if any

oak quest
#

There is surely some code and behavior we can copy for the r-a

flint pollen
#

rust is not a dynamic language, so I had trouble really finding an equivalent situation in Rust

oak quest
#

I think it isn't about the language themselves, but I found that r-a did use LSP to let vscode show dots instead of not showing anything, so we should be able to do that as well. I don't think we have to duplicate diagnostics to show an unique diagnostic at both error code site and hint code site. But:

  • show the diagnostics at the error code site.
  • show dots at the hint code site, and hover and see "Hint: ..." and an additional reference to "original diagnostic"
flint pollen
#

hm. what does dots mean more specifically?

oak quest
#

😂

flint pollen
#

aha. So that's not a diagnostic? I wonder what the corresponding thing is in neovim

oak quest
flint pollen
#

I think the hint here is a separate diagnostic

#

nvim doesn't support relatedInformation I think

oak quest
flint pollen
oak quest
#

but I found this

flint pollen
#

well neovim reported it wrong

oak quest
#

The neovim-0.9.4.json (obtained from my lazyvim client) said it needed "relatedInformation"

flint pollen
#

it was wrong

oak quest
#

ok

flint pollen
#

I'm just looking at their proposed change and seeing that it does nothing for the cross file scenario

#

I am too annoying now so I think I should either make suggested PRs for tinymist or be silent

oak quest
#

I read rust-analyzer, and find they split diagnostic:

the analyzer reports a single rust diag with relatedInformation like

RustDiagnostic {
  message: primary_message,
  relatedInformation: [msg1, msg2]
}

It will be split into three lsp diag with relatedInformation:

// primary
LspDiagnostic {
  message: primary_message,
  relatedInformation: [sub1 is here, sub2 is here]
}
// sub1
LspDiagnostic {
  message: msg1,
  relatedInformation: [original is here]
}
// sub2
LspDiagnostic {
  message: msg2,
  relatedInformation: [original is here]
}
flint pollen
#

nice

oak quest
#

I haven't go in depth, and I might be wrong.

flint pollen
#

I'm suspecting it's necessary to split the diagnostic, also so that invalidation/refresh of it works correctly.

oak quest
#

I don't think r-a is invalidating diagnostics incorrectly. So this is an enhancement that requires more investigation before fixing it, because we might make a PR that make both vscode and neovim feel good, but after weeks a helix user reports diagnostic issue again. And this is the reason I didn't reply on the issue#1870 quickly.

#

btw today is my workday, and I'm chatting with you when I'm working 😄

flint pollen
#

I made a neovim workaround where I turn the relatedInformation into extra diagnostics in the correct file and line. And that one has huge problems with invalidation/refresh. Feels like it clashes absolutely with the LSP flow of information

oak quest
#

so your question should be gone (invalidation were wrong) if the extra diagnostics are produced in the language server. Specifically, tinymist updates the diagnostic state and refreshes necessary diagnostic changes per file in the editor.rs.

hoary glacier
#

Quick question, is it possible to set a "main" file from which tinymist would compile? Because I have my project separated into chapter files, but I only want the main file to be exported.
For now I'm using this script:

#!/bin/bash

source_file="${1-src/Mage Conversion.typ}"
basename="${source_file##*/}"
target_file="${2-target/${basename%.*}.pdf}"

typst w --root src --font-path assets -- "$source_file" "$target_file"

As a workaround, but I was wondering if there could be a better way.

flint pollen
#

check out this section on multi-file projects https://myriad-dreamin.github.io/tinymist/frontend/vscode.html#label-Working with Multiple-File Projects it's about pinning a main file

hoary glacier
#

Thanks.
Is it possible to make it stateful/static by writing in .idea for the workspace or somewhere, by the way?

autumn sandal
#

is there a way to get tinymist to "unravel" the panic so that line 5 gets underlined red as well when previewing a file?
this is particularly annoying for libraries/templates as i have to go to the file containing the panic() to see what happened

#

as far as i can tell there's not an gh issue for this, which makes me think this is a problem on my part? Somebody would've made an issue for this, surely?

rough olive
autumn sandal
#

oh i basically never use the problems view

autumn sandal
#

i'd be happy to work on adding this if giving some guidance.
Would the changes have to be made in the vscode extension, or in the lsp crate?

buoyant sand
#

Just recently @flint pollen has talked about a similar issue where hints are reported at the call site. I suppose there the lsp would have to add new diagnostics with the spanse of the associated trace

#

So it's probably a thing for the language server, itself not the extension

flint pollen
oak quest
oak quest
#

i run out of copilot quotes after requesting 4 prs. copilot will not listen to me until next month. The plan of accepting copilot as a maintainer goes dead in 6 hours.

urban grove
#

At least it was a thing

harsh wing
autumn sandal
#

this might have some not so good implications tho

#

i dont think you could figure out how far to unravel the call stack before replacing with placeholder content

cursive bough
oak quest
#

To complete/analyze too dynamic code, I added some enhancement.

#

It will work well with some cheap requests (hover, completion, definition, etc.), but some not with expensive requests (rename, reference, etc.). This is already powerful enough I think.

marsh lance
#

Is there some way to inform Tinymist that I'm working on an HTML project and have it not warn about stuff being ignored in paged export?

marsh lance
#

Thanks! I should read the docs next time 😅

autumn sandal
#

anyways, is there a way i can add onto the sys.inputs from an export task in vscode?
why?: I'd like to have two different compilation modes:

  • one for the digital document
  • one for the printed document. this will omit appendices and other extraneous content in favor of providing a QR code to the digital document
autumn sandal
#

ah i suppose i could use two different files

harsh storm
#

Hi, is there a way to activate scroll synchronization between the editor and the preview (like in the Web App)?

oak quest
harsh wing
#

Flashback to all the news where a help chat bot for some companies starts hallucinating and then they get a backlash.

oak quest
#

If you don't trust llm, you can verify the "search result" by checking the spec markdown file.

harsh wing
#

yeah, here it's not critical

patent ibex
sturdy surge
#

What's the current state of Sublime Text support for Tinymist? Has anyone got browser preview working with click to reverse lookup?

#

I have set up the Tinymist LSP and can separately run tinymist preview from the command line to see a in-browser preview, but they are not integrated

harsh storm
oak quest
oak quest
somber drum
# oak quest

Is deep seek like the Chinese OpenAI? ChatGPT has like a 90% market share around here, does Deepseek have a similar market share in China and is like "the default" chatbot?

oak quest
heady prawn
#

Quick question, could tinymist feasibly be used as an LSP inside a swift app?

#

say like a macos app

#

or ipad

#

I suppose maybe by using tinymist-query and writing a bit in swift that conforms to lsp

oak quest
# heady prawn Quick question, could tinymist feasibly be used as an LSP inside a swift app?

I remember swift can run and call c functions, so you could build a rust crate that integrates tinymist as git deps and exposes C APIs. As for mobile env, I know tinymist can run in android for emacs android, but I don't know whether ipad provides some more restricted env for applications preventing tinymist from running.

To run tinymist in rust apps with stable interface and least efforts, I tried a bit with fn test_main. The function accepts the clap arguments and uses fn start_project which starts a language service that watches the file system in background. The whole part is still every internal.

heady prawn
#

Ah also, I'm working on adding Typst support to Nova using tinymist for anyone else who uses nova

#

Next step is integrating tinymist settings into the extension xd

gentle bay
#

Does anyone have an issue with the export pdf on save functionality?

#

in particular, i see that the pdf file is not being written to, despite the typ file being saved

oak quest
#

Do you see "Project: skip compilation for {id:?} due to harmless vfs changes" in the log? If it is, I think we hit a bug introduced by fixing some other bug.

gentle bay
#

i notice that it does write to the pdf when i cmd + hover over any function or import file

oak quest
#

nvm, I think I have fixed it.

heady prawn
#

Can I ask how tinymist receives settings? Like say when writing settings to languages.toml for Helix, how does tinymist receive those settings?

oak quest
# gentle bay Does anyone have an issue with the export pdf on save functionality?
GitHub

Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst]. - fix: emit onSaved signal to exporter when vfs is clean (#1939) · Myriad-Dreamin/tinymist@75fc5f3

oak quest
tardy sparrow
#

I'm using Tinymist for Typst in VSCode, and when I use code completion, it automatically inserts (). Is there an option to change this behavior or disable the automatic parentheses insertion?
For example, when I have a word selected and type #strong, the auto-completion result becomes #strong()[word]. I would like to either disable the () insertion completely, or have it auto-complete to #strong[] instead of #strong().

oak quest
# tardy sparrow I'm using Tinymist for Typst in VSCode, and when I use code completion, it autom...

We complete function calls with two variants:

  • #fn| expands to #fn(|). If the fn is known to accept zero positional arguments, the cursor is moved to right of the parens.
  • #fn.bracket| expands to #fn[], if a function accepts exactly a content value first. Thus, the fixed and quick way to get #strong[|] is completing#sobk| (strong.bracket)

The above is a sensible default settings imo, and I haven't tuned any functions.

tardy sparrow
oak quest
#

First, I need to split the part of code (this is possible but only kind of cumbersome because I built most code of tinymist in typst.ts). Then I need to reimplement the lsp transports for vscode web's web worker. And at last, I need to update the extension code to bootstrap (I finished it tonight).

#

I'm interested in bringing tinymist's documentation functions to browser. This will be nice, as we could have a docs site that can check docs typst packages at any revision. https://docs.typ/@github/User/repo/branch-or-rev/path/to/package.

  • @github/User/repo maps to the github repository (or other git source) that could be fetch from network
  • branch-or-rev means we can check documentation at any revision.
  • path/to/package is the path to the package. For most packages, this is empty.
cursive bough
oak quest
#

which one will be faster to be production ready?🐱

cursive bough
#

but personally, while it would be cool to have tinymist in the browser, I think like the rust-analyzer guys.. you might realise that it would not have many users. I want to positive here, but it is just.. very cool, but, who will use it?

#

Oh! You want to build a docs.typ (kind of like docs.rs).

#

I get it now!

oak quest
oak quest
#

I used tinymist web in github.dev and it looks really useful. it should be good to at least bring some functions to bring convenience to read code on github.dev

#

My goal is merely make it convenient to read code on github

cursive bough
#

Right.

#

But aren't there more important feature to pursue this?

#

I can't see a "symbol overview" when I explore typst packages in vscode. I don't get to look for symbols in the workspace either, so I always use the find-window to navigate typst packages.

oak quest
cursive bough
#

I get this when exploring the touying package.

oak quest
#

It kinda works but not much. tbh I haven't used this feature and the code is from the typst-lsp

cursive bough
#

Okay.

#

Well, I sort of use that feature when I have to jump from one definition somewhere to another. Especially with touying. It has internal functions, then templates, then examples.

vital kayak
#

It would also be useful for sharing code snippets and embedding runnable examples

gentle bay
#

when is the next release planned?

oak quest
jaunty kiln
#

@oak quest what do you think about the possibility of having numbering appear as inlay hints?

#

Like in headings and lists and such

oak quest
oak quest
#

I had some similar thoughts to implement some typst-specific inlay hints, like showing the labeled content as inlay hints. I think we can explore it if this message is upvoted. I might also create an issue to collect votes.

jaunty kiln
#

Yeah probably not easy, but I think inlay hints could be useful in a lot of situations

cursive bough
#

I think this is a good suggestion actually.. In practice, it might not feel important, but for equations, or long winded explanations.. I sometime check the labels, in the pdf, to see if they make sense, and sometimes, I would have used the wrong label. Sometimes it's easy to discern in the code, but other times, the number itself makes it apparent if something is goofed.

#

The web app shows a little preview of what the label points to. That's super helpful too..

cursive bough
#

Is this what I asked about? With the symbols?

hardy grotto
#

I see a weird failure with Tinymist preview. If I try
?r

#set text(size: 50pt, 
  fill: gradient.linear(..color.map.rainbow),
  stroke: 1pt + green
)

Test

I don’t see the stroke in preview (but it’s there in the pdf output).

#

Can anyone reproduce this?

flint pollen
hardy grotto
#

Which same thing? Do you see the stroke?

oak quest
hardy grotto
#

Oh I 100% vote for neovim fixes!

oak quest
#

I completed the last bug reported in 2024 and there are 14 bugs left in 2025. I have already set up automated and e2e tests for neovim, and I hope this can ensure stable support. I will add some random improvements to make myself happy (I don't want to see the bug fixes fulfilling the changelog)

hardy grotto
#

I only wanted to check whether I had something broken on my side.

#

And I’m extremely grateful for your work on all this, don’t worry!

flint pollen
oak quest
#

I just forgot it. It would be great if you could form a bug report and submit it on GitHub. You don't have to attach logs, because the code snippet has reproduced the bug.

flint pollen
#

When I work on other projects now (not typst) I miss the sampled values on hover.

oak quest
#

the sampled values on hover are usually called "Inline Values" information. I view it a killing feature but hard to implement in other languages. Debuggers could implement it: when you stop the program and values can be get on hovering. Some special languages may also implement it (nix might be one).

flint pollen
#

yeah it's like a constant live debug

#

by the way the neovim work you are doing - the canonical client - I'm just wondering about a clarification - what's the use of that, is it relevant for tinymist users at all, will we use it? Or is it just for automatic or interactive testing of tinymist + editor during development?

oak quest
# flint pollen by the way the neovim work you are doing - the canonical client - I'm just wonde...

As I mentioned in the PR, I would like to add comments and tests to the neovim client. The neovim client may not be really used by users, though I hope it could, but the code must be continuously and sufficiently tested. The extra exposed lsp commands must be heavily documented and help developers plant features in other client (like jetbrains). Some features that I don't want to document in the https://myriad-dreamin.github.io/tinymist/ but the canonical client includes:

  • how preview instances are created and maintained by clients.
  • how to get extended notifications from the server: compile status, document outline, and so on.
  • how to use the features other than previewing: profiling typst compilations or lsp server, get debug information about a typst document like font usages.
#

The neovim client may not be really used by users, though I hope it could
Since I found many neovim users are satisfied with only having standard lsp features, that provided by nvim-lspconfig. Installing a language-specific plugins seems to be excessive. I think it understandable and I also prefer to implement the standarized features whenever I can.

wheat garnet
flint pollen
#

Having the pin main command is very useful. When starting I only used lspconfig and typst watch and it's good that it works so well with only that. And typst watch is something I come back to when using/testing development versions of typst anyway (only sometimes)

hardy grotto
hardy grotto
flint pollen
#

neovim also ships with a bit of typst support already built in (indent settings, syntax colors, commentstring and such settings)

#

the vim world is messy. Three sources for syntax colors (legacy and treesitter and lsp)

oak quest
# flint pollen Having the pin main command is very useful. When starting I only used lspconfig ...

I suddenly have some idea that replacing the pin main command. https://github.com/Myriad-Dreamin/tinymist/issues/1982

The previous pinMain('entry.typ') is as same as pushCompilationHistory(['typst compile entry.typ']). With this I think I can deprecate the pinMain and unpinMain. I don't know whether people will be bothered by not having unpinMain in future.

GitHub

Motivation tinymist.lock is database that remember compilation history happening in the workspace, to help the language server understand the documents and source file relationship in the workspace...

flint pollen
#

aha

solemn coral
#

I am getting bad server configuration after updating tinymist

#

bad server configuration: failed to deserialize ""preview": Error("invalid type: boolean `false`, expected a string or an object with image and rest fields", line: 0, column: 0)

oak quest
#

please check the errors in the configuration. there should be one that was not detected previously

solemn coral
#

How do I do that?

rotund flame
solemn coral
#

Thank you. Changing invertColors fixed it

rotund flame
#

However, it's strange that you got a boolean false while I got a null.

#

I'm not very sure about VS Code's default behavior

solemn coral
#

It might have been a previous configuration I set

#

when resetting to the default, it goes to null - and setting it to "auto", "never", or "always" makes the warning go away

rotund flame
#

Ok. That makes sense then.

solemn coral
#

I believe it worked with true/false on previous versions

#

Also, why does it not use a drop-down on settings editor? I would rather not edit the JSON manually if I don't have too

crimson blade
flint pollen
#

that's a good idea. What text objects are you thinking of? I've noticed that the function text object (tree sitter based) is not even working in typst, that's not good

#

(does it work for you, in neovim?)

hardy grotto
#

in my ~/.config/nvim/after/queries/typst/textobjects.scm I currently have

(math) @typst_math.outer
(math (_) @typst_math.inner)
(code _ @typst_function.outer) ; This is needed for the next query to jump back.
(call item: (ident) @typst_function.name (_))
#

The math is really the most needed one. It allows my to yank formulas.

#

The function ones are also nice when I want to turn a lemma into a proposition or theorem.

#

This is assuming you use treesitter.

#

Of course I also have Typst snippets. This is much less needed than for LaTeX because there is a lot less boilerplate code. But it’s still mandatory if you want to use fletcher for instance.

#

I can share more details if this is not enough.

flint pollen
#

thanks for sharing! I've never touched treesitter configuration at all, I just use standard configs. Will try this out

hardy grotto
flint pollen
#

that one I have

hardy grotto
#

Then in my treesitter config I have

    textobjects = {
      select = {
        enable = true,
        lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
        keymaps = {
          ['aa'] = '@parameter.outer',
          ['ia'] = '@parameter.inner',
          ['af'] = '@function.outer',
          ['if'] = '@function.inner',
          ['ac'] = '@class.outer',
          ['ic'] = '@class.inner',
          ['i$'] = '@typst_math.inner',
          ['a$'] =  '@typst_math.outer',
          ['fn'] = '@typst_function.name',
        },
      },
#

With this, I can put my cursor anywhere in a formula and type ya$ to copy the whole formula,including dollars, and yi$ if I don’t want to include the $.

buoyant sand
#

Does neovim not come with delimiter matching?

#

Ah wait I remember this feature in helix was inspired by easy motion I believe

flint pollen
#

if you mean like matching {} and () and jumping between then, yes it comes with that, % jumps between them. And there are default built in text objects for the regions inside {}, () and so on

buoyant sand
#

Ah but it won't do that for any delimiters defined for a language then?

#

Just a default set?

flint pollen
#

in other programming languages I have for example yaf to copy the whole current function which doesn't work with typst for some reason

#

yaf is (yank all function)

flint pollen
hardy grotto
#

There are probably plugins that extend this default set. But treesitter is already around, so it’s easy to use it.

buoyant sand
#

Yeah that makes sense

#

I don't actually know if helix needs the tree sitter queries for this or if it can just do this from the simple language delimiters config

flint pollen
#

what's a delimiter in that sense? So it starts from #let ... and captures until the final } ?

buoyant sand
#

They're configured in the languages config and are used for this and stuff like auto closing

flint pollen
buoyant sand
#

So for math it would be the dollar signs

flint pollen
#

dollar sign matching already works in neovim without change

#

I regularly use it

hardy grotto
#

Maybe I broke something, let me check it still works.

buoyant sand
#

Ah right you guys don't select things before you yank it

#

I forgot

flint pollen
#

oh and that means that when I said that's the only thing that works above, that's because it's a default thing

hardy grotto
#

I don’t understand what you mean.

#

The af has nothing to do with typst, the one about typst is fn.

#

Sorry I should have removed the bits that have nothing to do with typst.

flint pollen
#

that's basically one of my questions

hardy grotto
#

Do you see the tree with InspecTree?

flint pollen
#

yes

hardy grotto
#

The way I use fn is to swith between different function names. Say I have

#lemma[
  $1 + 1 = 2$.
]

and I decide I want to upgrade this to a theorem. I have my cursor anywhere in the statement and I type cfn (for “change function”) and the “lemma” gets deleted and my cursor is there.

flint pollen
#

nice

#

ok, I have no way to debug what's going on so I'll have to slowly read more about this

hardy grotto
#

I’d be really happy to help, but my family is calling me.

#

sorry

gentle bay
#
[2025-08-04T19:47:45Z INFO  sync_ls::server] handled  textDocument/formatting - (939) in 498.67µs
[2025-08-04T19:47:45Z INFO  sync_ls::server] notifying textDocument/didSave
[2025-08-04T19:47:45Z INFO  sync_ls::server] notify textDocument/didSave succeeded in 12.71µs
[2025-08-04T19:47:47Z INFO  sync_ls::server] handling workspace/executeCommand - (940)
flint pollen
#

I made something, this is the first working definition of @function.outer for typst in treesitter. (Sorry for all the neovim/treesitter talk..)
(let pattern: (call _) value: _ @function.inner) @function.outer
Only thing is I'd like to include the # before the let if possible I think. If it exists

hardy grotto
#

I’m back.