galaxyline.nvim icon indicating copy to clipboard operation
galaxyline.nvim copied to clipboard

`lspclient.get_lsp_client` only triggers with new buffers in condition when `:w` is invoked first

Open sam20908 opened this issue 3 years ago • 1 comments

This causes trouble when I want to have components to render (e.g. diagnostic information) with file that has LSP support. It isn't very convenient knowing I have to :w at least once before the condition triggers.

I have setup the condition as follows:

condition = function()
            return not string.match(lspclient.get_lsp_client(), 'No Active Lsp')
        end,

sam20908 avatar Apr 16 '21 00:04 sam20908

I also faced this exact issue when I tried to load diagnostics by my own instead of using the provider for diagnostics (because of weird space after the count the default one provides). But it seems like a component is loaded only once, only the update of values is dynamic (though I am not sure).

So, for diagnostics if there is any error while opening the file the component will load (as this is the first time load) but it will not go off even if there is no error.

One hack is to always load the component but nullify its effect. This can be done by not using separators as they always add a space which we don't want. Instead use those spaces before the icon itself. Here is my config for details.

Tinku10 avatar Jul 17 '21 12:07 Tinku10