#LSP Typst setup for Neovim

24 messages Β· Page 1 of 1 (latest)

marsh badge
#

After countless hours trying to create a LSP setup, it seems impossible, even though I have very good experience with Neovim (for example, I have done my own "distro" from the ground up). The problem is that both typst-lsp (which I know is 6-7 months outdated) and tinymist always crash while executing it no matter what I do.
My Neovim dotfiles: https://codeberg.org/playa4l/dot

pallid trench
marsh badge
#

Notice I'm trying to setup LSP and preview

#

Ok, I want to use zathura as previewer

#

LSP Typst setup for Neovim

pallid trench
#

well, I mean have you tried that as a starting point just to get Tinymist working first

#

and see if you can isolate where the crashes are coming from

marsh badge
#

the crashes come from the binary

#

let me a sec and ill show u

pallid trench
#

I don't use weird editors so this is me just making suggestions of things I've seen working for other people

#

I would have no feedback on specific editor problems

marsh badge
#

Here you can see tinymist spits some critical errors which make it exit (with 2 as exit code if I'm not mistaken).

#

The log is from the last editing session

hard grail
#

Jeez, what's with that log? I'm also using a similar setup as you; i'll have a closer look later

#

Or have you already solved your problem?

#

Also: When i want to preview in zathura i usually just typst w main.typ; zathura main.pdf & Since i don't believe zathura supports scrolling and jump to position like typst-preview does in the browser

marsh badge
#

Yeah, zathura doesn't support jump to position (as far as i know)

#

@hard grail

#

To preview files i have this lua function assigned to the Fr binding:

function TypstP() vim.cmd[[sil !sh -c 'zathura $(basename % .typ).pdf &']] end
#

I just improved it:
function TypstP() vim.cmd('sil !exec zathura $(basename % .typ).pdf &') end

hard grail
#

Nice! Running zathura in the background works well, because it automatically reloads a file if it changed. I think i'll copy this πŸ˜„

#

As to your specific error:

[ERROR][2024-10-29 19:07:24] .../vim/lsp/rpc.lua:770"rpc""/usr/bin/tinymist""stderr""error: expected pattern\n  β”Œβ”€ "
[ERROR][2024-10-29 19:07:24] .../vim/lsp/rpc.lua:770"rpc""/usr/bin/tinymist""stderr""/home/playa4l/tem.typ:1:4\n  β”‚\n1 β”‚ #let \n  β”‚     ^\n\n"

seems relevant to me, but i can't figure out what exactly the output means bvecause i don't know the file referenced there. Maybe it's just the output of tinymist getting printed weirdly by the lsp log? Because the complete log looks nested as if it were actually two separate logs

#

There are more lines hinting to some syntax errors in your file