vuki656/package-info.nvim

[BUG] Spinner "not included"

pavkam opened this issue · 2 comments

pavkam commented

Issues

  • I have checked existing issues and there are no issues with the same problem.

Plugin Version

  • I am using the latest version of the plugin

Neovim Version

  • I am using the 0.6 neovim version or later

Neovim Version

NVIM v0.9.4

Branch

master

Actual behavior

using require('package-info').get_status() returns the status string in the form of | Doing something. But the spinner char is not prepended.

Expected behavior

Expecting that the spinner char is prepended before the message.

Steps to reproduce

Just call the require('package-info').get_status().

Package info config

  • not relevant

Other information

Looking in lua/package-info/ui/generic/loading-status.lua I don't see any usage of the current_spinner except when it's updated.

I am using lualine and I have added this section to allow the status to be reflected:

{
    function()
        local pi_status = require 'package-info.ui.generic.loading-status'

        vim.defer_fn(function()
            utils.trigger_status_update_event() -- Force update of lualine (helper method in my config)
        end, 100)

        return pi_status.state.current_spinner .. ' ' .. pi_status.get() -- See here that I am prepending the char myself
    end,
    cond = function()
        return require('package-info').get_status() ~= ''
    end,
    color = color 'ShellProgressStatus',
}

Help

No, sorry.

Implementation help

No response

Yeah it used to be included but I removed it since it was buggy and wasn't working properly.

If you can open a PR with a valid solution i'd be happy to accept it. I remember seeing some other plugins that had a progress spinner but forget which ones. Maybe the implementation can be borrowed.

pavkam commented

Actually, I have changed my implementation a bit since I do have a "progress" module in my config which I use extensively with other processes and I've used that instead (to have the same spinner look and feel). Maybe it's worth only to expose a callback to people to tap into and add their own custom code.

If I get some time this weekend I might try to make a PR as well.

Thanks.