diff options
| author | Rohit Patil <[email protected]> | 2021-07-03 20:57:00 +0530 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-03 11:27:00 -0400 | 
| commit | f7132edd547f4d1bc553a106262d88f46243900d (patch) | |
| tree | a0c4ab2adeb0ce8afb143c74ee7932145264d38d | |
| parent | ca057a2823677c60819e8aa801d92da770b6c4ae (diff) | |
Show all LSP Clients attached to the Buffer in GalaxyLine Bar (#611)
* [UPDATE] change efm filetypes to only python
* [UPDATE] shows all LSP Clients in galaxyline
| -rw-r--r-- | ftplugin/python.lua | 2 | ||||
| -rw-r--r-- | lua/lv-galaxyline/init.lua | 31 | 
2 files changed, 31 insertions, 2 deletions
| diff --git a/ftplugin/python.lua b/ftplugin/python.lua index 7ae0d6fd..23e54880 100644 --- a/ftplugin/python.lua +++ b/ftplugin/python.lua @@ -26,7 +26,7 @@ require"lspconfig".efm.setup {      -- init_options = {initializationOptions},      cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},      init_options = {documentFormatting = true, codeAction = false}, -    filetypes = {"lua", "python", "javascriptreact", "javascript", "typescript","typescriptreact","sh", "html", "css", "yaml", "markdown", "vue"}, +    filetypes = {"python"},      settings = {          rootMarkers = {".git/", "requirements.txt"},          languages = { diff --git a/lua/lv-galaxyline/init.lua b/lua/lv-galaxyline/init.lua index a7821932..6da044c8 100644 --- a/lua/lv-galaxyline/init.lua +++ b/lua/lv-galaxyline/init.lua @@ -178,9 +178,38 @@ table.insert(gls.right, {      }  }) +local get_lsp_client = function (msg) +    msg = msg or "No Active LSP Client" +    local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') +    local clients = vim.lsp.get_active_clients() +    if next(clients) == nil then +        return msg +    end +    local lsps = "" +    for _,client in ipairs(clients) do +        local filetypes = client.config.filetypes +        if filetypes and vim.fn.index(filetypes, buf_ft) ~=1 then +            print(client.name) +            if lsps == "" then +                print("first", lsps) +                lsps = client.name +            else +                lsps = lsps .. ", " .. client.name +                print("more", lsps) +            end +        end +    end +    if lsps == "" then +        return msg +    else +        return lsps +    end +end + +  table.insert(gls.right, {      ShowLspClient = { -        provider = 'GetLspClient', +        provider = get_lsp_client,          condition = function()              local tbl = {['dashboard'] = true, [' '] = true}              if tbl[vim.bo.filetype] then return false end | 
