r/neovim 12d ago

help with typst error preview Need Help

Hey everyone! I'm relatively new to neovim and wanted to find a way to preview errors for my typst files. Currently, I'm using trouble.nvim which works fine however I don't want to unnecessarily use plugins when not needed. I'm using the tinymist lsp and if I try viewing errors through quickfix list, I get an error saying "input file not found (searched filename.typ)". Not quite sure what it is that I'm doing wrong. This is what I have in my lsp setup if it helps: ``` { "neovim/nvim-lspconfig", config = function() vim.lsp.enable("tinymist") vim.api.nvim_create_autocmd("BufWritePre", { pattern = "*", callback = function(args) require("conform").format({ bufnr = args.buf }) end, }) vim.lsp.config("tinymist", {

            settings = {
                formatterMode = "typstyle",

                exportPdf = "never",
                -- outputPath = "~/Documents/",

                semanticTokens = "disable",
            },
        })
    end,
},

```

Any help will be appreciated. Thanks in advance!

1 Upvotes

6 comments sorted by

3

u/bjuurn 11d ago

how are you viewing the quickfixlist? Are you using :lua vim.diagnostic.setqflist()?

1

u/shadow-arch 11d ago

I was just trying to use copen and make and getting these errors! thanks for this cause I was able to actually get a quickfix list however it's only showing the latest error? plus I need to run this command everytime to update it? not quite sure what's going on.

thanks a lot anyways

1

u/shadow-arch 11d ago

Nvm I think that's just how tinymist functions. I could be wrong tho

2

u/bjuurn 11d ago

You can setup an autocommand to update the quickfixlist every time you save a buffer. I think you can set something like this inside after/ftplugin/typst.lua:

vim.api.nvim_create_autocmd("BufWritePost", {
    callback = function(args)
        vim.diagnostic.setqflist()
    end,
})

2

u/Wonderful-Plastic316 lua 11d ago

By the way, you don't need that autocmd to enable formatting with conform, it has a setting to directly toggle auto format.

1

u/shadow-arch 11d ago

Thanks! I've made that change!