nvimdev / dashboard-nvim

vim dashboard
MIT License
2.3k stars 187 forks source link

[Doom]: error on `:Dashboard` command when footer is a function #334

Closed rebelot closed 1 year ago

rebelot commented 1 year ago

Describe the bug On Doom theme, setting the footer to a function will cause the plugin to issue an error only on :Dashboard command, startup is fine.

require("dashboard").setup({
    theme = "doom",
    config = {
        header = {...},
        center = {...},
        footer = function()
            return {
                "type  :help<Enter>  or  <F1>  for on-line help",
                "Startup time: " .. require"lazy".stats().startuptime .. " ms"
            }
        end,
    },
})
Error executing vim.schedule lua callback: ...l/share/nvim/lazy/dashboard-nvim/lua/dashboard/utils.lua:42: tbl: expected table, got string                                                                                                  
stack traceback:                                                                                                                                                                                                                            
        [C]: in function 'error'                                                                                                                                                                                                            
        vim/shared.lua: in function 'validate'                                                                                                                                                                                              
        ...l/share/nvim/lazy/dashboard-nvim/lua/dashboard/utils.lua:42: in function 'center_align'                                                                                                                                          
        ...re/nvim/lazy/dashboard-nvim/lua/dashboard/theme/doom.lua:158: in function 'generate_footer'                                                                                                                                      
        ...re/nvim/lazy/dashboard-nvim/lua/dashboard/theme/doom.lua:168: in function <...re/nvim/lazy/dashboard-nvim/lua/dashboard/theme/doom.lua:165>                                                                                      
        ...al/share/nvim/lazy/dashboard-nvim/lua/dashboard/init.lua:214: in function 'load_theme'                                                                                                                                           
        ...al/share/nvim/lazy/dashboard-nvim/lua/dashboard/init.lua:271: in function 'callback'                                                                                                                                             
        ...al/share/nvim/lazy/dashboard-nvim/lua/dashboard/init.lua:192: in function ''                                                                                                                                                     
        vim/_editor.lua: in function <vim/_editor.lua:0>                                                                                                                                                                                    
rebelot commented 1 year ago

error it still there for me

Error executing vim.schedule lua callback: ...l/share/nvim/lazy/dashboard-nvim/lua/dashboard/utils.lua:42: tbl: expected table, got string                                                                                                  
stack traceback:                                                                                                                                                                                                                            
        [C]: in function 'error'                                                                                                                                                                                                            
        vim/shared.lua: in function 'validate'                                                                                                                                                                                              
        ...l/share/nvim/lazy/dashboard-nvim/lua/dashboard/utils.lua:42: in function 'center_align'                                                                                                                                          
        ...re/nvim/lazy/dashboard-nvim/lua/dashboard/theme/doom.lua:159: in function 'generate_footer'                                                                                                                                      
        ...re/nvim/lazy/dashboard-nvim/lua/dashboard/theme/doom.lua:169: in function <...re/nvim/lazy/dashboard-nvim/lua/dashboard/theme/doom.lua:166>                                                                                      
        ...al/share/nvim/lazy/dashboard-nvim/lua/dashboard/init.lua:214: in function 'load_theme'                                                                                                                                           
        ...al/share/nvim/lazy/dashboard-nvim/lua/dashboard/init.lua:271: in function 'callback'                                                                                                                                             
        ...al/share/nvim/lazy/dashboard-nvim/lua/dashboard/init.lua:192: in function ''                                                                                                                                                     
        vim/_editor.lua: in function <vim/_editor.lua:0>                   
glepnir commented 1 year ago

test with min config this is work image

rebelot commented 1 year ago

I tried with minimal config, the problem occurs on :Dashboard command only after opening a new buffer.

glepnir commented 1 year ago

fixed.

rebelot commented 1 year ago

works perfectly thanks :)

glepnir commented 1 year ago

The current configuration is a bit of a mess and the current dashboard is not perfect. I want to do a complete refactoring in the next version. Implement the public interface and theme implementation specification. This way anyone can implement a theme.

rebelot commented 1 year ago

The current configuration is a bit of a mess and the current dashboard is not perfect. I want to do a complete refactoring in the next version. Implement the public interface and theme implementation specification. This way anyone can implement a theme.

That sounds great :)