Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'lsp-progress' not found #131

Closed
alextrastero opened this issue Apr 1, 2024 · 7 comments · Fixed by #133
Closed

module 'lsp-progress' not found #131

alextrastero opened this issue Apr 1, 2024 · 7 comments · Fixed by #133

Comments

@alextrastero
Copy link

NVIM v0.9.5

Hi, plugin is installed and configured via lazy.nvim, when I start I get the following:

/foo/.config/nvim/lua/plugins/lualine.lua:33: module 'lsp-progress' not found:                                
^Ino field package.preload['lsp-progress']                                                                            
cache_loader: module lsp-progress not found                                                                           
cache_loader_lib: module lsp-progress not found                                                                       
^Ino file './lsp-progress.lua'                        

minimal setup

return {
  'nvim-lualine/lualine.nvim',
  event = { "VimEnter" },
  dependencies = {
    'linrongbin16/lsp-progress.nvim',
  },
  opts = {
    sections = {
      lualine_c = {
        require('lsp-progress').progress
      },
    },
  }
}

Thanks in advance!

@linrongbin16
Copy link
Owner

hi @alextrastero ,

try this?

return {
  'nvim-lualine/lualine.nvim',
  event = { "VimEnter" },
  dependencies = {
    {
      'linrongbin16/lsp-progress.nvim',
      config = function() require ('lsp-progress').setup() end,
    }
  },
  opts = {
    sections = {
      lualine_c = {
        require('lsp-progress').progress
      },
    },
  }
}

@alextrastero
Copy link
Author

Aha! I see, I was expecting the setup to be called automatically for some reason, thanks!

@alextrastero
Copy link
Author

Strange it's still happening...

Failed to load `plugins.lualine`                                                                                                                                                                                                              
                                                                                                                                                                                                                                              
.config/nvim/lua/plugins/lualine.lua:33: module 'lsp-progress' not found:                                                                                                                                                        
^Ino field package.preload['lsp-progress']                                                                                                                                                                                                    
cache_loader: module lsp-progress not found                                                                                                                                                                                                   
cache_loader_lib: module lsp-progress not found                                                                                                                                                                                               
^Ino file './lsp-progress.lua'                                                                                                                                                                                                                
^Ino file '/__w/neovim/neovim/.deps/usr/share/luajit-2.1/lsp-progress.lua'                                                                                                                                                                    
^Ino file '/usr/local/share/lua/5.1/lsp-progress.lua'                                                                                                                                                                                         
^Ino file '/usr/local/share/lua/5.1/lsp-progress/init.lua'                                                                                                                                                                                    
^Ino file '/__w/neovim/neovim/.deps/usr/share/lua/5.1/lsp-progress.lua'                                                                                                                                                                       
^Ino file '/__w/neovim/neovim/.deps/usr/share/lua/5.1/lsp-progress/init.lua'                                                                                                                                                                  
^Ino file './lsp-progress.so'                                                                                                                                                                                                                 
^Ino file '/usr/local/lib/lua/5.1/lsp-progress.so'                                                                                                                                                                                            
^Ino file '/__w/neovim/neovim/.deps/usr/lib/lua/5.1/lsp-progress.so'                                                                                                                                                                          
^Ino file '/usr/local/lib/lua/5.1/loadall.so'                                                                                                                                                                                                 
                                                                                                                                                                                                                                              
# stacktrace:                                                                                                                                                                                                                                 
  - ~/.config/nvim/lua/plugins/lualine.lua:33                                                                                                                                                                                                 
  - init.lua:18                                                                                                                                                                                                                               
Press ENTER or type command to continue

My full config

return {
  'nvim-lualine/lualine.nvim',
  event = { "VimEnter" },
  dependencies = {
    'linrongbin16/lsp-progress.nvim',
    config = function() require('lsp-progress').setup() end
  },
  opts = {
    options = {
      component_separators = { left = '|', right = '|' },
      globalstatus = true,
    },
    sections = {
      lualine_a = {
        { 'mode', fmt = function(str) return str:sub(1, 1) end }
      },
      lualine_b = {
        { 'branch', icons_enabled = false }
      },
      lualine_c = {
        require('lsp-progress').progress,
      },
    },
    tabline = {
      lualine_a = {
        'buffers',
      },
    },
  }
}

@alextrastero alextrastero reopened this Apr 2, 2024
@linrongbin16
Copy link
Owner

linrongbin16 commented Apr 2, 2024

hi @alextrastero ,

You are right, I tried this minimal init.lua: https://github.com/linrongbin16/lsp-progress.nvim/pull/133/files#diff-7bb74865bd40076b8da8648f3a65195d7d4728c862077e033d111b4bdf47c790.

And it reproduce the same error as yours. That's strange!

I found that, using this minimal init.lua, I even don't have the :Lazy command. I don't think the lazy plugin manager actually works here.

Can you check if your lazy.nvim is working?


Update: I found the reason, the error is thrown from here:

require("lsp-progress").progress,

It looks like we cannot directly set it here:

require("lualine").setup({
    sections = {
        lualine_c = {
            require("lsp-progress").progress,
        },
    }
})

This is actually wrong.

Can you try to wrap it with a function() end ?

For example:

    lualine_c = {
        function()
            return require("lsp-progress").progress()
        end,
    },

@linrongbin16
Copy link
Owner

Thanks to your report! actually I remember some one has faced this issue long time ago, but at that time I didn't notice it.

@alextrastero
Copy link
Author

Yup, wrapping in a function worked for me, thanks!

@linrongbin16
Copy link
Owner

I also submit #133 to fix the readme installation section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants