supermaven-inc / supermaven-nvim

The official Neovim plugin for Supermaven
https://supermaven.com/
MIT License
279 stars 16 forks source link

Failed to run `config` for supermaven-nvim #64

Closed WilliamWelsh closed 2 weeks ago

WilliamWelsh commented 2 weeks ago

I ran :Lazy sync supermaven-nvim and now this happens everytime I open nvim

Thank you for making this plugin, I love it

Failed to run `config` for supermaven-nvim

...nvim/lazy/supermaven-nvim/lua/supermaven-nvim/logger.lua:13: attempt to call method 'flatten' (a nil value)

# stacktrace:
  - /supermaven-nvim/lua/supermaven-nvim/logger.lua:13 _in_ **join_path**
  - /supermaven-nvim/lua/supermaven-nvim/logger.lua:80 _in_ **get_log_path**
  - /supermaven-nvim/lua/supermaven-nvim/logger.lua:20 _in_ **create_log_file**
  - /supermaven-nvim/lua/supermaven-nvim/logger.lua:68 _in_ **add_entry**
  - /supermaven-nvim/lua/supermaven-nvim/logger.lua:138 _in_ **trace**
  - /supermaven-nvim/lua/supermaven-nvim/api.lua:15 _in_ **start**
  - /supermaven-nvim/lua/supermaven-nvim/init.lua:55 _in_ **setup**
  - ~/.config/nvim/lua/plugins/supermaven.lua:4 _in_ **config**
  - ~/.config/nvim/init.lua:19

My config

return {
    "supermaven-inc/supermaven-nvim",
    config = function()
        require("supermaven-nvim").setup({})
    end,
    enabled = true,
}
AlejandroSuero commented 2 weeks ago

@WilliamWelsh if you could, clone the repo and add this code to ./lua/supermaven-nvim/logger.lua:

The function join_path is checking for vim.fn.stdpath("cache") value, that is what could be getting a nil value.

In my case, this is the result I get when log_level = "off":

not nil /Users/aome/.cache/nvim
not nil supermaven-nvim.log

And this is what I get with the config you provided:

not nil /Users/aome/.cache/nvim
not nil supermaven-nvim.log
not nil /Users/aome/.cache/nvim
not nil supermaven-nvim.log
not nil /Users/aome/.cache/nvim
not nil supermaven-nvim.log
[supermaven-nvim] Starting Supermaven...

I was the one who introduce the logger, so it could help me figure it out, maybe I will need to add a nil check for vim.fn.stdpath("cache") and create it if nil.

Which OS are you having this issue on? (My results are from MacOS 14.5 23F79)

WilliamWelsh commented 2 weeks ago
/Users/william/.local/share/nvim
not nil /Users/william/.cache/nvim
not nil supermaven-nvim.log

I am also on MacOS 14.5 23F79

WilliamWelsh commented 2 weeks ago

Commenting this out fixes it

  if vim.version().minor >= 10 then
    return table.concat(vim.iter({ ... }):flatten():totable(), path_sep):gsub(path_sep .. "+", path_sep)
  end

I'm on NVIM v0.10.0-dev-1988+g1ef60ea65-Homebrew

Maybe it's time for me to update nvim?

AlejandroSuero commented 2 weeks ago

@WilliamWelsh you are using the dev build, but v0.10.0 is now the stable release, maybe your build is from a commit before vim.iter introduction.

Here is my version:

NVIM v0.10.0
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068
WilliamWelsh commented 2 weeks ago

I updated Neovim and it's working now, thank you :D