#Tinymist
1 messages · Page 3 of 1
I think memoization could affect coverage
would coverage colleciton not be possible form typst-eval directly without adding anything to the AST?
since that was the problem last time
it would, but it would require more design and bikeshedding
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.
I think iterations should be visible but memoization is something a user shouldn't have to be concerned with generally
Or you mean some coverage will be faked by the comemo.
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.
will it be a problem if we only collect coverage about cold compilation.
it's a reasonable approach for tinymist I think
for a compiler API it would to handle it
[[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?
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)
How long between the 13.6 rc and the 13.6 stable release? Sadly the zed extension ignores pre-releases :/
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.
I find some not pretty case, that the unreachable branches are reported as uncovered. There is still a long way to go..
What are toy showing us 😃?
Experimental coverage info
(which code is actually run and how often)
This helps increase test coverage
Oh.. I think I get it. That's nice.
hm im trying to use helix for typst, is there a way to make it automatically open the pdf preview?
https://github.com/Myriad-Dreamin/tinymist/releases
Have a look at the latest release notes
I think the background preview is what you mean
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}
Unless you explicitly installed the pre release that feature isn't available yet
i just want the pdf viewer to launch at the same time
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
I'm not quite sure what exactly you mean, but you might find a solution here https://github.com/Myriad-Dreamin/tinymist/blob/main/editors/neovim/Configuration.md
You can have the pdfs generated automatically
But tinymist can't open them automatically, although the preview might be able to?
by default export is independent from open, I hope helix could have a way to combine them. tinymist's export does have an option to open after write, but helix doesn't support to enable that option.
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?
what did the log say?
I translated all titles of commands in vscode using LLM.
Looks great but I don't really know how actually good it is.
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.
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.
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
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.
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)
I meant you could validate the input by making some code, like https://typst.app/universe/package/valkyrie/. To check that your code correctly implements the validation, you could write some tests.
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
No worries! Just wanted to provide the little feedback I have.. 🤷♂️ Translations are always a process to get right.
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.
Ok, makes sense yes. Right now I do see tiny mist inferring types if I provide a sample JSON file, so that's already great for auto completing fields
@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)
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.
Another solution would be to use a barebones browser for the preview. Something like qutebrowser, you can configure it to hide the tab bar and status bar and then it's just the content without any UI... And it should be easy to configure the window manager to always open those windows with the geometry that you like
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 🙂
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.
hm idk why but it doesn't open a preview at all for me
[[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
Also doesn't work for me in Zed :/
Update: works on latest Zed version
thanks for suggesting qutebrowser! i absolutely love it
what's the version of tinymist you are using? You could also send logs of tinymist to give more information if you find them.
does it work after upgrading tinymist?
Nice, I didn't think of --open flag working great. You did invent the good trick for helix.
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"]
ah nice, yes I think both of your versions are good options to have. I'll try them and see what works best for me
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.
It does somewhat work now, not particularly reliable but most of the time. It doesn't work at all with the --open flag though. Document switching also only works some of the time
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)
@oak quest this seems to add window/showDocument to Zed, so implementing it would benefit pretty much all editors https://github.com/zed-industries/zed/pull/25007/
should this not be in a rustfmt.toml?
vscode ignores rustfmt.toml
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
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.
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
I have pretty much the same config. You need to open the website manually
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
It doesn't work at all.
I'm on mac too.
The lsp is launched, but i cant compile...
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
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 ?
What do you mean?
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.
iirc helix cannot use the formatter in a language server so you should install and setup typstyle separately. typstyle is the formatter used by tinymist.
the jump functionality can be only used by vscode, neovim, and emacs. the support in other editors is in todo list, there is an opened issue describing the plan.
the github action told me to remove a quote from the condition. I doubted it but I still followed his advice. Then, my ci got broken😇. it also lied me a great checked mark since github will ignore workflow file containing grammar errors..
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.
it is very challenging to make completion on the file containing syntax errors. not all cases are handled, and it can be an improvement.
I'm talking about completing #set text(|).
but you missed a right paren.
okay I misread it. you mean the problem is that all completions are shown, though I'm not getting how I can improve it.
The server gives the order of the items?
I see a content completion which is a positional argument, which I should remove in future.
some neovim plugins will re order items. if they don't, tinymist does gives the order.
i think I get it a bit. could you capture and tell the nvim requests. This is to find the difference between adding a lparen and removing a rparen.
you mean the mirror.json?
by your skill. It is fine by capturing it using --mirror.
{"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.
@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.
do you mean explicit messages instead of log? https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#window_showMessage
This document describes version 3.14.x of the language server protocol. An implementation for node of the 3.14.x version of the protocol can be found here.
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.
Thank you. But I can't make typstyle work in Helix. It works perfectly in terminal but not in helix.
Do someone know how to configure typstyle in Helix ?
#1261622502598377545
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.
If you are not familiar with programming or background, you usually only check the related code instead of starting with the main function.
- rootUri and workspaceFolders on initialization: https://github.com/microsoft/language-server-protocol/issues/298
- initialization request spec: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize
- Handling LSP initialization request: https://github.com/Myriad-Dreamin/tinymist/blob/157703ef671806039090a201894021589ea58393/crates/tinymist/src/lsp/init.rs#L35-L51
So you're saying that the main function for LSP command is not related code?
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.
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.
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.
maybe you're just a 10x engineer?
Is that really a question
suggestion? a guess? a hunch?
Does the implementation of window/showDocument aim to make the switching between documents better?
surely, but it is a standard lsp request, so we can only improve it to fit for all language servers.
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
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.
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
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.
sleepy is not using neovim.
I showed the LSP command
i understood your example but the lsp command is not usable in current helix or zed which is the problem of not being using neovim.
not usable?
because those editors don't implement some client side thing?
I thought it would work anywhere.
helix doesn't allow command with arguments, and zed doesn't support to call lsp command
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?
some refined docs should be here, but I haven't cook one for this experimental feature. you could try the following steps:
- turn the configuration resolution into
lockDatabaseand restart editor - tinymist compile main.typ and restart editor
- change the file to template.typ and see if it is pinned to main.typ
in theory it is :). let me know if it doesn't work.
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
I also doesn't work in helix, there doesn't seem to be any lock file
how did it get fixed? I usually know nothing about safari or webkit.
Will try asap
Don't know, could also be some change in Zed or the extensions I use. Good the problem's no longer there, finding out the cause would habe been a huge undertaking 😅
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.
We don't need an option. Once we switch to the solution using the lock file, all the things in the tinymist should use the lock file for consistency.
@somber drum could you open some issues on the https://github.com/Myriad-Dreamin/tinymist/issues ? So that I can track them and won't forget them.
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 ?
What editor is this happening in? And just as a sanity check: you don't have 100% CPU or RAM usage at that time, right? Exorbitant delays sounds like lots of swapping, but if the rest of the system runs smoothly that doesn't sound likely.
VS code, and yeah the system is not particularly stressed, but it's on a corporate laptop and I never trust these machines and their shitty antiviruses
@oak quest thanks for another great release, I love the new showDocument feature
it works great in helix
Do you still have plans for a solution for jumping in the other direction? (I see that https://github.com/Myriad-Dreamin/tinymist/pull/1236 has been closed)
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
It's not closed but in draft.
Sounds like a much better solution, although It also has the problem that the language server cannot distinguish the editor request to changes, like a rename request will sometimes hit to change all source files of your document, from that made by real typing the keyboard.
I may consider the latter one rather than providing a button as the latter one is easier
maybe this feature can ignore any change that hits several files (or several locations in the same file)?
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.
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
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
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.
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
v0.13.12 is not released
ah sorry I missed that, all clear now!
@oak quest opened an issue about the lock file/preview
does tinymist support live share in vscode?
no. it requires the language server to access the virtual file system but we only support to access the physical one.
I'm just asking because latex workshop added this https://github.com/James-Yu/LaTeX-Workshop/pull/4308. But I'm sure they have different challenges
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
I'm not particularly interested in live share, so no need to spend development time on it for my sake 🙂
was just curious
Is there any way to have tinymist also suggest local packages in custom namespaces?
Custom namespaces are not supported. Though I've never tried.
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/"
wow, it does work... I guess this is why you can override preview namespace locally.
yep, everything besides the import suggestions work flawelessly (using tinymist in zed, just as a context)
yeah, then it is a feature request, I guess
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.
that's sad to hear as i think this is an awesome "feature" as it allows me to separate templates and packages i use personally (@personal) from templates and packages i use for eg. for work (@work) etc.
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.
ah, okay, got it, I'll try to make one when I have a bit more time :)
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.
There is now vim.fs.abspath(), which I think means that I no longer need plenary to set the root dir.
Ok. Solve when using Tinymist from Mason, not from homebrew...
🥲
Hi guys, I just try to switch from web app to tinymist + vscode, somehow auto complettion does work within math mode, any suggestion?
does or doesn't?
Doesn't. But they said in another channel that they resolved it. It was the quarto extension interfering with Tinymist
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.
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.
Sounds like some order should be determined for better experience.
While it is stepless, it prioritizes shorter steps.
That's usually called fuzzy search btw
it depends on your editor. I only provide a list of expanded symbols.
will it annoy somebody who doesn't care such "bugs"? All the following f function always return none and don't affect outer context.
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
I consider making some linter configuration before enabling it by default.
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.
There is this Touying exporter by @iron dust , which works well and exports the same in html.
I did some config-pages though
Like changing margins and stuff
I am total noob, lol
that is not the same way. touying exporter embeds svg images into html files while exporting html means to use the experimental html feature.
Oh, I'll see what can be done about the error and if it bothers me much, I'll ask again
I was fine with the pdf but this presentations have some gifs into it, which pdf doesn't support so have to use html
why not using the touying exporter when finishing the writing?
I am using it for now but I saw that Tinymist has it by default so thought would be nice to just use Tinymist
isnt touying-exporter stuck at typst 0.12 currently?
yea
though probably just need to change the typst-py version in pyproject.toml
im not using touying tbh. my slide documents still stick to polylux 😂
just need to merge this ig
same lol
but the exporter works with polylux too
didn't know it.
yea i tried it and it worked. since its just svgs crammed into impress.js, the package used doesnt really matter
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.
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.
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").
Yea, and I have no idea how the mentioned Cortex XDR works and if there even is a possibility to globally whitelist it.
Then I finally view the lint as a "task", like exporting a pdf, and you can determine that whether run lint checks upon Save or Type. Then I set the default lint setting to lint on save, which wouldn't aggressively use your CPU resource per entering a character.
@vale axle do you have knowledge about cargo? If so, you could simply rebase my branch to typst/typst:main and change these patch https://github.com/Myriad-Dreamin/tinymist/blob/258cf85601fd111833316d9756bf094fba2f798c/Cargo.toml#L266-L274
Somebody requested to make new release in nightly channel, but the maintainer of the nightly channel is busy now. https://github.com/Myriad-Dreamin/tinymist/issues/1677
Ah, I already did that (although I'm changing to my own branch of typst). It seems to be not compiling for lots of reasons, although I'm not at my pc right now
Although, after this, I'm then supposed to build the vsix in contrib / .... / vs-code and it will use that tinymist.exe automatically?
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.
Yes. It doesn't seem fundamentally impossible and I may have time in the coming weeks although unfortunately I have lots of work to do
I think you don't have to build it locally, you could only setup cargo to check compile errors. When you start a PR, the GitHub will build artifacts for you, which is the simplest way.
Yes. Although maybe it would be easier for me to build locally.
Thanks for the help btw
Clicking the checkmark on the PRs, and drag down to the summary page, and you will see them, .
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.
I'm curious about topiary
It can use tree sitter grammar for formatting
sounds like a promising (to be complete) but heavy solution. Is it ever used by someone?
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/
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
since typstyle has reached full maturity, and is being deligently maintained, why not stick with typstyle? even make it the default option?
Not really. There is always time squandered away for little benefit. Plus, once you make something an option, it is very hard to take that away.
it is set as default recently
it is hard to get rid of feature s that many people rely on, but I think it is feasible to deprecate and remove things in years, like typstfmt. adding a lightweight formatter doesn't cost anything so i'm willing to add two to three well maintained ones if there is any, since people really have different preference on code style.
Sounds great to me.
It is amazing how mature tinymist + others have become so fast...
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!
what's the structure of your project? Where is the preamble file?
root/class/premable.typ
root/homework/.../hw1.typ
- root/class/preamble.typ
- root/homework/x/hw1.typ
How do you import thepreamble.typinhw1.typ? If the root is set toroot/, it should be either or:
// in /homework/x/hw1.typ
#import "/class/preamble.typ" // or
#import "../../class/preamble.typ"
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
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.
hmm, ok; ill keep trying.
thank you for the help!
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)
I'm not sure whether it is a tinymist issue or a misconfiguration in emacs. The emacs users could help it: https://github.com/Myriad-Dreamin/tinymist/issues/1685
@oak quest the link to "harper" on the github page is broken
ic
happy to report all works well on helix!
is there a way to live preview in a pdf viewer (sioyek) instead of the browser? ( i use helix as my editor )
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)
Lol
Sioyek seems a little unstable at times
I get random crashes with it even without export on type
thats sad, i was kinda liking sioyek
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
Have you tried tinymist.pinMain command?
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.
doesn't work in helix (it takes an argument which helix doen't provide)
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",
},
},
you're spoiled with neovim 🙂 helix doesn't let me specify an argument, it's the nightmare for @oak quest
I'm sorry that I use a superior editor. 😎 ||just more mature||
I guess that's one point in favor of the clunky mess that is neovim 🙂
Vimscript ≠ Lua. But the internals: maybe...
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
OK I'll test it when it's ready!
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)
exactly. tools (not limited to the language server) write compilation commands into lock files and the language server picks the commands to compile the docs accordingly. this works pretty like clangd understand c header files.
does this PR solve the helix argument issue? https://github.com/helix-editor/helix/pull/12527
from what i understand, it does
youd have to build from source though
oh sweet it does indeed
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}"'
nice
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?
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
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
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!
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)
It wasn't really related to that though was it, it was about doc comment syntax supported by tinymist
Hi.
How I can format my files within helix?
[language-server.tinymist]
command = "tinymist"
[[language]]
name = "typst"
language-servers = ["tinymist"]
formatter = { command = "typstyle" }
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)
Thanks!
I noticed that #1.1.to-bytes() is not completed. Can float.to-bytes.size be completed with 4/8?
it is on todo list (but low prio because this is not a bug)
not a critical bug
Next release will integrate lightweight conversion to LaTeX/DocX/Text features based on typst-html (HTML export). I think reliable conversion can improve experience on submitting papers (and encourage people to write papers in typst).
- Reimplemented typlite by html export by @high cypress and @Myriad-Dreamin in https://github.com/Myriad-Dreamin/tinymist/pull/1684, https://github.com/Myriad-Dreamin/tinymist/pull/1720, https://github.com/Myriad-Dreamin/tinymist/pull/1728, https://github.com/Myriad-Dreamin/tinymist/pull/1729, https://github.com/Myriad-Dreamin/tinymist/pull/1754, https://github.com/Myriad-Dreamin/tinymist/pull/1758, https://github.com/Myriad-Dreamin/tinymist/pull/1759, https://github.com/Myriad-Dreamin/tinymist/pull/1762, https://github.com/Myriad-Dreamin/tinymist/pull/1779, https://github.com/Myriad-Dreamin/tinymist/pull/1767, https://github.com/Myriad-Dreamin/tinymist/pull/1771, and https://github.com/Myriad-Dreamin/tinymist/pull/1772
- Supporting LaTeX export in https://github.com/Myriad-Dreamin/tinymist/pull/1718
- Supporting Docx export in https://github.com/Myriad-Dreamin/tinymist/pull/1727
- Supporting Text output support by @high cypress in https://github.com/Myriad-Dreamin/tinymist/pull/1731
Casually dropping latex export
Sorry for the hustle..
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.
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
..argswhile tinymist wants this parameter to be namedargsin the list. Worse, tidy trips an assertion if you name this parameterargs(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
for the first one, args may be better than ..args, to make less surprise while learning syntax.
For the second one, this can be a bug, because tinymist processes docs from packages by the one used for processing docs from official typst. I could fix it quickly. this has two considerations:
- people can apply this convention easily by show rules.
- if I remove it, there will be again reduce a point to learn for docstrings.
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.
I'll be happy if you "complain" about that, and you are the second one complaining about it since the last year (zero till last month, and two since this month lol). I only kept it almost follow tidy syntax as I look on tidy docs again and again.
may be there should be a formal syntax to help achieve flawless consensus.
What Tinymist setting disables inline argument name previews? I find them a bit annoying.
I think it's only editor-specific setting.
Ah. They're called "inlay hints" and are a global VSCode setting
I think it is disabled by default.
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
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.
I assume Typlite is https://github.com/igumnoff/shiva, but not as versatile? I thought that it would be better to integrate that if possible.
totally not the same. shiva parses other markup and converts the markup into typst source code and generates pdf by typst.
What? I thought it converts between formats.
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
try cargo +stable install --git https://github.com/Myriad-Dreamin/tinymist.git typlite instead
semver violation? --locked maybe?
well according to the log at https://github.com/Myriad-Dreamin/tinymist/actions/runs/15527495046/job/43709795010, 0.13.14-rc2 does indeed fail to compile 🤣
(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?
builds 🙂
should build in next release (rc3)
if it's ok I'll report the first bug I found in .typ -> md conversion 🙂
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).
I get the feeling tinymist doesn't currently offer that at all. the lsp is primarily designed for vscode, so any vim exclusives probably aren't (yet) implemented
although toc I feel should be doable one sec
You can quote yourself with > followed by the quote.
Thanks, I’ll try to remember for next time.
you can also forward messages now
for quite a while actually
all features are new features until they aren't
That’s fair, but then I really don’t get how people can write that Typst is easier to setup in nvim than LaTeX then (I know this one wasn’t from you) or that “should be as easy as tinymist LSP + some sort of preview plugin”.
I want to be your friend.. We can talk about discord features!
because I don't use those features when writing latex :P
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",
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
in neovim I use chomosuke/typst-preview.nvim for preview
I’m sure nvim+typst can be glorious, I simply don’t have the right config yet.
I don't use references or citations myself :P
I'm not writing papers, just doing maths/logic
And you never refer to a previous lemma or equation?
uncommon enough that i do it manually i think?
don't really remember, tinymist may have autocompleted it
also I've done next to no typst specific configuration of the LSP, the generic config seems to work well
i use my own typst-concealer plugin, which is not suitable for most workflows
This is disturbing.
magic. Can it do tables?
i try my best
My computer doesn’t like your config 😢
it can do anything 👍
haha yeah its freaky and nixxy
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)”
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
This is from simply putting you nvim folder on my machine and telling nvim to use it.
yeah that won't work
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?
I’m on v0.11.0 so it probably doesn’t make a big difference.
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).
Do you also have stuff in your lsp-config or mason config? Or does this plugin handles everything? It’s not super clear in the README.
look it can even show LaTeX properly :p
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!
nah, it just does the preview, yes I have lspconfig and mason
I mean I just had an existing lsp configuration for neovim when I started using tinymist so nothing really needed configuring except preview
Is your neovim config publicly available?
nope, sorry
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.
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.
syntax highlighting also getting weird implies treesitter is broken no?
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.
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!
not primarily designed for vscode because I try to abstract things into layers. and docment outline info can be also subscribed by nvim. there is somebody who would like to implement these things but they as a programming language developer was also keeping busy finding their job and has disappeared for half a year.
Last time I wrote in that language, it probably was on the same level or worse than Typst. So it's all subjective.
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.
it is probably more or less because you have many settings different from the usual ones like you say "because of something."
What are "usual ones" supposed to be?
for example I remember you say the order of completion items are not perfect, but that is because neovim client rearranges it by itself.
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().
I use the same LSP client and its settings for all LSs.
So why should it rearrange the items?
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.
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.
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
Is this copilot?
this is lsp
So you just placed cursor to the left of above:?
or is this how your completion behaves?
the transparent text is "inline completion" (or you can imagine it is previewing completion)
hm, ok
@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.
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.
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.
You would basically run nix run or something like this.
I didn't say anything about NixOS.
The same reason for looking into neovim settings. This is slightly better because I have neovim installed in my PC.
Especially since you don't need a window server, unlike for Firefox, VSCodium, etc., it should just work on any UNIX-like OS.
I don't have nix env either. I just googled it and find nix can be run in some container.
You can install Nix with basically one prompt on any OS.
I thought it is an os
what specific thing should I look into?
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.
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.
https://nixos.wiki/wiki/flakes:
Other Distros, without Home-Manager
Add the following to~/.config/nix/nix.confor/etc/nix/nix.conf:experimental-features = nix-command flakes
If you're using kickstart - I have something similar, then gO (LSP document symbols) is almost a ToC
is there still interest on doing work to get tinymist to work with latest version of typst / has such stuff been done yet?
there is a nightly release channe but the related maintainer is preparing the final exams.
i have no idea how to set invert-colors=never in the helix language config. did anyone manage to set it?
how is it set in the vscode json config? It should be the same thing, just as toml, really.
how do you start the preview?
using the lsp
ill check it!
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"]
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
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.
This has been converted nicely in official neovim:
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 :(
Sorry I missed your useful message. Indeed the LSP document symbols list seems to have everything I care about. Section appear as namespace and labels appear as constant. Maybe the result of the same LSP request could be post-processed into a ToC. Is this what people do in VSCode? How people do get a ToC when editing their Typst documents in general?
In vscode it is passed via command arguments. The related code exists since typst-preview era. I think we could reimplement it at the server side to bring consistency to all editors.
In VS Code, there are two outlines. One is from view of the programming language, that you see in neovim at the moment: the syntax document outline, and ther other is from view of the markup language, the rendered "PDF" document outline.
I am not sure that is valid toml syntax
Cause I managed to make it work at least for the default preview
i got it (finally)
adding it to the docs would be helfpul :)
Do it 😂 👏 👏
ye ill make a pr
Epic.
Is the second available through a LSP call?
No, it is only valid through LSP notifications (the server will streaming push outline changes to the editor). If we would like to support document outline for all editors, might add a new UI page in preview panel.
I started next big PR to solve the currently opening bug reports forever, https://github.com/Myriad-Dreamin/tinymist/issues?q=is%3Aissue state%3Aopen label%3Abug.
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?
I think I know now, with a custom rule for grids to make html tables.
I haven't understood your case but love to hear that you solved it.
I'm reporting a bug I found that's not directly about grids. You'll see it in a minute
the issue is https://github.com/Myriad-Dreamin/tinymist/issues/1844 and it's about m1verbatim which couldn't be used inside a html.elem for some reason. The use case is typlite .typ → .md
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
`
)
it looks like a bug if you put markdown syntax verbatim inside <grid/>
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?
you can't do that.
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
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 😂
I have a challenge for you: I want to create the following markdown document from typst: https://gist.githubusercontent.com/bluss/b06cb65a93a741555670868b104c892c/raw/986a1d108b6d361ce9e6ead5838198c3fd15505f/mdexample.md
As you can see it has a fenced code block inside HTML elements. Why? Because this is what works 🙂 As you can see it renders ok. https://gist.github.com/bluss/b06cb65a93a741555670868b104c892c#file-mdexample-md
there is a saying, when it rains, it pours.
maybe we should keep m1verbatim as is regardless where it is put in a typst document, which is exactly how it is named.
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
yeah it is good to write typst docs once and show it on github with rendered md, no more duplication by hand.
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
it is another question that whether we should render and commit example refs. not yet find a perfect solution.
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.
This can be done using insane hackery and the current verbatim... 😁 Just replace html.elem with custom versions that insert verbatim html tags..
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
Because without any custom style, typlite drops the raw block before the grid https://gist.github.com/bluss/1843bcfc05318aa51b6ec7b9e375ff9c
similar for any block level element I think
this is a bug.
ok, I can report it
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)
see #1260973804637786224 message
yep that but built-in
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)
not automatically, but it already makes big progress to allow lsp calls with arguments.
maybe the docs can be updated once the feature has become steady.
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.
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
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.
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
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)
I don't think creating documents that are compilable only in Tinymist is a good idea
can i not use the tinymist cli to replicate the behavior?
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.
Exporting Documents.pseudo-image svg {
width: 100%
}You can export your documents to various formats using the export feature.#Export from Query Result#Hello World Example (VSCode Tasks)You can export the result of a query as text using the export command.Given a code:1#println("Hello World!")2#println("Hello World! Again...&quo...
I think they will be compiled if you upload the artifacts to webapp. in fact indeed arguable because you won't be able to preview to get final document in webapp.
hm this seems kinda convoluted, but ig it would be more powerful?
how?
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
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.
does not seem like you can contribute to runOn, from an extension
wdym watch query?
That should be valid, but query.pipeTo may be a potential security risk, because tinymist may run on untrusted workspace, we need be care about such cases.
So I said this have to be loaded to the server because extension cannot do that.
isnt any task a security risk?
Instead watch your document and run the query tasks, you can run the query tasks manually.
I don't see only export PNG introducing a security risk.
I’d assume that running any task requires you to trust the workspace for vscode
but currently running any typst tasks doesn't require you to trust the workspace. It's all safe.
huh
extension can run a task, it just can't add a new runOn option, no?
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"
}
}
]
}
Tinymist works so well in VS code, its really a pleasure to use it. Thanks for your work on this!
i built the first neovim integration tests. ideally every issue will be made a corresponding regression test.
You still don't plan to support the extension so that it works remotely, right? 🥹
"remotely" may refer to work with "ssh-fs" (fore living share) or "vscode-remote". I'm using tinymist with vscode-remote with a remote linux machine. as for working with ssh-fs, it is doable but I should pay more effort to make tinymist more stable.
Oh, OK! I see! I was just referring to VSCode Remote Server. Thank you very much!
Has anyone gotten the background preview to work in Zed lately? It doesn't seem to work for me at all anymore
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.
if you type #import "@local/ then I already get a list of packages as autocompletion. do you mean something different?
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 ..."
👀 😁
goto the template gallery and favorite a template, and you will see it
I admit I don't know why I did that
but pour down hundreds of templates for completing here is also not good.
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 !
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.
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 !
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
layout did not converge is a warning, so if they both produce the same warning they should both make some kind of document output..
you can get a hacker function from the issue
Oh cool, thank you!
Right, don’t know why I just defaulted mentally to it being an error
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 😺
I expect debugger will be much more useful in the case. I cooked an experimental debugger and see typst stops on a same function in layout iterations.
only having PDF output after each iteration might not be very useful.
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
For example to log state values in different iterations
Sounds like a good idea.
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) 🙂
anyway, this is probably different. The most obvious thing that can happen is if something moves or if something is added to the document as a feedback to a query or state change - and then that again has a feedback effect on the query
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.
}
that's nice
layout-itd:0.2.0 😁
it could maybe be an lsp command? region -> sampled values per iteration? (I don't know what's possible)
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.
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
if it's impossible to implement then maybe compiler help or lsp help is needed
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.
?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]
}
Nice, layout-limiter confirms that the iteration count is actually correct as written in that code
convenient doesn't matter when we are exploring if it's at all possible
first invent then make convenient 🙂
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..
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"
})
nice, reading toml is a great trick for .typ files
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>]
May be I can generate this file using typst
https://github.com/Myriad-Dreamin/tinymist/blob/main/editors/neovim/Configuration.md
As well as fix the outdated page: https://myriad-dreamin.github.io/tinymist/configurations.html
luckily all of the package.json and Cargo.toml files can be read by typst
hi, all, how to check the version of Typst used bu tinymist?
?r either check the log to get the repository url at the time of built the tinymist. or use this:
#sys.version
Can we use our own compiled Typst binary?
tinymist bundles its own Typst, but if you compiled Typst yourself you could also try to compile Tinymist yourself with the same patches applied. I'm not knowledgeable how to do this though.
- cherry picking the three commits from https://github.com/Myriad-Dreamin/typst/commits/tinymist/v0.13.10/ .
- Change the patch to your typst fork,
https://github.com/Myriad-Dreamin/tinymist/blob/1478280a0749a8fdd22126c8e8681f99ad0ce5dd/Cargo.toml#L275 - and trigger a github action, you don't have to build a tinymist binary locally.
A sample PR if you would like to use a nightly typst: https://github.com/Myriad-Dreamin/tinymist/pull/1279/files
The file should contain all information about getting a "released tinymist binary". https://github.com/Myriad-Dreamin/tinymist/blob/main/docs/release-instruction.md
I wrote it in case of one day I'm suddenly away from keyboard.
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?
might be a regression, but I cannot judge it without a concrete case. preview jump is only served in best effort.
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
I think the information is there, not as a separate diagnostic, but as 'relatedInformation'. So the following nvim bug applies (maybe, I don't have much knowledge): https://github.com/neovim/neovim/issues/19649
uh maybe this means that neovim is advertising that it supports relatedInformation but doesn't? https://github.com/neovim/neovim/pull/34454 Not sure I understand. I wonder if I can configure those capabilities
The listed workarounds didn't work well.. but I managed to fix it in my nvim config... RIP my sanity, that was tough 🪦
🥹
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.
today i'll prepare for tinymist v0.13.16
editors/neovim could have diag_spec.lua to confirm the possible bug and prevent regression.
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 😏
@flint pollen the main contributor of typlite is busy, so we cannot fix the typlite bug in this release.
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:
....
that looks cool, will experiment with that
no rush, don't worry. Do you mean the block elements thing? That seems like a bigger thing or feature request anyway
Yes. The current lib assumes that no markdown content can be nested in html tags, which is a bit wrong. He need time to change it.
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?
the figure is only a hint for auto-completing the reference.
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/")
using ref syntax is good though. I kind of like the "original" _term list_<tl> too
what do you think about the relatedInformation issue? do you think a new separate diagnostic can be added for the help/info part?
I think the correct direction is to show "..." on the hinted code like rust-analyzer.
while tinymist doesn't show dots in the same way.
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 🙂 )
I didn't craft an example that the hinted code are in another crate, but I think you can imagine it.
ok testing vscode was fast to set up. I think the same problem is present there as well?
yes.
and rust-analyzer in fact is placing dots on the hinted code, while tinymist doesn't do it in the same way.
ok. sorry for writing too much about this, just want to clear up miscommunication if any
There is surely some code and behavior we can copy for the r-a
rust is not a dynamic language, so I had trouble really finding an equivalent situation in Rust
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"
hm. what does dots mean more specifically?
aha. So that's not a diagnostic? I wonder what the corresponding thing is in neovim
yeah, might still be a "relateinformation". but the dots might be too inconspicuous to attract you before.
I think the hint here is a separate diagnostic
nvim doesn't support relatedInformation I think
This document describes the 3.17.x version of the language server protocol. An implementation for node of the 3.17.x version of the protocol can be found here.
Neovim - until development version 3 weeks ago - says that it supports relatedInformation but in reality it doesn't
but I found this
well neovim reported it wrong
The neovim-0.9.4.json (obtained from my lazyvim client) said it needed "relatedInformation"
it was wrong
ok
also I don't want to be too annoying but in this comment: https://github.com/Myriad-Dreamin/tinymist/issues/1870#issuecomment-3035415536 I argue that even with future neovim (which looks like it will maybe support relatedInformation, in neovim 0.12), using relatedInformation will still not solve the issue
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
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]
}
nice
I haven't go in depth, and I might be wrong.
I'm suspecting it's necessary to split the diagnostic, also so that invalidation/refresh of it works correctly.
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 😄
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
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.
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.
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
A VS Code or VS Codium extension for Typst. You can find the extension on:
Night versions available at GitHub Actions. Stable versions available at Visual Studio Marketplace. Stable versions available at Open VSX.
Features See Tinymist Features for a list of features.
Usage Tips Initializing with a Template To initialize a Typst project: U...
A-ha, thanks, okay.
Thanks.
Is it possible to make it stateful/static by writing in .idea for the workspace or somewhere, by the way?
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?
There isn't, I guess. You can also see the panic message in the problems view below
oh i basically never use the problems view
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?
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
I reported an issue about a similar problem. https://github.com/Myriad-Dreamin/tinymist/issues/1870 the issue seems a bit specific, that was about what I knew at the time. But I would also prefer to solve the general user interface problem rather than any specific technical issue mentioned in the title or the issue. See a little discussion up in the channel, not long ago
and this feature will help in parallel, it's another place the error will be detailed: https://github.com/Myriad-Dreamin/tinymist/pull/1860 🙂
copilot will undoubtedly be the second active contributor of tinymist. 😅 https://github.com/Myriad-Dreamin/tinymist/pull/1892
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.
At least it was a thing
He doesn't have the FOSS spirit, no money — no workey.
i misinterpreted the title thinking it would render placeholder content for errors, which would be pretty neat
ie:
#table(
columns: 2,
[A], [B],
[#panic("error!")], [C]
)
would still create a document, just with a placeholder in place of the panicky content
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
That's hilarious.
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.
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?
Thanks! I should read the docs next time 😅
this code looks very interesting lol
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
ah i suppose i could use two different files
Hi, is there a way to activate scroll synchronization between the editor and the preview (like in the Web App)?
Flashback to all the news where a help chat bot for some companies starts hallucinating and then they get a backlash.
If you don't trust llm, you can verify the "search result" by checking the spec markdown file.
yeah, here it's not critical
Better than deleting prod database lol
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
hahahaha, thanks!
I even checked https://marketplace.visualstudio.com/items?itemName=myriad-dreamin.tinymist before asking but bot knows more
😂😂
You could report the concrete bug if it didn't work. I only see few people use sublime text with typst, and they didn't use the browser preview feature.
the readme doesn't contain everything. I would like to only keep necessary tips in the readme that needed by people newly coming to typst.
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?
I also use chatgpt when I have some hard tasks. I use deepseek for easy tasks because it is a free and smart chatbot.
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
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.
Ah also, I'm working on adding Typst support to Nova using tinymist for anyone else who uses nova
https://tangled.sh/@adrianlorenzana.ca/Nova-Typst The repository for it is here, and the extension can be installed now in Nova
An extension that adds Typst support to Nova
Next step is integrating tinymist settings into the extension xd
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
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.
where would i check to see this?
i notice that it does write to the pdf when i cmd + hover over any function or import file
nvm, I think I have fixed it.
Can I ask how tinymist receives settings? Like say when writing settings to languages.toml for Helix, how does tinymist receive those settings?
could you check https://nightly.link/Myriad-Dreamin/tinymist/workflows/ci/main/tinymist-linux-x64.zip ?
This is built by https://github.com/Myriad-Dreamin/tinymist/actions/runs/16607127510#artifacts
It receives language settings by the standard lsp. When handling the initialization request and workspace/didChangeConfiguration notifcations, it gets the configurations from the editor. The related code is in config.rs (search it on GitHub)
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().
We complete function calls with two variants:
#fn|expands to#fn(|). If thefnis 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.
Thank you for your response!
I have figured the remaining steps to run tinymist in browser. https://github.com/Myriad-Dreamin/tinymist/pull/1944
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/repomaps to the github repository (or other git source) that could be fetch from networkbranch-or-revmeans we can check documentation at any revision.path/to/packageis the path to the package. For most packages, this is empty.
Yes, it would be a dream come true, as it will be akin to this experiment: Rust Analyzer in the browser, https://ra-wasm.netlify.app/
which one will be faster to be production ready?🐱
Well, ra-wasm has been abandoned for years, and the repository has been archived officially this year (in May), so...
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!
I recently learnt that there is an issue on miri https://github.com/rust-lang/miri/issues/722
at least there is a working rustc.wasm.
I still would like to avoid complete with webapp. but I think now the situation is better (if I make tinymist work in browser) when I heard webapp was having many active users.
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
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.
do you mean document outline or syntax symbol outline? they are both available in current tinymist
I get this when exploring the touying package.
It kinda works but not much. tbh I haven't used this feature and the code is from the typst-lsp
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.
I don't think tinymist competes with webapp either way, they serve sep use cases.
Web app is all about collaboration and sharing of docs.
Having tinymist working on web is a big thing for the Typst language, it reduces the friction to get started
It would also be useful for sharing code snippets and embedding runnable examples
sorry, i'm unable to check this at the moment
when is the next release planned?
every weekend
@oak quest what do you think about the possibility of having numbering appear as inlay hints?
Like in headings and lists and such
?r Should be good but hard to analyze it. Example:
#enum.item[1]
+ 2
+ 3
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.
Yeah probably not easy, but I think inlay hints could be useful in a lot of situations
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..
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?
I see the same thing.
Which same thing? Do you see the stroke?
I can reproduce it, but I might not fix it quickly. My next focus is to fix some old bugs, especially the tinymist.lock bugs that could enhance QoL of neovim users significantly (from the feedback I collected).
Oh I 100% vote for neovim fixes!
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)
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!
I reproduced your issue
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.
When I work on other projects now (not typst) I miss the sampled values on hover.
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).
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?
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.
Some special languages may also implement it (nix might be one).
Iirc, Google sheets does too. Seems natural, as spreadsheets are basically data flow languages without side effects. Very useful indeed, I find myself missing it greatly in Python...
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)
I would be very happy to install a language specific plugin. I already have typst-preview.nvim
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)
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.
aha
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)
please check the errors in the configuration. there should be one that was not detected previously
How do I do that?
I've opened a PR for this. https://github.com/Myriad-Dreamin/tinymist/pull/1987
Thank you. Changing invertColors fixed it
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
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
Ok. That makes sense then.
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
Same here.
I have been looking for a Typst-specific nvim plugin, better with a lot of predefined text objects.
For example, VimTeX provides useful text objects for LaTeX based on syntax analysis, which I found very useful.
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?)
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.
thanks for sharing! I've never touched treesitter configuration at all, I just use standard configs. Will try this out
You will also need https://github.com/nvim-treesitter/nvim-treesitter-textobjects
that one I have
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 $.
Does neovim not come with delimiter matching?
Ah wait I remember this feature in helix was inspired by easy motion I believe
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
Ah but it won't do that for any delimiters defined for a language then?
Just a default set?
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)
seems like it.
There are probably plugins that extend this default set. But treesitter is already around, so it’s easy to use it.
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
what's a delimiter in that sense? So it starts from #let ... and captures until the final } ?
They're configured in the languages config and are used for this and stuff like auto closing
this one is the only thing that's working for me 😆 How do you usually debug this, I can't seem to use the typst_function thing at all. How does the af work for you (since it doesn't use typst_function)?
So for math it would be the dollar signs
Maybe I broke something, let me check it still works.
oh and that means that when I said that's the only thing that works above, that's because it's a default thing
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.
ok, so the af text object does not select anything in typst for you either
that's basically one of my questions
Do you see the tree with InspecTree?
yes
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.
nice
ok, I have no way to debug what's going on so I'll have to slowly read more about this
seems like problem persists in 0.13.18
[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)
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
I’m back.