#Tinymist
1 messages · Page 2 of 1
Does tinymist ship with embedded fonts? I get unknown font family: new computer modern mono when previewing my document
i was under the impression that typst ships with new computer modern?
I believe it only ships with NewCM Maths since 0.12
I see, didn't realize!
yeah looks like no mono variant (?) indeed
maybe typst never shipped with it, 0.12 includes a new warning if it cant find the font so maybe i'm just seeing that..
No mono variant.
The only reason there is a warning for missing font is because we switched from Linux Libertine typeface to Libertinus.
Probably. I don't think Typst ever shipped with NewCM Mono
At least if we are talking about the same warning.
Thanks everyone, I got it from https://ctan.org/pkg/newcomputermodern and now it looks all good
Funny how it might have been broken for ages and I've just never realized!
You can always try to compile with an older version and without the newly installed font and see what it says.
The syntax of parameter docs is based on tidy. Parsing the docs is fully implemented. In a parameter doc, you need to fill a type. Filling a built-in types, such as str or string or any, is fully implemented. Filling with complex types, like function signature, is neither sufficiently discussed nor fully implemented.
In conclusion, the syntax plus annotating parameters and resultant of a function with built-in types is what tidy and the guideline supported and detailed and fully supported by tinymist 0.12. But how we can annotate them with some more complex types is still in draft state.
The docstring support is not first implemented by tinymist but tidy. tinymist just continues working on utilizing type information inside for language support.
Tidy parses doc comments in Typst, right? Does that mean you reimplemented the parsing for tinymist? Could tidy in theory share that parser via a plugin?
It could've already before in theory, the parsing of tidy is unfortunately very flaky when it comes to non standard comment placement (on parameters)
I previously suggested the parsing be done within typst-syntax, but I think mczen did not have time for it yet
I tried adding built-in types, and it worked, but when I added a deconstructed dictionary...
If I used the _ as the pos parameter name, then it would kill the function parameter docs and I had to restart the server after undoing changes.
Oh, so based it purely in syntax? I thought it's a Rust project.
I already forgot about the package.
looks no crash
Filling with complex types, like function signature, is neither sufficiently discussed nor fully implemented.
I tbh haven't come up with a good syntax for these complex types. First, tidy package dislikes to see them in braces, because tidy parses types by a simple regex([\w\d\-_ ,]+). Second, typst itself also doesn't have syntax of type annotations on functions. So I have to implement a type annotation parser for them, instead of reusingtypst-syntax. For example, I cannot put any annotation on the positional argumentposin(pos) => {}, or spread argumentargsin(..args) => {}.
There are sometimes XML comments in the docs.
Here, there is no description for the pos arg:
Adding a blank line in the doc string removes the XML comments:
Here is what I was talking about:
I renamed the arg name in the doc string to match the one that is shown on hover — _. But this doesn't change anything unless I restart the server. After the restart it will show docs from the screenshot.
So all of the other's args description is now gone. Undoing the pos arg's name in the doc string again doesn't change anything, unless you restart the server.
That's all what I have found for now.
I think adding some description/limitations of this feature somewhere in the repo would be helpful. Because a few small test files is kinda not enough. And as you can see, I had some problems that are not outlined in those test files.
There was also an auto-indent on Enter press in math mode, which doesn't work for me:
onEnter is an experimental feature, so you need to call it by your self at the client side (neovim plugin).
I'm not sure if it's also configurable via LSP, but I'd prefer server to do:
- After starting a list/enum/term item and pressing Enter, the caret should go to the next line and auto-create the next item (insert
-/+//+ space). - For nested lists, it should maintain the currently nested indent when pressing Enter.
Experimental feature in LSP protocol?
You cannot add documents to a wildcard node (which isn't a variable)
yes.
I'm not sure if it's possible, so I might just wait when it will be stable.
I'm not sure, but maybe such stuff is configurable through Neovim directly. I might try looking into it at some point.
No, I guess Neovim does support this feature: https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#on-enter.
Why doesn't the documentation get rendered in neovim? Is it common in neovim?
Which documentation? The named parameters are rendered correctly.
I suspect neovim also doesn't like the embedded images in docs, because they are encoded as data url.
I mean the documentation (hover docs) in the screenshot is just highlighted but not rendered, so we can see comments in the screenshot.
Yeah, here is nvim --clean and indented text. After pressing Enter, it auto-indents the second line by 4 spaces.
The readme lists the features supported by rust analyzer server, but still requires a client-side support. From the issue rustaceanvim#12, neither neovim nor the plugin for rust calls the lsp command experimental/onEnter.
The docstrings aren't correctly cached. I also found this bug.
Some basic stuff like code blocks and headings are "rendered" fine, but there is something strange going on with the list items.
I tried the rust-analyzer feature and it works.
Comment line splitting/merging does work in most languages, but I have no idea if it's a client-side feature or an LSP feature. Maybe it differs.
This may be supported by neovim itself. I remember neovim has some builtin support to c-like comments.
If rust-analyzer doesn't call the experimental feature, then it's a Neovim setting.
In other word, the rust-analyzer isn't called for comment line splitting/merging
Does somebody get interested in making a tinymist neovim plugin? As time going, there will be more and more typst-specific features which cannot work without client-side support.
Looks like indentation is broken because it's enabled in the treesitter plugin. Adding:
indent = { enable = false }
fixes it. Now autoindent works as I expect (at list for Typst (nested) lists).
I'm interested, but I'm not available at the moment.
this is a builtin neovim feature
this is because the lsp shouldn't return such things
according to the spec (and that's what neovim works with) you can just return plaintext or markdown
more or less
there are some special cases but xml isn't one of them
I already am working on typst-tools.nvim
which would likely include these things
atm it just sets up lsp with tinymist, has some utils like context, ToC, jumping from heading to heading and a lot of snippets
also planning to add preview with tinymist preview to it
my time is quite limited at the moment though because of uni and also working on care.nvim (a new completion engine for neovim)
Yeah, that would make sense. Neovim doesn't normally need any hackable syntax to render stuff natively. It uses the built-in treesitter for coloring and stuff.
There is a preview plugin, AFAIK.
is cmp-nvim too limited?
html elements can be in markdown. I know most clients don't support to rendering HTML elements, but they should delete them before showing.
But the problem is not whether it renders html. The docs in screenshots are just syntax highlighted code, and don't get rendered at all.
Yeah, Markdown does support HTML, but it's not recommended or something like that. I haven't checked that.
Yes, in the TUI world there is no graphical rendering. But with graphical protocols you can render images in some modern terminal emulators, like kitty.
I think there are some plugins that want or already making Markdown rendering of images in Neovim possible. So that it's even more native-like.
So neovim even doesn't process comments.
This sounds a bit lazy.
It processes them, though it doesn't look like there is syntax highlighting for them, but there is no rendering, so they are kept. Because it's and editor and you need to have access to the comments in the file editor. Pasting the raw Markdown text with comments into a floating window like hover docs doesn't make it special, so it's just yet another buffer with text, but it's not modifiable, therefore you can only select/copy text, but not edit it.
So the "rendering", i.e., "removing of comments" for markdown is up to the producer of the Markdown text, i.e., the LSP server.
I find a capability flag to check whether client supports HTML tag. I might check whether I can use it for docstrings rendering.
At least this is my understanding. Neovim can have some features that I'm not aware of.
But this means I need to introduce some markdown parser to process them 🥺, another heavy dependency.
yes
depends on the md flavor
how should it process comments?
remove them, I guess.
The more important question would be why they are there in the first place?
lsp claims the used specification is GitHub Flavored Markdown Specification.
so you e.g. have
/// #name
/// idk
/// *more markdown*
#my function
?
you definitely have to pass the thing without the /// then
to identify parameter docs. The typst to markdown converter marks some special markdown markups for latter processing
Later processing by whom and after which point in time?
This newest update doesn't seem to work for me
will investigate a bit - but at the moment all I know is it crashes immediately
[Error - 5:23:37 PM] Server initialization failed.
Message: failed to parse typstExtraArgs: error: unexpected argument '--font-path ./fonts' found
tip: a similar argument exists: '--font-path'
Do you have a settings file maybe?
This should never work on any version. I guess you pass the argument list as a single string:
{
"tinymist.typstExtraArgs": ["--font-path ./fonts"],
}
Instead, you should pass an array:
{
"tinymist.typstExtraArgs": ["--font-path", "./fonts"],
}
Oh yeah, that would explain the single quotes. I didn't even notice those until now.
There is some degree of rendering, but it is just the conceal feature:
:h conceallevel
I don't remember why I removed https://github.com/MrPicklePinosaur/typst-conceal.vim, but I think now it definitely doesn't work with 0.10.0. No updates.
It seems like there is a bug with tinymist
I can do set math.mat(align:right) which works fine and which typst can also compile
but tinymist gives an error and won‘t compile and also show no preview
What error?
Are you using the same version of the typst compiler?
oh my tinymist was outdated
i figured it out
if there is an import it does work(?)
idk, will try to troubleshoot after class
and double checked – i did not redefine lt inside my ../config.typ file
this is related to this discussion
idk why I failed to reply properly at first try
well I forgot because I tried to update both typst and tinymist but tinymist couldn‘t be updated because the new release wasn‘t on homebrew yet
I'm just adding some fun here. Dwight Gifs are all agreesive.. So I choose the funniest one.
😂
I'm just downloading the prebuild binaries from the release page, because it takes time for the mason PR to be merged and nightly releases won't be in the mason registry at all.
Typst, on the other hand, I compile to musl manually. Which isn't that long.
I have a weird behavior but I don't know if it's comming from tinymist or typst itself. I'm on nixos but I use the cargo version of both tools. I'm on v12 for both.
I have this code #propriete[ Les côtés opposés d'un parallélogramme sont parallèles. ]
That produces a box with my own flavour, it'usually working but when I preview the pdf I get this
If I use the cli typst command I get the correct result :
also sometimes tinymist complains about delimiters not closed even though they are
I use neovim btw
Here is another exemple of an unexpected behavior
do you use semantic or syntactic highlighting?
it seems that is directly related, can you reproduce this in another editor?
I haven't tried in another editor
I use treesitter for highlights
hmm that's odd because clearly tree sitter is also experiencing problems with this file
no apparent changes other than updating?
not that I remember, I started having troubles with 12rc1 and had to add extraOptions.offset_encoding = "utf-8"; to my config or I had index out of bound errors for highlights
I disabled treesitter highlights and it when I use Inspect on my file I get a message telling me that I use semantics token
but I don't get highlights for math mode in that case for exemple
To answer your previous question tinder I don't seem to have problems in vscode
I figured it could've been a incorrectly encoded file, but if it works fine in vs code then maybe neovim is doing something wrong, perhaps @harsh wing can help
thanks for your time 🙂
Is the problem with the color highlighting of the words? Have you tried disabling all plugins and then using only the ones that are for Typst?
I don't think I had this problem before. Maybe a long time ago with another language.
Which version of the Neovim?
I'm on v0.10.2
oh, wow, is this a nightly version?
no release, though i'm on nixos unstable
It might be the problem, so try using v0.10.0 for now.
The bug of neovim, affecting not only tinymist but also clangd and gopls, etc., is already fixed on neovim main. you can also apply the patch to fix the problem.
tyvm 🙂
Is there spellchecking in tinymist?
No
is there a collection of snippets for typst, to use with Neovim+LuaSnip?
Tinymist does add a few snippets, but don't know of other snippets. With Typst you don't really need any of that.
max397574/typst-tools.nvim
got some stuff there
I only have snippets for importing packages and a few small ones.
i got a ton of snippets
Why?
I'm not sure Typst is that snippetable to make a ton of snippets and use all of them.
I have a few pretty useful, like adding a cetz canvas and fletcher diagram. But that's about it.
Ah, yes, and the most useful one is:
a lot for math stuff
thanks!
will take a look
wait, isn't there default neovim spell?
if treesitter is setup correctly, it should work
I added for example over
automatically expands to overline({cursor here}) {and after pressing tab cursor is here}
yes
works fine for me
and add a modeline at the end of the file to enable it and set correct lang
add a modeline at the end of the file
what's that?
btw, when I was searching for some snippets online, a guy used this:
vim.api.nvim_eval("typst#in_math()") == 1
to check if the cursor is inside math mode or not
is there a way to do it with tinymist? or treesitter?
I just dk how
he seemed to have some deprecated typst plugin ig
oh, right
you have got that in your repo
awesome! ❤️
Since the expression checker PR, we can check lexical kind of some identifier fast and reliably. But I cannot get accustomed to the theme color of the refined semantic tokens.
In the picture, types, modules, and constants all have yellow colors in my theme.
omg
can you please share ur colorscheme and how you made that doc, if that isn't too much trouble? 🥹
looks so cool!
here's what I have :[
If we define variables, it also shows different color than the builtin (constant) ones.
Is it neovim?
yea
You should configure semantic tokens to get semantic highlighting (as shown by my screenshot)
yes. And the using theme in tokyo night.
There is a built-in spell check, but there is no built-in "you should probably use a comma here".
I have a few of these, but they are rather useless, because you can either autocomplete it or write missing 4/5 letters.
i mean:
s(
{trig = "seq", name = "Sequence" },
fmt([[({}_{})_({}={})^{}]], { i(1, "a"), i(2, "n"), rep(2), i(3, "1"), i(4, "oo") })
)
when you type:
seq<enter>
in turns into
(<cursor here>a_n)_(n=1)^oo
then you can change a to b for example and then press tab to get to the position of n:
(b_<cursor here>n)_(n=1)^oo
when you change n it changes in (n=1) as well
etc
idk, it feels much faster than typing by hand
there is a helptag
it definitely is
also stuff like matrices
there is absolutely no way you get even close to the speed of me typing this with snippets
btw, is there any way to make treesitter update on type, compared to on pressing esc/jk?
This is a completely different example that involves a lot of symbols. Yeah, I had something similar for latex, but I surprisingly don't have that for typst, I guess I never needed it.
I think it does that by default
nah
Then just search for nvim-treesitter/nvim-treesitter or something, with it I definitely have everything working as it should be.
empty file (the right window shows :InspectTree)
typed $$ without exiting insert mode
after exiting the insert mode with escape of jk
it obviously does update because e.g. highlights are applied to newly written text
ig the syntax tree just doesn't
btw, the thing I was writing here abt that lt. doesn't show autocomplete suggestions...
the issue was that one of the imported files had sys.inputs.at(value), which had no default key provided (for a reason tho: so I can quickly catch a bug if I did smth wrong)
so LSP just complained abt that and stuck
adding a default value resolved the issue
yeah, it probably always gets stuck if there is a single error, so no autocompletion or hover etc.
[related to nvim, I think]
Does anyone have an idea of what this means?
If I use a new typst file and just insert one emoji, I get an error message.
File like this:
Error:
If I turn off lsp I don't get the error
I get the same error if I'm using Japanese in typst
And, the error comes very frequently - like, every time I stop insert mode.
So you are using tinymist, right? Did you install the latest version?
I don't remember having such error.
the relevant part of the error is cut off
yeah I'm on latest tinymist and typst versions
Uff.. yeah sorry. Here's the full text of it:
Error 19:49:26 msg_show.lua_error Error executing vim.schedule lua callback: ...0.2_1/share/nvim/runtime/lua/vim/lsp/semantic_tokens.lua:304: ...0.2_1/share/nvim/runtime/lua/vim/lsp/semantic_tokens.lua:149: index out of range
stack traceback:
[builtin#36]: at 0x010093d078
...0.2_1/share/nvim/runtime/lua/vim/lsp/semantic_tokens.lua:304: in function 'handler'
...eovim/0.10.2_1/share/nvim/runtime/lua/vim/lsp/client.lua:687: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
hm
either a vim or tinymist error
not sure in this case
one thing you could do is go there and edit this file locally to debug what the range is
Seems the lsp lua script is failing itself, not tinymist
Most likely a typical utf8 issue
Okay, I dug around a bit and found this: https://github.com/neovim/neovim/issues/30675
I will try to this workaround:
Well, that does something lol.
Now tinymist will just stop working with that offset_encoding work around.
20:04:01 notify.warn Client tinymist quit with exit code 0 and signal 6.
from lsp.log
Have you tried downgrading nvim to 10.1 or using the nightly, I fell like it's the same pb I had and that solved the errors I got
could be, I thought of the same thing.
Oh, yeah. I meant the latest "stable" version, not the "bleeding-edge" latest.
Because the nightly builds definitely have more bugs than the stable ones.
Well, downgrading doesn't seem to be a good solution if the LSP is reporting something erroneously. I'm going to try --HEAD install. It's installing now.. taking forever.
Ugh. No go on this and it's late for me. I'm going to head to bed...!
So, Andrew... versions:
No, LSP server and the editor version are separate. You can use different versions of Neovim with different versions of tinymist.
You should try Neovim v0.10.0 and Tinymist v0.12.0.
I grabbed the binary of neovim v0.11.0 (brew install --HEAD failed and I'm too tired lol) ... anyway, v0.11.0 doesn't give me an issue so that seems good. I'll have to troubleshoot installing it via brew later.
Hm, didn't know that v0.10.2 is actually the new latest stable version. But it's also strange that there are a few problems with .1 and .2 versions, while the .0 is pretty good.
It seems tinymist cannot handle packages that require 0.12 as the compiler version because this patch is still 0.11.0, resulting in a failure at this check
context: #quick-questions message
Nah, it work just fine with the 0.12.0 version. I use a template with the par.spacing so I set the min version to 0.12.0.
then maybe you have a better explanation for the linked message then
but that doesn't check the package version anywhere?
did you follow the links i sent
try using the newest fletcher package
I think I already did.
peculiar
Yeah, I even just downloaded the binary through the mason registry. Same thing.
I'm not sure when or how the patch thing applies, but the fork that is linked in the cargo.toml of tinymist is not outdated in features, but the verison definitely is, which would explain the package check failing
since that usest the cargo manifest version
ok i retract what i said i forgot to check the tag that the fork uses
that indeed uses the updated version
You've used tinymist main. 🤩 But I also see the typical bad expression formatting (for the default values of named arguments).. I've considered it for a week. Might just replace the long values with their type, like label-wrapper: (any) => box = [:closure:].
this is going to be very strange..
but when I do
:che lspconfig
or
:che nvim-treesitter
tinymist immediately crashes...
Client tinymist quit with exit code 0 and signal 6. Check log for errors: ~/.local/state/astronvim/lsp.log
otherwise it works fine – goto def etc
can't reproduce with 0.10.0 + 0.12.0
What do the logs say?
installed tinymist like this
return {
"AstroNvim/astrocommunity",
{ import = "astrocommunity.pack.typst" },
}
this is just
return {
{ "kaarmu/typst.vim", ft = { "typst" } },
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "tinymist" })
end,
},
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "tinymist" })
end,
},
{
"chomosuke/typst-preview.nvim",
cmd = { "TypstPreview", "TypstPreviewToggle", "TypstPreviewUpdate" },
build = function() require("typst-preview").update() end,
opts = {
dependencies_bin = {
tinymist = "tinymist",
},
},
},
}
seems like this has something to do with highlighting(?)
going by textDocument/documentHighlight all over logs
Try reproducing the problem while running tinymist lsp --mirror ~/file.json. Then the crash must be present with tinymist lsp --replay ~/file.json. If so, then you can open an issue with the attached JSON file or send it to @oak quest if there is any sensitive info for you in that file.
the very curious part is: I have alongside neovim config (with NVIM_APPNAME variable) and there everything works fine
the issue only occurs within AstroNvim distro...
but I will do that in a while, thanks!
Now we are approaching the inception level.
It could be a silly thing to think but do you thing you can integrated utpm on Tinymist in the package/commands section of the panel?
It could sync 2 projects used by the community and add more functionalities.
I finally found some time for that
And managed to make it reproducible
here's the code that makes tinymist LSP exit when entering :che lspconfig
{
"AstroNvim/astrocommunity",
{ import = "astrocommunity.pack.typst" },
-- the trouble maker 👇
{ import = "astrocommunity.color.nvim-highlight-colors" },
}
commenting out astrocommunity.color.nvim-highlight-colors fixes the issue
And for the life of me, I cannot figure out how the hell that happened. I checked first all LSP / null-ls / Mason related configs, and somehow, the plugin that has nothing to do with LSP's, breaks everything 😢
here's what that import does under the hood:
return {
"brenoprata10/nvim-highlight-colors",
event = "User AstroFile",
cmd = "HighlightColors",
dependencies = {
{
"AstroNvim/astrocore",
opts = function(_, opts)
local maps = opts.mappings
maps.n["<Leader>uz"] = { function() vim.cmd.HighlightColors "Toggle" end, desc = "Toggle color highlight" }
end,
},
},
opts = { enabled_named_colors = false },
specs = {
{ "NvChad/nvim-colorizer.lua", optional = true, enabled = false },
},
}
I will open an issue on astrocommunity, since the issue is not on the tinymist's end
Does this happen with other LSP servers? If not, then it probably can be an upstream issue in tinymist, so that we can track it.
it deserves to integrate if the related functions can be used for automating editors. Do you have some use cases?
I'm making a diff between them but I only saw publish command that can automatically publish into typst the package. And it's not finished yet 😔
Otherwise they seems to be not so different when we compare functionalities (Documentation aside)
I haven't experienced it myself, but there is an issue on that plugin's github of people experiencing some LSP problems
and it looked like it also had something to do with textDocument/documentHighlight, as in my case
Then it's not a tinymist issue. And it's good that the package itself has an issue open for that.
yeah
tho in timymists case I found out a way to solve it: https://github.com/AstroNvim/astrocommunity/issues/1259#issuecomment-2453266332
it is as simple as removing one line of code, but idk what it does... so xD
waiting until some more knowledgeable astrocommunity maintainers review
No worries. We could create an initial issue that first describes features and plans. This could also attract people to comment and rich the list of package related features to be done. For the publish command, I think it is a great function but tbh only package creators including me can benefit from it. There is already some light "local package commands" in current tinymist, which create, push, and pull "local" packages. We can also try to continue develop this idea, further managing and publishing "git" packages. But, there is no concrete concept about "git" packages yet. We can have some discussion on it before working.
I heard that typst will natively support html export, will that affect the preview for tinymist or typlite?
probably not in the short term, but maybe in the long term
guess not, because I heard that the official HTML output will look very different from the SVG one. However, we want them to look exactly the same for previewing.
Not if HTML output is your actual goal
I don't know the relationship of shiroa with Tinymist, but while that be modified for the official html export?
i reckon once typst html export is good enough, shiroa would simply become an opinionated output template for html export
For preview, tinymist can add a "target" parameter, either "html" or "paged". For typlite (markdown export), little thing can be done because the strategy was changed. There was a unified IR proposed after layout stage and before export stage. A markdown export should be benefited from having such IR. But the IR design is rejected for simplicity. New strategy is that: you must hard specify target to "html" to affect execution of script, and the content type (typst elements) becomes poor man's IR.
when i use tinymist in vscode, and i click in the preview somewhere, it will open a new pane with the .typ file and jumps to respective place line. is that intended? can i make it so that it uses my already opened editor?
The new pane should be the preview not the file
what do you mean by the preview? i CLICK in the preview
and i want it to jump to the typ file
oh I missunderstood you
A few thoughts I had:
- Typst-preview uses a ludicrous amount of CPU. This makes sense because the problem it's solving is hard, but it'd be nice to optimize it somewhat.
- when the document is big enough that it stops being real time and instead starts lagging behind, the way it "catches up" is by replaying through every keystroke. It seems like it'd be faster and more CPU efficient to just abort any render tasks invalidated by a further keystroke and just start rendering the current state
- Implementing that may be difficult, I'm not sure what it's doing under the hood, so probably much simpler would be a "render on pause" functionality of some sort, where it doesn't render on every keystroke but only when you go 0.2 seconds without a keystroke or whatever. While responsiveness of on-type is nice for small documents, it's not necessary and when I'm doing homework for 6 hours, it'd be nice to spare the battery life lmao
Love Tinymist though, use it for about 20 hours a week I think lmao
Aborting is not possible due to memoization. Another solution could be to render on every keystroke unless it is already rendering something, and then after every render ends, render again if there was a modification after the laft render started.
I mean, memoization does not inherently make aborting impossible (either by rewinding or by only "committing" useful things) but that's why I figured it might be difficult, yeah
But yeah, this seems much easier and should be roughly equivalent in terms of latency
Basically the difference between
a b c d e f
aabbccdddddD eeeefffffF
here, all renders were started but all but d and f were aborted before finishing
a b c d e f
aaaaaAdddddD eeeeeEfffffF
here, a was rendered even though keystrokes b, c, d already occurred, then rendering resumes at d.
I think that's even preferable, since you're guaranteed that there will be some renders that finish regularly
True, guaranteeing some forward progress is probably nice, though tbh I don't think anyone types continuously in bursts long enough for that to matter too much
but yeah, it would also hopefully help the power usage issues
Since if the renderer does less work, that's less power consumed lol
It isn't faithfully rendering every keystroke but tries to fold all pending compilation and rendering.
Ah, fair enough—it looks a bit like faithful rendering but I guess the difference may be non-obvious
But there is a little difference, typst-cli will wait for 100ms for possible consecutive user inputs, but typst-preview will not.
🤔 also interesting that I‘m not experience any high cpu usage at all
and also never had lag
how big are your documents if I may ask?
so just debounce?
current notes document I'm writing in is 50 pages
any particular reason why typst-preview doesn‘t use such a thing?
both are doing debounce. typst-cli sets timeout to 100 ms and typst-preview sets it to 0 sec
But even when using ~10-15 page documents, Typst-preview burns through power faster than discord or a chromium browser with a hundred tabs
🤔 debounce by 0ms is just queueing isn‘t it?
Would it be possible to expose debounce timeout as a setting or something?
Wondering if there is any bench tools so that we can optimize power usage with some direction.
I dunno, I don't think I'm doing anything too unusual, though I have a decent number of non-local and fairly complicated show rules which might be affecting power usage
I think monitering the memory usage might also be important at the point (and maybe easier
Memory usage also gets very high
but this bothers me less because I have memory to spare
I didn‘t experience any issues with power usage
even though can‘t know for sure because I didn‘t rly ever use my laptop without using typst-preview for a longer period of time xD
(I do get the impression that there a psuedo-memory leaks with insufficient cache invalidation, because reloading the preview can dramatically cut memory without substantially hampering rendering performance)
not 100% sure if I interpet this correctly
but I‘m quite sure this just has a debounce >0
and with 0 it‘s sth different
oh so it that perhaps vscode specific?
I only use neovim
I dunno, I don't see why it would be because reloading just the preview without reloading all of vscode helps iirc
I'm on an M3 macbook pro using tinymist in VSCode
tinymist version is whatever the latest version is, no updates available
I'm happy to run some kind of bench tools if you'd tell me which ones are applicable/how, but I have no idea how to hook into a VSCode extension effectively and stuff, so you'd have to tell me how
(I am, however, also a programmer, so I'm not entirely incapable in this regard, just not actually familiar with any such tools)
unfortunately I don't know any power bench tool :).
I mean, should be power ≈ CPU usage ≈ a stack sample or whatever
any performance benchmarking tool should probably work fine
I'm recently busy with building basic infra of code analysis so things are getting worse recently. But I've done it just now. I'll turn to focus on optimizing CPU and memory usage for a wile.
I am doing some logs for the memory usage these days
The bad thing is that every time I tried to catch some huge memory usage, that the final reason was that there was too much compilation cache in comemo.
but I only have toooo simple typst files
Would you like some 50 page files covered in stateful bullshit?
If we just care about CPU or memory stats, tinymist has very advanced arch among language servers. To catch concrete CPU/memory usage, you can record inputs by tinymist lsp --mirror and then replay inputs with having intel vtune (for flamegraph) or cargo build --release --bin tinymist --features dhat-heap (for heap memory stats).
I‘m on M3 macbook air and have never experienced any issues
fyi there a tools for typst to replace anything with random glibberish
while keeping the document
would be useful for testing
It now renders docs conditionally. There is a supportHtmlInMarkdown configuration item that controls whether to render equation and remove html in contents. The configuration item is not a user configuration, but for lsp client developers (people who are knowledgeable to configure editors).
I posted Add More Maintainers to Tinymist and somepeople would like to become a maintainer of their interested domains. We are going to add them to list of maintainers on GitHub since 2024-11-22 (in 7 days):
- @ParaN3xus want to maintain the "Nightly Releases" feature in https://github.com/Myriad-Dreamin/tinymist/pull/783
- @lean latch574 want to maintain the "Editor integration" feature in https://github.com/Myriad-Dreamin/tinymist/pull/784
- @Eric-Song-Nop want to maintain the "Language Service" feature in https://github.com/Myriad-Dreamin/tinymist/pull/796
- @alerque want to maintain the "Neovim integration" feature in https://github.com/Myriad-Dreamin/tinymist/pull/810
Please reply in PRs or DM @Myriad-Dreamin if you have any concerns about adding these maintainers to list.
how to replicate:
$ echo "Straße" > main.typ
$ nvim main.typ
text of the error:
Error executing vim.schedule lua callback: ...0.2_1/share/nvim/runtime/lua/vim/lsp/semantic_tokens.lua:304: ...0.2_1/share/nvim/runtime/lua/vim/lsp/semantic_tokens.lua:149: index
out of range
stack traceback:
[builtin#36]: at 0x0108f64def
...0.2_1/share/nvim/runtime/lua/vim/lsp/semantic_tokens.lua:304: in function 'handler'
...eovim/0.10.2_1/share/nvim/runtime/lua/vim/lsp/client.lua:687: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
with timymist disabled no error appears
and if there are only english chars it doesn't break:
$ echo "street" > main.typ
$ nvim main.typ
quite sure the fix (or at least reason) was related to offset encoding
idk what exactly it was though
it's probably just https://github.com/Myriad-Dreamin/tinymist/issues/638
altho in that case error appears even for english-only chars
A typst file with contents: Bob’s car Will cause the error index out of range @ semantic_tokens.lua:149 in the neovim runtime. Error executing vim.schedule lua callback: ...0.2_1/share/nvim/runtime...
the wonders of downgrading a package on macos 😭
$ brew uninstall neovim
# manually find needed commit for
# https://github.com/Homebrew/homebrew-core/commits/master/Formula/n/neovim.rb
# and copy its URL
$ wget [URL] && brew install --HEAD -s ./neovim.rb
==> cmake --build build
Last 15 lines from ~/Library/Logs/Homebrew/neovim/02.cmake:
/tmp/neovim-20241115-13099-j026jy/src/nvim/mbyte.c:1356:15: error: no member named 'ambiguous_width' in 'struct utf8proc_property_struct'
1356 | if (prop->ambiguous_width || prop_is_emojilike(prop)) {
| ~~~~ ^
3 errors generated.
use bob for neovim installation
interesting
idk what it is tho
googling gives github.com/ripperhe/Bob
anyways, I fixed the problem with the workaround mentioned in the issue above (i.e. with offset_encoding, as you said)
if u cannot downgrade, why not upgrade, it should be fixed already
I made the symbpls and emojis from typst a cmp source in nvim,so that you can input unicode with its name in Typst https://github.com/Eric-Song-Nop/cmp-typst-symbols
$ brew info neovim
==> neovim: stable 0.10.2 (bottled), HEAD
# ...
Installed
/usr/local/Cellar/neovim/0.10.2_1 (1,902 files, 29.3MB) *
I think this is the latest?
f*ck this.
when I finally managed to build/install neovim 0.10.1 instead of 0.10.2, tresitter broke :((((((((((((((
whatever ig
you definitely shouldn't be using 0.10.1
and as I said
with bob you'll have no issues installing different versions
this is my whole setup for tinymist with 0.10.2 and it works just fine
vim.api.nvim_create_autocmd("FileType", {
pattern = "typst",
callback = function(args)
vim.lsp.start({
name = "tinymist",
cmd = { "tinymist" },
root_dir = vim.fs.dirname(vim.api.nvim_buf_get_name(args.buf)),
autostart = true,
settings = {
exportPdf = "never",
},
})
end,
})
oh actually
I got this in my on_attach
if client.name == "tinymist" then
-- vim.lsp.semantic_tokens.stop(bufnr, client.id)
client.server_capabilities.semanticTokensProvider = nil
end
hmm
thanks!
🤔
just removed that line and everything's working fine xD
so ig stuff has been fixed either on tinymist or neovim side
So it's like a tinymist autocomplete, but without an LSP server? I'm glad all 4k LoC are auto generated, otherwise it would be insane to maintain that.
Guys, the last time I asked about Tinymist's preview, someone said that it's being worked on and there will be a newer version that's faster, more performant. Did those changes get committed?
The "rendering in web worker" branch was not increasing performance much so we didn't move on the idea for a while. The branch should continue reimplementing or opting out a bunch of features to remove SVG export, e.g. bidirectional jumping feature, to get faster.
no, it is a unicode selector but with its name in typst
Ultimate fighting championship?
😂 unified function call syntax
The rule is in short: if the "dotted" target is T type, lsp will complete functions accepting target as the first argument (having T type) for you.
fantastic!
amazing!
Wow I saw the praise and then went "WHAT DID I MISS?!". Loooks beautiful!
Awesome! is it pushed to the repo? Can;t wait to use it!
I also hope that Typst can have the UFCS built in
have not yet. I would like to finish two things before real PR.
- fix a few cases in markup mode and math mode.
- add an configuration flag to disable ufcs feature for people who don't like it.
I've updated to what appears to be tinymist 0.12.2 and despite the logs reporting that it receives the config with exportPdf = never it still does occasionally export the pdf for some files and I don't know why
there are also export log lines inside for debugging, you could check them. If there is no even any export log lines, some other software might be generating the pdf.
How can I setup vscode to use the Tinymist in my path without setting its full path?
no ways out of box; you could bundle an extension again with the specific binary.
I prefer create a feature request for it maybe🤪
What's your use case? Why do you have to use a binary on some relative path?
Not relative path, but I hope it search the server on my system PATH
Or can I use any environment variables in the config?
For example, zig.zls.path: "zls" config, Path to zls executable. Example: C:/zls/zig-cache/bin/zls.exe. The string "zls" means lookup ZLS in PATH.
I just checked if. What if you set configuration tinymist.serverPath to tinymist
could you add some documentation (neovim users may be kind of seeking this feature but they usually don't know the trick)?
Why Neovim users need this? Isn't neovim tryies to use tinymist from the $PATH by default?
in fact for all editors who own users loving cargo install. they use tinymist from .cargo (env)
😮seems so
Thanks for this amazing project!
Any chance for supporting custom snippets?
aren't custom snippets a vs code thing? you don't really need any tinymist support for them i believe
at least last i checked
Looking for a walk around for Helix haha
ah LSP also supports this independently it seems
custom snippets wouldn't be something done by an lsp (except I'm completely missing a part of the spec, but quite sure I'm not)
that's something you'd do in your editor
Thanks anyway
unless they are semantic-aware. both ra and tinymist supports snippets by configuration. But tinymist doesn't document it for we are not knowing how to design and expose them correctly.
a language server should also not really handle custom snippets i think. that's the editor's job, the lsp should only provide common ones for a langauge on top of those
R-A handles custom snippets.. Or atleast inserts them somewhere.
hmm, an odd choice though considering vs code supports them by itself
and so do plenty of other editors
Are snippets something packages might be able to ship? If tinymist knows where packages are stored, could it look for "snippet files" or whatever? Thinking like cetz or fletcher
I have a large document where VSCode is getting particularly laggy. Is there a way to start tinymist in a more “minimal” configuration? Syntax highlighting and preview are probably all that I need to work either way
I doubt tinymist itself is what's laggy
are you saying vs code is lagging, or the preview is lagging?
getting fast preview on large documents requires you to be careful when choosing what kind of packages you use
some are massive resource hogs
The preview seems fine but the editor is really laggy
ok
My baseline is Typst watch perfomance, with that running I can write just fine
Fascinating. How many lines is it?
opening the preview in browser can mitigate the problem. this is because the previewer and the vscode run in a single thread.
That’s very nice to know, will do next time
Nothing excessive it’s around a 10k words for now but I’m using the bytefield package a lot, I’d say that’s probably the main reason for the slow down
Is that something that can change, or is it a vscode limitation?
we can run entire renderer in web worker, but it is super challenging.
I've experienced slowdowns with tinymist previously, generally when working with cetz. Is there some cache that's just exploding in size or something maybe?
Is the problem still existing in 0.12.4?
Not sure as I haven't had much time for typst stuff of recent, so I think for the moment what I said should be read as an anecdote
I just remember constantly needing to reload the window
(ps: tinymist is awesome, and what I'm saying doesn't detract from that <3)
I added more caches in 0.12.2+, so things might change.
I'll try and find a moment to test. What sucks is I don't know concretely what makes it slow down so testing isn't the easiest
It makes me really sad that tinymist is so cool and yet at each point in time something breaks what once have been working and I've been use it.
This is one of such examples: https://github.com/Myriad-Dreamin/tinymist/issues/945
I've also noticed that not all errors are shown in the file, so if the document doesn't update I have to open a shell and run typst manually to see the error. I'm not sure if it only does that when the error happens in some package file or not, but even if so, I would like to see the error in the main file where the package is being imported.
Could be a new feature? Or should this already work like this?
Looks like codly() parameters are also not autocompletable.
Unfortunately we lack of people tracking usability in neovim. Ericoolen, one of the tinymist dev, was using neovim but switched to VS Code recently
I doubt whether we can complete its parameters without any other information 🤔.
Oh... ok, I didn't think that there are no explicit parameters. Now I'm not sure if it was working before or not. I feel like it was. But the parameters are available only in 0.2.0. I used 1.0.0 before.
If the server is editor-neutral, then they all should behave the same way. For example, rust-analyzer and Neovim/Helix: #off-topic message.
A known open issue that causes degrade of experience is https://github.com/Myriad-Dreamin/tinymist/issues/875
The related issue caused sublime users receiving command-not-found errors again and again so I merged some commit and opened this issue for neovim.
Only shows that not all efforts are done at the server side, so we defintely have different experience in different editors.
@viral trench
Yeah codly it wayyyyy too complicated unfortunately, it has like 60+ args I think
And I use this weird JSON file to automate most of it
Maybe I'll make a 1.1.2 with it done "traditionally"
Can't the documentation be automated too?
Can params be listed as doc comment?
That's what I thought we were talking about
no, it cannot document a not existing parameter (we must also document whether it is positional, named, or variadic). But I might change it somehow
It would be good if we could. It could check if the function accepts vargs (error if undeclared Param is defined when vargs aren't used).
When I implemented docstring, I found that the current way of documenting types of parameters is not good. The best way in my mind is typescript's overloaded sigantures. https://www.geeksforgeeks.org/typescript-overload-signatures-and-implementation-signature/
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
Typescript is 🤌😊
That said documented vargs still have their place, like in cetz-plot for axis options
There is also a great example in typst is rgb. will look like this in typescript:
function rgb(hex: string);
function rgb(r: number, g: number, b: number);
The main problem is that codly acts like a set rule
I don't want to override arguements that are not provided
but there is no good default value that I can use for it
since auto and none are used as actual argument values
and therefore cannot be used as placeholders
I have one, though it is very ugly in my opinion 😇 . I found it in touying.
Can you explain it please? 😄
The code is easy to understand.
if you want to get really cursed, you can do let _placeholder = context none, afaik that's not equal to anything, not even other context none 😛
Typst enums when
😱
Is it equal to itself?
?r ```
#let _placeholder = context none
#(_placeholder == _placeholder) but #(_placeholder == context none)
Awh heck yes, unique symbols!
a quick question made me think of it; I'll look for it, I want to know myself 😅
#quick-questions message no context (pun not intended) there, must have been a spontaneous thought...
Don't frame me, I didn't betray Neovim
Whew! I was worried!! 🙂
I guess we just don't have enough unit tests🤪
Perhaps, if tests can catch that.
test should be able to catch such errors
(but I am too lazy to understand how to write snapshot test for completions yet
For the completion one, yes snapshot testing can cover that. For the missing diagnostics, I don't know the way of continous testing that for neovim. There were suggestion about some lua framework, but I haven't started for years.
when I asked neovim one, I wrote some scripts that automate testing electron+vscode by myself. The diagnostics in vscode then never went wrong after that.
Does cargo build still depend on yarn run compile for the 2 sub projects?
I think no
As tinymist already has a pretty good support for doc comment before typst, should we consider create a linter from tinymist?
it should be the time to create a linter. As a quick start, we can only check default values of named parameters first.
Does anyone using tinymist with Neovim has such error when using postfix snippet for context, like text.fill. It's only happening on Neovim, I am not sure is it problem from Neovim, cmp/blink or LspConfig.nvim(Or my config)
neovim may be applying additional text edits with side effect, i.e. replace and calculate the ranges in order and one by one, while VS Code sorts and applies text edits to ensure all ranges are applied based on the state of text document before change, as lsp required (but undocumented). You could try to ensure the order at the server side and see whether the bug is fixed.
Yes, it depends on how many letters you write too. I think if you write the whole word then it's good. I also tried adding alignment this way, but I guess there are no snippets for this?
I saw this with text size.
So... Now the import items do autocomplete, but...only if I start typing them. There are times when I just want to see which items I can import, so having just : still doesn't show any import items.
thanks
https://github.com/Myriad-Dreamin/tinymist/pull/962 a fix that might not be perfect
fix: import "lib.typ": | cannot complete
problem from #952
Seems that we should avoid using additional text edit for completion items
An optional array of additional text edits that are applied when
selecting this completion. Edits must not overlap (including the same
insert position) with the main edit nor with themselves.Additional text edits should be used to change text unrelated to the
current cursor position (for example adding an import statement at the
top of the file if the completion item will insert an unqualified type).
what do you mean. our edits do have avoided overlapping with main edit and themselves.
I am pretty sure they overlaped with the main edit here
The formatter in helix is not working for me, any tips on how to fix that?
in the config the lsp is defined as follows:
[language-server.tinymist]
command = "tinymist"
config = { formatterMode = "typstyle" }
I think helix doesn't yet support formatting like that
Is it known to ever work?
rust analyzer does it, but I believe it works out side of helix by formatting the file itself
Now it works once again!
I remember that hovering over * should reveal all the items that were imported, right? Guess if this currently works or not.
Not that I really need this, but it's an interesting feature.
Any update on: https://github.com/Myriad-Dreamin/tinymist/issues/626 ? jumping to toc constantly in preview is so annoying
The feature was proposed by myself, just a random thought about the hover feature. I fixed it and added test to avoid regression in future just now.
I commented it under the issue last week. not sure how does webapp solve it.
it is amazing that we have already created 791 test points by snapshot testing, but this is still far from covering all features..
> (Get-ChildItem -Path $folderPath -Recurse -Filter '*.snap' | Measure-Object).Count
791
I have good news and bad news...
The good news:
The bad news:
The bad news is fixed 🥺
nice
How do I get the type of an expr with its ast node in the code of Tinymist properly?
SyntaxNode or LinkedNode? You'll get proper type by ctx.type_of_span or collect all related union types by ctx.literal_type_of_node()
for the latter one, it also sees the context, e.g. call context if the node is the part of a call, so is much slower. for example, given a query on the string node in read("path"), the former one only says it is string type but the latter one also says it is a path (type) as the string is used for the read function.
sorry for a probably too basic question, but how does tinymist render to html?
does it like reimplement typst compiler from scratch, or does it use it as a black box and transforms pdf to html, or maybe something different?
going by this issue, it looks like vanilla typst compiler can't compile to html 🤔
Main has very rudimentary html output
its images overlaying with exported a semantic layer to interact with. the semantic layer is a div containing text spans (<span>), links (<a>), videos (<audio>, <video>) and others.
not yet.. but actually on main it can already it is just very basic
tinymist uses the typst compiler as a dependency and always releases two versions, a stable one and an rc based on the most recent commit
Is it known that (I think) always the named parameters are not the immediate items in autocompletion? I always look at the list, hoping that I will find that I'm looking for, but usually I have to partially write the thing for it to even appear in the list, let alone be at the very top.
What do you mean? I don't understand but your neovim completion plugin might reorder the list by their owned intelligence.
Try this
{ name = "nvim_lsp" }, is the first source in hrsh7th/nvim-cmp.
no-no, in a new file with a clean launch of tinymist
otherwise it always can suggest different things depending on the context and previously chosen items.
no difference
weird
cmp nvim has a ranking mechanism for items, I think it's theirs fault. Btw, I would recommend you to hover for doc instead of betting on a smart rank from completion in this case, as typst functions usually have a long~~~ list of arguments
@harsh wing Do you also have this issue on your side?
#1260973804637786224 message
I do use docs from time to time.
that‘s not directly a tinymist issue
tinymist could perhaps do some things to improve this but it‘s not tinymist‘s fault that things are the way they are
How can I improve this? Can tinkering with cmp help?
not 100% sure tbh
you could change source priorities
and perhaps overwrite the scoring function (should be possible, I haven‘t done it before though)
you mean move the lsp priority lower?
I'm not sure if I have this problem with Python or Rust, but I need to pay more attention. Because if it's just tinymist, then I'm surprised the plugin only messes one server.
🤷♂️
it's just that the only thing a language server can do for sorting of the entries (to give some entries a higher priority that is)
is just providing a dummy sort text (alphabetic characters or numbers)
which is just a horrible hack
so all the sorting is just done on the client-side (nvim-cmp) in your case and tinymist can^t really do anything (apart from hack mentioned above) against it
Wait, who does the contextual item suggestion? Isn't it a server? Like, when you trigger a completion menu, doesn't the client send the cursor position to the server with the file content and the server needs to figure out which items should appear on top?
in my client I only know that I can change the priority from different sources, but the lsp is at the top.
How is providing a key for sorting a hack?
server just figures out which items should appear at all
and perhaps preselect one
perhaps not a hack
but I'm not sure if that's what the field is intended for
also what is interesting
that apparently in vscode you get very different completions
We need Helix people to show what are the suggestions for this: #1260973804637786224 message
@buoyant sand
which version of tinymist
I have v0.12.10-9-ga1fdeab
because I compiled myself recently
ok
I think the version name should be fixed, because there is no g in a1fdeab commit
I can't find a1fdeab either
the branch is probably deleted, it's fee46d2 on the main
5 days ago
oh, wait, no
ab23463
right, which version did you use?
someone should smack them
It went up from 750 in maybe a year
dependency hell is awaiting
to be fair, it's very advanced and have to be able to do a lot of things. though still not perfect, need more dependencies!
I see a neovim-completion-cb branch
ok, it's not related to this
btw, here is my updated justfile:
install: pull
cargo install --path ./crates/tinymist/ --profile gh-release --locked
cd target && \
llvm-objcopy-14 --compress-debug-sections --only-keep-debug "$CARGO_HOME/bin/tinymist" "tinymist.debug" && \
llvm-objcopy-14 --strip-debug --add-gnu-debuglink="tinymist.debug" "$CARGO_HOME/bin/tinymist"
cp "$CARGO_HOME/bin/tinymist" "$XDG_DATA_HOME/nvim/mason/packages/tinymist/tinymist-linux-x64"
alias p := pull
pull:
git pull
alias c := clean
clean:
cargo clean
I'll try the latest just in case
you forgot to add 69.
this is what i see on b19810ea
so it's good then
apparently
I need to make a MRE later
Dioxus 🚀
I think tinymist had this feature at some point:
But now it shows docs for both parentheses.
Is this a yet another broken feature or was it removed?
what is this feature, I dont get it
It's super useful as it does not require a let or panic to see the result value.
see a return value with hover on the closing parenthesis
It just prefer to showing the signature of map call than showing values for you.
Who is "it"?
If rust-analyzer can do this, then it means the server has the ability to choose.
it's falut of typst and neovim
vscode behaves a little better
btw if you use neovim , you have to always check workspace diagnostic, for me, I use :Trouble diagnostics
Who's Trouble?
trouble.nvim
yeah, so this isn't shown is any of 2 local files
do you use it when it stops compiling?
isn't it showing the error?
can I have a smaller example?
I accidentally edited a file in the package and not the local
I redownloaded the package
no example
fine, in short, only limited errors can be shown on the caller side, most are only known at compile(run) time, and can only be shown on the callee side.
server can't figure out the call stack?
let me create a simple example
// main.typ
#import "lib.typ": testFun
#testFun(x: "1")
// lib.typ
#let testFun(x: 1, y: 2) = {
x + y
}
// result from typst compile main.typ
error: cannot add string and integer
┌─ lib.typ:4:2
│
4 │ x + y
│ ^^^^^
help: error occurred in this call of function `testFun`
┌─ main.typ:4:1
│
4 │ #testFun(x: "1")
│ ^^^^^^^^^^^^^^^
now the help: is handled as a realtedInformation (which is a common practice I believe), while neovim cannot handle this, but vscode shows it
You might not like this behavior, but this is the limit of dynamic type language.
Python lsps might behave worse in this case.
At some point Tinymist will diagnostic for wrong type, but that will bepends on the type check of tinymist
Bubble up this diagnostic is not simple, there might be a long tracing path, it's hard to determine where exactly we want to show it.
I want to see it at all levels for easier discoverability
having multiple diagnostics points to the same issue might not be a common thing
This is similar to an issue I had: https://github.com/Myriad-Dreamin/tinymist/issues/1001
This is the distinction between diagnostics and workspace diagnostics in Neovim
I ended up going with Trouble too, but you can also use fzf-lua: require('fzf-lua').diagnostics_workspace()
hold on, does this depend on some context?
Since the type checker fails on this case, you see the old expression tooltip instead of the new type tooltip. Now it provides them exclusively, but we may be better to provide both hover tooltips in future.
old but gold
@harsh wing I forked your typstfmt and bumped it
may push the changes back to your repository.
Hello, I've been trying to add "PageUp" and "PageDown" to change slides in tinymist-preview
I found the place to add them in tools/typst-preview-frontend/src/ws.ts but i cant figure out how to include the changes in the final binary
why im doing this?
KDE Connect's presenter remote uses page up and page down buttons for changing slides
(please ping me if anyone replies)
For now, left/right arrow keys works as pageup/down
btw, it might be working just you are not rebuilding with that module
checkout tinymist assets
Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst]. - Myriad-Dreamin/tinymist
@trim juniper
aha, i think that was what i was missing, gonna try it with the feature enabled
yeah but it wasn't changing the slide when i tried it, thats the whole reason i had to dig into whats happening
what i tried
do yarn; yarn build for all 3 folders in tools
do yarn, yarn build:preview, build:editor-tools in root
do cargo build --profile dist -F typst-preview
it still didnt change the script for preview
maybe you also need to check the main Cargo.toml, might need to uncomment: https://github.com/Myriad-Dreamin/tinymist/blob/a5133b01464bfc4ee01323b724e5ee8b08b4af4e/Cargo.toml#L206
@trim juniper
I'm really sorry, but I don't have time for the repo yet. I should in one week though.
I'm thinking that I probably should implement that new version with markers.
For a much better formatting
And I think it will also fix the un-typstfmt::off.
no pushing
With 0.12.10 I don't get the label completion if there is ( before @:
iea <a>
(@)
@harsh wing webapp also has this issue, because (@) is a whole text and the @ inside doesn't trigger any completion.
not a regression
I sometimes float some thinking in mind to invite you to add some cases in tinymist-query/fixtures/completion. This is a set of fixtures testing the completion function. You can also view it as the details how we expect a completion to work. We could add a specification file that systematically sort and identify each of them.
so it's the same kind of "regression" as https://github.com/typst/typst/issues/5199
is this a typo?
this testcases is not needed, maybe @oak quest used it for test and forgot to delete it
I've noticed that at least in some cases it will incorrectly autocomplete half-written item.
it is a known issue that cannot be solved by current completion framework. it might be solved when we switch to a new framework.
Well, I'm not sure, but I think previously or in other situations tinymist autocomplets half-written items just fine. So what's the difference between such situations?
what does completion framework mean?
probably some crate
seems that the completion part of code is refactored
I'm very close to solving all of the neovim issues but I'm geting a weird error
tinymist: -32602: expect Vec<String> at args[0], error: invalid type: string "/Users/sylvanfranklin/.config/test.typ", expected a sequence
I'm sending it like this lua vim.lsp.buf.execute_command({ command = 'tinymist.doStartPreview', arguments = { vim.api.nvim_buf_get_name(0) }})
I had kinda the same error, but in a completely different program.
huh
Though since both of them written in Rust, maybe they are about the same thing.
yeah they are going through the same api in the end
but interesting you say that bc I thought it was a lua problem on my end
thing is it works when I just type the same thing into the cli so I'm lost
passing an argument array?
My error was in Dioxus when I used the submitted form data like let data: MyData = event.data().parsed() or something and it said something very similar with the same set of words. And the problem was that each field/name/value was of type FormValue(['']) and not String. MyData struct was a set of String fields, since in web all fields will be sent in a string form anyway. So instead I had to do this, cuz I don't know any other way:
I was going to make it a bit better, but I don't have time for this.
There is no Vec<String> in Lua, so...
Like this?
lua vim.lsp.buf.execute_command({ command = { 'tinymist.doStartPreview' }, arguments = { vim.api.nvim_buf_get_name(0) }})
you are requested to pass the clI arguments of typst-preview
as.the first argument of the command
wait no you are onto something though
maybe the API is simply not interoperable?
I'm still confused but I see what you are saying
like, in Lua it expects a single string for the command, but in tinymist it expects an array.
and somewhere in between there is a miscommunication
could be yeah, I'll keep trying tho
I see how you are calling that function, but do you have a guide for that somewhree in the docs?
okay fixed that issue
now passing correctly as an array, but still not opening the frontend for some reason
I did get exportingPNG to work though which is very promising
hoping to get full parity by tommor and push an updated lsp config + docs
The commands are really a bit internal. They are internally used and indirectly documented somewhere in vscode though. Perhaps we should also maintain some docs of these commands for other editors.
No, I'm not documenting that. Due to my limited bandwidth to open-sourced projects, documentation is only issue-driven or chat-with-me-driven :(.
thank y'all smart people for fixing these issues!
okay sounds good
if I have time I can try to write the docs for that once I understand it a little more
I think it will be much easier for people maintaining the other editor integrations
You could directly ask me to get answers quickly. I was answering in short words because I was on my phone, but when I back to the front of my computer, you solved it by yourself.
okay thanks
I noticed that the preview in VSCode is a lot clunkier than the preview in browser. Why is that?
vscode webview and editor live in the same thread. so they will share the cpu/gpu resource. when in chrome, they are in different processes, so generally it's more fluent when open preview in browser
Store project information into a tinymist.lock file. The behind philosophy is understanding projects by (remember) your recent behaviors.
Note: Project lock doesn't equal to project configu...
I start to design the tinymist.lock instead of some configuration. All of our previous design of project configuration seems not very easy to use.
New design introduces a tinymist.lock connecting typst compile with the tinymist. Let's alias typst compile to tinymist project-compile, then tinymist can "instrument" your compilation in terminal!
Then, when it runs compilation compile main.typ, it will know the main.typ is a main file, and all of the dependencies are known as well. We can store these information into the lock file. Our language server can be also very responsive by watch the file. Fairly easy, right?
Let's also introduce a headless preview which doesn't specify any input to preview. This looks very nice for TUI editor users, e.g. neovim and helix.
- In a fresh workspace, tinymist preview will wait for people performing any action, e.g.
typst compile(thetinymist project-compile). - When you execute
typst compile, it updates the lock file, and tinymist reloads the compiler with the compiled main file soon. - In a recently visited workspace, tinymist preview can simply use the recent (the entry having highest priority), and your "state" is recovered successfully.
This is my random thought today, and I implemented it quickly. Some details could be discuss or we can also discard the lock file design if we feel it is not great actually.
I failed to see the usefulness in this. Sounds like I will have to run the compile/watch command anyway.
Weren't you running pin commands repeatedly?
If you add some extra arguments to tell tinymist to export PDF on save or on type, you'll not have to run compile/watch in the workspace after that anymore.
Well, I don't always want to export the PDF, but I always want to have the best LSP suggestions.
And I remember that after pinning the main file some other files where autocompletion works to some degree stops working. I don't want that too, if I can just not pin the main upon opening the editor.
If you don't want to export the PDF on save or on type, you can set it to never. Then the "tinymist compile" only save the information about the compilation, like the main file and depended source files into the lock file. You can somehow customize the main file to use by such a sequence of compilation (or introduce some priority design).
like "tinymist compile main.typ" and then "tinymist compile main2.typ". Or saying main2.typ has higher priority. tinymist can use main2.typ to compile first if the viewing file is any dependencies of main2.typ, otherwise it uses main.typ when possible, otherwise it uses the current opening file.
I'm gonna be honest, after the first sentence, the rest doesn't make any sense to me. Sounds like something about nothing. x)
to me a project level config sounds super useful for the one and only editor without plugin for type preview, helix
I agree I think that it could take a lot of pressure out of the imlementation of language server featuers for all the different editors
or at least it could make it much easier
on the neovim side I would like to work on getting more of the featuers that are built into vscode, like commands for exporting images and html / markdown
it is possible to call them currently but kinda internal
I don't know how changeable the nvim-lspconfig code is
if we can't push changes to that the next best thing is just expanding the docs to show examples for setting up all of these client commands as easy to call neovim commands
I still use my initial custom tinymist config for this. So it's definitely changeable. you can add your commands there.
at that time the upstream config broke something so I stick to mine.
don't know if this has changed
yeah pretty much same
I have a bunch of years experenice with configuration though and I feel like newer people might struggle to set up some things
also you're right I think something kinda broke
preview for me
I think the only concern was the one-file-mode, other than this probably is good.
well and the default settings like saving pdf etc., but that can be set with the upstream config
finally the time to get rid of pin. It remembers which ones are main files after editor reloading and typst compile in terminal.
With remembering main files, when I switch to the template file, it still shows values in the template functions. This is the screenshot.
Someone here is using helix and knows how to define formatting for typst?
I think helix doesn't yet support explicit formatting through an LSP
Last I checked the keybind for it it said it was disabled for now
rust analyzer has a setting to simply format a file on save, so if tinymist does too that should work
Thanks!
can tinymist export to SVG? I did not see the option.
Hey there, is there some way to have tinymist preview working properly in Zed? I don't necessarily mean the SyncTeX-like clicking but rather the quick refreshing of the pdf
the tinymist preview is not pdf based
Hmm okay, is there still some way to have a quickly refreshing preview?
It could work with some pdf viewer but I sadly haven't found one that does refresh automatically and doesn't blink on every refresh
which os?
Disclaimer: I have not tried it
not sure if it does preview at all
MuPDF refreshes with a HUP signal and doesn't blink.
echo "$pdf_path" | entr -n kill -HUP $mupdf_pid
Someone is using zathura, but when I tried it it was crashing waaay too much.
On Mac
I am using this already; it does not support previews as of current Zed limitations (see one of the issues)
For some reason the pdf is really blurry in mupdf...
Even with -r 300
Feels like both don't really suit me, don't know any of the vim-style keybindings and don't really wanna learn them :/
I'm currently using vscode + tinymist but also not really feeling it...
I never had that issue in over a year of using it.
Something is wrong.
In MuPDF I think I only use g and G from Vim motions, other shortcuts are app-specific.
I also use Z and I. That's about as much as you need to learn.
I remember you use neovim. you can call the exportSvg lsp command.
helix and zed users may check it in 0.12.20 (unreleased). in future, you can configure a preview task in terminal by tinymist cli and start a preview task with existing configuration by lsp command or the cli.
I use vscode :p, still the same?
Hmm I did use the nix version, maybe that one is somewhat broken. Will try the normal one
That sounds perfect!!
Is there some way to get that version already? I can only see the 0.12.19 release candidate
I'm currently using the Nix version. Previously it was from apt.
yo neovim people
looking to export svg
I got that working recently
I'll open a pr to show how I did this in the neovim docs
cuz currently it's kinda internal
at your service 🫡
has anyone here used typst with termux? tinymists seems to be incompatible with Android. it would have been great to have all those lsp features. could anyone share any info or guidance please ;)
update: it took like 1.5hrs to install tinymist with rust but then i tried checking if tinymist is already a package in termux and it exists 💀. bad luck
I don't see it.
You can potentially set everything up with nix via nix-on-droid
but for me it takes a lot of minutes to add anything new.
But it does work. It's basically like a home-manager setup.
what do you mean ( my message was just exclaiming that i didn't bother to check if there is a termux package before going through all those time consuming steps. i wasn't complaining )
oh. i do not know what nix and home-manager is. I'll check it out :). fyi, im quite new to cli and cs stuff.
I don't think you want to dive right into nix then
Honestly I'm gonna be a bit of a dick head and say don't listen to Andrew right now 
understood
haha okay :)
i tried checking if tinymist is already a package in termux and it exists
You literally say that you tried checking for it and that it exists. I checked and it does not exist.
hm? it does for me
I mean, if the knowledge isn't deep, then that's a good advice.
ok, so the cli is misleading. if I run a command that isn't installed it will show that I can install it. But with tinymist it didn't do that.
and with apt show tinymist it also didn't show it
ah okay
but installing it anyway does result in installing a package
okay
I guess I should've used pkg search.
ah yes. im not used to apt so i didn't think of using it
Is the HTML feature present/enabled in the tinymist?
the compilation and analysis targeting HTML was supported last month. but it is not smooth to configure a document and its dependencies to target HTML. I should not provide a configuration item to switch between paged target (pdf) and html target, because it is a document-specific option, i.e. whether a document is targeting html or not.
to make an analogy, typst has introduced something like "crate-specific feature", but we cannot enable all features at the same time. it is kinda worse because we can somehow have a global configuration item in rust-analyzer that enables all feature and runs diagnostics and analysis once, but we have to run once for paged and run once for html in typst and deduplicate results then.
in vscode you can see "export as..." button on the top of the documents. The svg and png export are hidden after the button.
hmm, I guess it is more complicated. But I'm only interested in HTML autocompletion. which is 1 module with 2 functions and one other function so far.
no, they are not released yet. The main branch has 22k changes since 0.12.18, so we should either revert changes to get bug fixes with a quick 0.12.20 soon, or wait for sufficient testing patiently. I guess the time should be two or more weeks.
html functions can be reached in global unconditionally so no changes are needed.
it doesn't show html globals
two or more weeks in development, but I'm on my new year's holidays and not developing. my holiday is ended in 12th, Feb.
Will you able to enable the feature flag by default? There is no actual downside in keeping it on if you don't use the output.
I should not use the html-featured library to compile the paged-target documents. This is not a correct use. To expose the html module by default, we should create a pr to change that. I guess w'll get rejected for it is still experimental.
nightly builds are experimental
you can make it a feature flag and only enable for nightly builds
bruh, okay i found it haha.
Exactly 1k commits on main!
Is it possible to zoom in in the preview pane?
Ctrl + scroll Just like in a web browser
I tried cmd plus and minus. Didn't work. Also ctrl plus and minus.. Didn't work. Scrolling did though.!
The shortcut will work in next release. Feature implemented before asked again 😄
I cannot even... 👏 👏 And one more for good measure 👏
Is this extension working on vscode-server?
It doesn't ensure to work on vscode-server.
Thanks! Indeed it is not working now, at least for me 😭.
Does anyone else have the issue that when something is pasted in, that gets ignored?
-# I’m using neovim
Since when?
ok, wait
it's not when pasting
[ERROR][2025-02-04 10:52:12] .../vim/lsp/rpc.lua:770 "rpc" "/home/tijme/.local/share/nvim/mason/bin/tinymist" "stderr" "[2025-02-04T09:52:12Z INFO sync_lsp] notifying textDocument/didChange - at Instant { tv_sec: 337, tv_nsec: 682524111 }\nthread 'main' panicked at crates/tinymist/src/server.rs:976:26:\ninvalid range\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n"
this is when
uh
i'm using rofimoji
and it's typing it out for me
or when i press tab with copilot
-# this seems to have been fixed ig, used to have problems with this
pasting with splatmoji works fine
which should be basically the same thing
The only reason I can think of is invalid UTF-8 string.
But how can you paste it from a valid Unicode, I have no idea.
Maybe tinymist doesn't support some range of Unicode code points?
[ERROR][2025-02-04 10:59:35] .../vim/lsp/rpc.lua:770 "rpc" "/home/tijme/.local/share/nvim/mason/bin/tinymist" "stderr" "thread 'main' panicked at crates/tinymist/src/server.rs:976:26:\ninvalid range\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n"
Check the pasting implementation
splatmoji:
config['history_length']=5
config['paste_command']='xdotool key ctrl+v'
config['rofi_command']="rofi -dmenu -p '' -i -monitor -2"
config['xdotool_command']='xdotool sleep 0.2 type --delay 100'
config['xsel_command']='xsel -b -i'
Looks like wtype
I guess some wayland stuff.
fr
Compiling in paged mode with an HTML featured library is fine. The feature flag is separate from the target configuration.
Hey, just wondering when the preview in browser for Zed is supposed to be released
It was supposed to be in 0.12.20, but I can only see a 0.12.21 branch
How will this feature work and is there any way to use it in the nightly 0.12.21 branch?
Is there anything similar to VSCode Server on Zed?
the related prs are still in draft.
Ah okay, thanks for the info!
Yes, I do believe so
the pre-rc1 is to test https://github.com/Myriad-Dreamin/tinymist/commit/07a4aac4a8daf23b60b4ad82653afe622a098a8a
@oak quest I should clarify, the picture above is an error message I get any time I try to run the restart server command
Sorry I forgot to response it. It is a known bug reported in last month. I would like to fix it along with an e2e test.
Oh okay, I looked for a bug report on GitHub but couldn't find anything
Some bugs are reported via the group in the chinese community.
How big is the Chinese typst community? Or how many are active? I'm very curious 😊
There are thousands of people in the group, and a small dev group having 19 developers. They talk about typst from time to time, :).
Would it be possible to change the font used for the symbol list?
what's the problem with the current one?
oh wait, this is the tinymist forge
I'm specifically asking about tinymist by the way
I thought you were talking about the docs
I want it to match my math font
yeah, I was confused because the docs do use New CM Math
though I guess you're a Stix Two user?
Does it? I thought it was some other font for a while at least
I use many different ones, but mostly New CM, Stix, Noto or Lete
okay, so apparently it's a fallback list of HK Grotesk, Inter, NewComputerModernMath, Latin Modern Math
most come from New CM Math simply because the first two don't have them
Maybe it would be a good idea to make NCMM the first entry in the list?
yeah maybe, I can't remember whether there was a reason to do it this way
I don't think Latin Modern Math is necessary, since it won't contain anything NCMM doesn't
This is probably why I thought the font was different. There are some weird discrepancies
Is there a way to use a previous version of typst with tinymist?
revert to a previous version of tinymist
Awesome, thanks
just updated today and it seems tinymist no longer provides stack traces for errors in the output panel. Is there a way to enable it?
The output channel is for developoment of tinymist itself, not for users. I deleted it because I think of the diagnostics feature is stable and we not longer need to check it in the log. Is there any reason not checking errors in the Problem panel?
The typst v0.13.0 is available on https://github.com/Myriad-Dreamin/tinymist/pull/1361
Check the GitHub Action to get it soon.
I'll hold on it for a while before releasing the candidate version.
Previously, I could open the preview window for main.typ and edit template.typ while observing real-time changes in main.pdf. However, now when I open the preview for main.typ and then click on template.typ, the name of the preview window remains as main.typ, but the content displayed changes to template.pdf.
Has anyone else experienced this issue or know how to resolve it?
This is a new feature called "browsing preview". I think to get the previous behavior you have to pin your main file, in VS code: ctrl+shift+p and then search for "pin main".
From the roadmap
Browsing mode: if no main file is specified, the preview will be in browsing mode and use the recently focused file as the main.
The problem panel works, thanks. For some reason, I didn't even realize the stack trace was printed there 😅
It's not an error but rather a new feature that has been added.
Thank you.
Some are bugs, some are features. The browsing preview can be opened in another command, but I made it open browsing preview when calling the typst-preview.preview command. The v0.12.22 should fix these bugs.
@oak quest after typst 0.13 update tinymist stopped working for me.
No errors in the log, no preview, but typst compile main.typ does give me errors. I wonder if that's intentional.
that has nothing todo with tinymist then
it‘s just breaking changes in typst itself
u need to fix these errors
there is a section for migrating in the release notes
Previously, tinymist showed me an error where the compilation failed in the log. Right now it doesn't. Is that intentional? How am I supposed to know what is wrong with the document if the error isn't propagated to the user?
Isn't it one of the purposes of the tinymist: notifying about errors in the document if the preview failed? If not then fine. But which extension would be useful for debugging then?
I think there's a misunderstanding of some sorts
Pretty sure that Tinymist is still supposed to show errors
#1260973804637786224 message
Yeah that message explains the misunderstanding
Ok, then the question is how to debug the preview output?
You could read messages again carefully to find the answer by yourself, because ntjess had same problem and solved it. If you still don't find an answer, you could PM me.
Thanks for @marsh lance for clarifying the confusion.
You were right that part of this story was discussed recently. Before posting, I checked the release notes but couldn't find anything related to this update, which is why I decided to ask in this channel whether this is a bug or a new feature.
@oak quest I really appreciate the plugin you've created, and I apologize if my previous message came across as confrontational. I found the troubleshooting suggestions a bit difficult to follow on my own.
Re issue: the problem panel had zero errors, although the typst compile main.py showed plenty. After fixing errors, then compiling successfully, I do not have the issue with tinymist anymore. It could be a fluke or a bug.
I'm experiencing this issue too. It's difficult to debug the compilation error now, while previous versions directly pointed the error location.
If you open the "Problems" panel in VS Code, all errors should be listed there and you can jump to them.
It works. Thanks!!
Thanks for all your hard work! I am facing an error recompiling the same document on the newest tinymist extension.
No errors using typst c for all formats, and no errors using tinymist for pdf export. But live preview is blank for certain documents.
Previewing in browser mode shows this stack trace:
at data:application/was…GRhN2NiOCk=:0xccf41
at data:application/was…GRhN2NiOCk=:0xdd62c
at data:application/was…GRhN2NiOCk=:0xd75a9
at data:application/was…GRhN2NiOCk=:0x36682
at data:application/was…GRhN2NiOCk=:0x8d1f5
at TypstRenderer.manipulate_data ((index):7678:12)
at TypstRendererDriver.manipulateData ((index):4000:26)
at RenderSession.manipulateData ((index):3618:17)
at DebugJumpDocument.processQueue ((index):481:22)
at doUpdate ((index):516:31)
(index):490 viewport-change before initialization
(index):527 parse 0.00 ms, rerender 0.00 ms, total 0.00 ms
Is there any other data I can provide to diagnose the issue? Unfortunately the document is sensitive and an MWE is hard to consolidate.
If I comment out the whole document and slowly introduce new content by moving the commented portion lower and lower, the preview works fine.
Refreshing the browser preview shows this:
panicked at crates\reflexo\src\vector\stream.rs:61:69:
called `Result::unwrap()` on an `Err` value: CheckBytesError(StructCheckError { field_name: "metadata", inner: ValueCheckBytesError(CheckBytes { index: 3, error: InvalidTuple { variant_name: "Item", inner: TupleStructCheckError { field_index: 0, inner: TupleStructCheckError { field_index: 0, inner: ValueCheckBytesError(CheckBytes { index: 121, error: T0(InvalidTuple { variant_name: "Image", inner: TupleStructCheckError { field_index: 0, inner: StructCheckError { field_name: "image", inner: ValueCheckBytesError(StructCheckError { field_name: "data", inner: ContextError(ArchiveError(SubtreePointerOutOfBounds { ptr: 0x12b604, subtree_range: 0x433558..0x433560 })) }) } } }) }) } } } }) })
Stack:
Error
at http://127.0.0.1:64706/:8150:19
at logError (http://127.0.0.1:64706/:6720:14)
at imports.wbg.__wbg_new_abda76e883ba8a5f (http://127.0.0.1:64706/:8149:12)
at data:application/wasm;base64... show more 6.8MB)
This has been fixed on main
Unix (Bash):
curl -sSL https://github.com/hongjr03/tinymist-nightly-installer/releases/latest/download/run.sh | bash
Windows (PowerShell):
iwr https://github.com/hongjr03/tinymist-nightly-installer/releases/latest/download/run.ps1 -UseBasicParsing | iex
That's another problem I experienced as well. Thanks for sharing.
Thanks for the fast fix and update
The feature that allows clicking on a specific part of a .typ file to view the corresponding section in the preview works fine, but at some point, the feature to click on a specific part in the preview to navigate to the corresponding location in the .typ file stopped functioning properly.
Oh, it seems the update has resolved the issue.
Thank you for the quick fix.
This is the best VS Code extension!
@oak quest Thank you so much for continuing to maintain Tinymist! Its become integral to my workflow, and I would like to donate $5 to express my gratitude and support! Is there a place that I can do that?
Thank you for loving it. I have a patreon account: https://www.patreon.com/camiyoru
Neat! I subscribed to it too!
I was too poor to subscribe Typst Pro, but some of my friends recommended me register a creator account to receive sponsoring. Perhaps I can use the money to pay Typst Pro and typst's GitHub Sponsor one day.
I think you could just get a more realistic profile picture. Maybe a real photo or maybe a logo? That would certainly help.
I find it /off topic
Please don't worry about sponsoring us 😊 you are already sponsoring us a lot with all the effort you put into Tinymist and related projects.
We would like to offer you a free Typst Pro subscription as a small thank you for all your effort. If you DM me your account email, we can do that immediately.
Hey, free subscription mean I don't sponsor typst by paying Typst Pro. I think I should accept this. It must be a special honor for me :). The unchanged thing is that I consider sponsoring typst on GitHub.
I enabled the Typst Pro features for your account. :)
I have some good news and bad news.
good news, tinymist will support preview command without arguments (good for helix), and background preview (good for zed)
bad news, to make jump from preview panel to source panel work, tinymist requires the client to implement a customized tinymist/scrollSource notification.
good news, I find lsp 3.16 introduced window/showDocument, and helix seems to support it.
bad news, zed doesn't support window/showDocument.
Summary of newest preview feature:
- [all] will support preview on type (
previewOnType) in all editors. - [all] there will be a button in the preview panel to help jump from source panel to preview panel (
src2preview). But the downside might be you have to touch the button using your mouse, instead of one key stroking. - [helix, emacs] if an editor supports to invoke lsp command, one can preview multiple documents at the same time and
src2previewby command. - [helix, emacs] if an editor supports
window/showDocument, one can further getpreview2srcwork. - For example, zed is known to not support 3 and 4, so zed users can only have
previewOnTypeandsrc2preview.
Hi everyone,
i have difficulties setting up tinymist options in nvim 0.11
I use the following config in .config/nvim/lsp/tinymist.lua
return {
cmd = {"tinymist"},
filetypes = {'typst'},
settings = {
exportPdf = "onSave",
}
}
but the exportPdf options is ignored,
I triend wrapping the option in
tinymist = {
exportPdf = "onSave"
}
But to no avail Can anyone point me to the problem ? Thanks 🙂
Hey there, thank you for the hard work, I really appreciate it!! 🙂
I don't quite understand why the background feature is supposedly important for Zed - was there no way to start the Preview before?
Also, do you know when those new features will approximately land in nixpkgs and which version number they will be released in?
I am using the typst.zed extension and is seems to just download the latest stable tinymist version from github, so no new version on nixpkgs would be necessary
zed cannot invoke lsp commands, so you can only enable a long living preview server by configuration. then open the preview in browser.
0.13.6 in this weekend. but there might be bugs on its first landing :). I only tested them in my vscode.
you probably have used tinymist cli "tinymist preview" but that lacks a lot of features like preview on typing or bidirectional jumping via click or shortcuts.
there is an issue on tinymist, there might be some bug with onSave feature.
Yup, I indeed did
Looking forward to it! :)
I bet you will love a coverage runner for typst. I was hated by a stupid uncovered show rule in my template, so I made a coverage runner tonight.
for vscode there is a builtin coverage visualization support, for other editor I am seeking a good format. lcov is bad because it only supports line coverage. llvm code coverage is good but it might have poor editor support.
emm, but we have tytanic, not sure whether we should PR the coverage support to tytanic, or tytanic will simply use a tinymist crate.
if it's reusable I'd be willing to add it to tytanic
not sure if i want to pull tinymist, since I depend on typst itself and I think tinymist still depends on its own fork right?
where does the coverage currently collect info? when compiling a document?
or does tynimist have its own tests?
the one providing coverage support can only depend on typst itself. I haven't made a good name for it, I called it tinymist-debug.
it wraps a dyn World and runs typst::compile soon.
tinymist-cov?
perhaps, up to you
if it's lean enough i can pull it as a dependency or add it to tytanic directly, feel free to tag me on the PR when you add the crate, my gh is @tingerrr
some ergonomics could be made if I will provide an API for you. I think it could be
fn with_cov(world: &dyn World, exec: impl FnMut(&dyn World) -> Result<()>) -> Result<Coverage> {
todo!()
}
so that you can run multiple tests inside of the exec callback.
It might be excellent enough to be merged in typst-ide..
That might be the best option in the end
Let's make a quick implementation first. I'll try a PR when I feel it good enough.
how exactly does it collect coverage info, since the world impl itself can't really know which code paths are taken can it?
No magic but some code analysis and instrumentation.
I instrument code blocks to collect block coverage. Some additional transformation are applied to context, show. Like show accepts a function, but we might still seek the coverage specific to the rule. I so also change the rule's transform function to collect such coverage.
🥺 You looked at my draft. I haven't tidied them up.
@marsh lance I tried to implement a general instrumentation framework for typst last year, to make some toy typst debugger.
My last try failed in complicated impl. The impl was playing with typst's readonly AST and build a modified syntax node.
Today, to simplify work, I didn't modify the AST but emit code to a string buffer, then I finished it quicker, the coverage branch. Not sure whether it can be better.