Julian / lean.nvim

neovim support for the Lean theorem prover
MIT License
255 stars 25 forks source link

fix: lazy require other dependencies #294

Closed ClSlaid closed 1 year ago

ClSlaid commented 1 year ago

I'm using lazy.nvim and I've just began learning lean. However, even when I'm editing projects in other languages, some annoying errors popped out from this plugin.

Failed to run `config` for lspsaga.nvim                                                                                                                                                       
/home/cl/.config/nvim/lua/modules/utils/init.lua:39: attempt to index field 'colors_name' (a nil value)                                                                                       
# stacktrace:                                                                                                                                                                                 
  - ~/.config/nvim/lua/modules/utils/init.lua:39 _in_ **get_palette**                                                                                                                         
  - ~/.config/nvim/lua/modules/utils/init.lua:150 _in_ **gen_lspkind_hl**                                                                                                                     
  - ~/.config/nvim/lua/modules/configs/completion/lspsaga.lua:2 _in_ **config**                                                                                                               
  - /lean.nvim/ftdetect/lean.lua:5                                                                                                                                                            
  - vim/_editor.lua:0 _in_ **cmd**                                                                                                                                                            
  - ~/.config/nvim/lua/core/pack.lua:128 _in_ **load_lazy**                                                                                                                                   
  - ~/.config/nvim/lua/core/pack.lua:131                                                                                                                                                      
  - ~/.config/nvim/lua/core/init.lua:166 _in_ **load_core**                                                                                                                                   
  - ~/.config/nvim/lua/core/init.lua:174                                                                                                                                                      
  - ~/.config/nvim/init.lua:2  

As is mentioned in its README, Lazy.nvim will automatically run init for all plugins, regardless of their laziness (by lazyness I mean lazy-loading). And unfortunately, the plugin has required other plugins in its ftdetect script.

It's actually an easy one-line fix, the function to call will be lazily loaded. The file is reformatted.

rish987 commented 1 year ago

Ah, thanks! I would like to transition to lazy.nvim myself in the near future. Feel free to add your config to the wiki if you find the time (which reminds me that I also need to add my packer config).

ClSlaid commented 1 year ago

My NeoVim config is based on nvimdots, it's actively developed and willing to adopt new features.