salkin-mada / openscad.nvim

openscad plugin for neovim
GNU General Public License v3.0
30 stars 6 forks source link

luasnip support broken? #25

Closed madskjeldgaard closed 1 month ago

madskjeldgaard commented 1 month ago

Maybe luasnip support is broken ? I get this on startup now. Everything else works fine, even the snippets work correctly. hmmm

Error detected while processing BufReadPost Autocommands for "*":                                                                                                  
Error executing lua callback: ...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:35: Error executing lua: ...rew/Cellar/neovim/0.10.0/share/nvim/runtime/f
iletype.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "openscad": Vim(append):Error executing lua callback: ...im/site/pack/packer/start/open
scad.nvim/lua/openscad.lua:179: module 'luasnip.loaders.from_lua' not found:                                                                                       
        no field package.preload['luasnip.loaders.from_lua']                                                                                                       
        no file './luasnip/loaders/from_lua.lua'                                                                                                                   
        no file '/opt/homebrew/share/luajit-2.1/luasnip/loaders/from_lua.lua'                                                                                      
        no file '/usr/local/share/lua/5.1/luasnip/loaders/from_lua.lua'                                                                                            
        no file '/usr/local/share/lua/5.1/luasnip/loaders/from_lua/init.lua'                                                                                       
        no file '/opt/homebrew/share/lua/5.1/luasnip/loaders/from_lua.lua'                                                                                         
        no file '/opt/homebrew/share/lua/5.1/luasnip/loaders/from_lua/init.lua'                                                                                    
        no file '/Users/mads/.cache/nvim/packer_hererocks/2.1.1716656478/share/lua/5.1/luasnip/loaders/from_lua.lua'                                               
        no file '/Users/mads/.cache/nvim/packer_hererocks/2.1.1716656478/share/lua/5.1/luasnip/loaders/from_lua/init.lua'                                          
        no file '/Users/mads/.cache/nvim/packer_hererocks/2.1.1716656478/lib/luarocks/rocks-5.1/luasnip/loaders/from_lua.lua'                                      
        no file '/Users/mads/.cache/nvim/packer_hererocks/2.1.1716656478/lib/luarocks/rocks-5.1/luasnip/loaders/from_lua/init.lua'                                 
        no file './luasnip/loaders/from_lua.so'                                                                                                                    
        no file '/usr/local/lib/lua/5.1/luasnip/loaders/from_lua.so'                                                                                               
        no file '/opt/homebrew/lib/lua/5.1/luasnip/loaders/from_lua.so'                                                                                            
        no file '/usr/local/lib/lua/5.1/loadall.so'                                                                                                                
        no file '/Users/mads/.cache/nvim/packer_hererocks/2.1.1716656478/lib/lua/5.1/luasnip/loaders/from_lua.so'                                                  
        no file './luasnip.so'                                                                                                                                     
        no file '/usr/local/lib/lua/5.1/luasnip.so'                                                                                                                
        no file '/opt/homebrew/lib/lua/5.1/luasnip.so'                                                                                                             
        no file '/usr/local/lib/lua/5.1/loadall.so'                                                                                                                
        no file '/Users/mads/.cache/nvim/packer_hererocks/2.1.1716656478/lib/lua/5.1/luasnip.so'                                                                   
stack traceback:                                                                                                                                                   
        [C]: in function 'require'                                                                                                                                 
        ...im/site/pack/packer/start/openscad.nvim/lua/openscad.lua:179: in function 'load_snippets'                                                               
        ...im/site/pack/packer/start/openscad.nvim/lua/openscad.lua:85: in function 'load'                                                                         
        ...im/site/pack/packer/start/openscad.nvim/lua/openscad.lua:45: in function <...im/site/pack/packer/start/openscad.nvim/lua/openscad.lua:44>               
        [C]: in function 'nvim_cmd'                                                                                                                                
        ...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:36: in function <...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:35>               
        [C]: in function 'nvim_buf_call'                                                                                                                           
        ...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:35: in function <...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:10>               
stack traceback:                                                                                                                                                   
        [C]: in function 'nvim_cmd'                                                                                                                                
        ...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:36: in function <...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:35>               
        [C]: in function 'nvim_buf_call'                                                                                                                           
        ...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:35: in function <...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:10>               
stack traceback:                                                                                                                                                   
        [C]: in function 'nvim_buf_call'                                                                                                                           
        ...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:35: in function <...rew/Cellar/neovim/0.10.0/share/nvim/runtime/filetype.lua:10>        
salkin-mada commented 1 month ago

Not broken here but I am also on the dev branch. Could you test @madskjeldgaard I started using this some time ago for nvim 0.10. And havent merged because some things maybe is >= 0.10 only..

madskjeldgaard commented 1 month ago

Ah I found the issue.

I lazyloaded luasnip using the event InsertEnter and Openscad.nvim calls the from_lua loader from luasnip at startup so these two ideas clash. I removed the lazy loading by this event and now it works.

salkin-mada commented 1 month ago

We could maybe change the code so it allows for lazy loading like with Packer. Or really everything should ideally be lazy on openscad.nvims end