quarto-dev / quarto-nvim

Quarto mode for Neovim
Other
355 stars 13 forks source link

Error detected while processing BufReadPost Autocommands for "*" while opening `.qmd` file #145

Closed Sami6720 closed 2 months ago

Sami6720 commented 2 months ago

Error seen on Neovim. I am using wsl.

My setup for Quarto in init.lua

{'quarto-dev/quarto-nvim',
    dependencies = {
      'jmbuhr/otter.nvim',
      'nvim-treesitter/nvim-treesitter',
    },
    config = function()
      require('quarto').setup {}
    end,}

The contents of the .qmd file being opened.

---
title: "Quarto with Python"
format: html
---

# Introduction

This is a simple Quarto document that demonstrates how to use Python code within your text. You can write Markdown text and embed Python code chunks that will be executed when you render the document.

## Python Basics

Below is a simple Python code chunk that prints "Hello, World!".

```{python}
# This is a Python code chunk
print("Hello, World!")

The error seen in :messages while opening the .qmd file.

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:24: Error executing lua: /usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:25: BufReadPost Autocommands for "*"..FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[19]..script /home/sami6720/.local/share/nvim/lazy/quarto-nvim/ftplugin/quarto.lua: Vim(runtime):E5113: Error while calling lua chunk: ...al/share/nvim/lazy/otter.nvim/lua/otter/lsp/handlers.lua:26: attempt to index local 'ms' (a nil value)

stack traceback:
...al/share/nvim/lazy/otter.nvim/lua/otter/lsp/handlers.lua:26: in main chunk
[C]: in function 'require'
....local/share/nvim/lazy/otter.nvim/lua/otter/lsp/init.lua:2: in main chunk
[C]: in function 'require'
...720/.local/share/nvim/lazy/otter.nvim/lua/otter/init.lua:7: in main chunk
[C]: in function 'require'
...0/.local/share/nvim/lazy/quarto-nvim/lua/quarto/init.lua:108: in function 'activate'
...0/.local/share/nvim/lazy/quarto-nvim/ftplugin/quarto.lua:7: in main chunk
[C]: in function 'nvim_cmd'
/usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:25: in function </usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:24>
[C]: in function 'nvim_buf_call'
/usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function </usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:10>

stack traceback:
[C]: in function 'nvim_cmd'
/usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:25: in function </usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:24>
[C]: in function 'nvim_buf_call'
/usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function </usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:10>

stack traceback:
[C]: in function 'nvim_buf_call'
/usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function </usr/local/nvim-linux64/share/nvim/runtime/filetype.lua:10>
jmbuhr commented 2 months ago

Thanks for the detailed report. Update your neovim to the latest stable version, v0.10, and the error should go away.

Sami6720 commented 2 months ago

Thanks! Will update here if that doesn't work.

PCesteban commented 1 month ago

Hi @jmbuhr, I got this exact same error:

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:35: Error executing lua: /usr/share/nvim/runtime/filetype.lua:36: BufReadPost Auto
commands for "*"..FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[20]..script /home/estebanpc/.local/share/lunarvim/site/pack/lazy/opt/qu
arto-nvim/ftplugin/quarto.lua: Vim(runtime):E5113: Error while calling lua chunk: ...unarvim/site/pack/lazy/opt/otter.nvim/lua/otter/init.lua:157: In
valid 'group': 'lspconfig'
stack traceback:
        [C]: in function 'nvim_get_autocmds'
        ...unarvim/site/pack/lazy/opt/otter.nvim/lua/otter/init.lua:157: in function 'activate'
        ...arvim/site/pack/lazy/opt/quarto-nvim/lua/quarto/init.lua:108: in function 'activate'
        ...arvim/site/pack/lazy/opt/quarto-nvim/ftplugin/quarto.lua:11: in main chunk
        [C]: in function 'nvim_cmd'
        /usr/share/nvim/runtime/filetype.lua:36: in function </usr/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'nvim_buf_call'
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_cmd'
        /usr/share/nvim/runtime/filetype.lua:36: in function </usr/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'nvim_buf_call'
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_buf_call'
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>
Press ENTER or type command to continue

This is my nvim version:

nvim --version
NVIM v0.10.1
Build type: RelWithDebInfo
LuaJIT 2.1.1725453128
Run "nvim -V1 -v" for more info

I'm using it through lvim.

jmbuhr commented 1 month ago

Try configuring otter.nvim to set_filetype, which does not rely on nvim-lspconfig. See https://github.com/jmbuhr/otter.nvim?tab=readme-ov-file#configure-otter

PCesteban commented 1 month ago

It worked, thank you!! Why could this happen? My config is very minimal since I'm using lvim.

jmbuhr commented 1 month ago

Your config may be, lvim isn't ;) Looks like they roll their own lsp activation autocommands instead of using lspconfig.