vuki656 / package-info.nvim

✍️ All the npm/yarn/pnpm commands I don't want to type
GNU General Public License v3.0
482 stars 28 forks source link

[BUG] Spinner "not included" #147

Open pavkam opened 10 months ago

pavkam commented 10 months ago

Issues

Plugin Version

Neovim Version

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

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

vuki656 commented 9 months ago

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 9 months ago

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.