nvim-lua / lsp-status.nvim

Utility functions for getting diagnostic status and progress messages from LSP servers, for use in the Neovim statusline
MIT License
623 stars 42 forks source link

I followed the example setup word by word and even deleted airline but this plugin doesnt seem to update &statusline variable #75

Open ta3pks opened 2 years ago

ta3pks commented 2 years ago
local lsp_status = require "lsp-status"
lsp_status.register_progress()
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
capabilities = vim.tbl_extend('keep', capabilities or {}, lsp_status.capabilities)
require("nvim-lsp-installer").on_server_ready(function(server)
  local status_handler = lsp_status.extensions[server.name] or {setup = function() end}
  local cfg = {
    handlers = status_handler.setup(),
    capabilities = capabilities,
    on_attach = on_attach,
    flags = {
      -- This will be the default in neovim 0.7+
      debounce_text_changes = 150,
    },
  }
  if server.name == "rust_analyzer"  then
    cfg.settings ={ ['rust-analyzer'] = ra_config }
  elseif server.name == "denols" then
    cfg.init_options = {
    lint = true,
  }
  end
  server:setup(cfg)
end)
vim.cmd [[
function! LspStatus() abort
  if luaeval('#vim.lsp.buf_get_clients() > 0')
    return luaeval("require('lsp-status').status()")
  endif

  return ''
endfunction
]]

now if I update statusline manually doing let &statusline = LspStatus() all fine but the plugin doesnt to anything on its own which also defeats the purpose of having a statusline plugin Am I missing something. I followed everything that the readme suggested

NullVoxPopuli commented 2 years ago

I'm having the same issue, except, I do have some output:

Error executing vim.schedule lua callback: ....mount_nvimjm8lVJ/usr/share/nvim/runtime/lua/vim/uri.lua:105: attempt to index local 'uri' (a nil valu
e)
stack traceback:
        ....mount_nvimjm8lVJ/usr/share/nvim/runtime/lua/vim/uri.lua:105: in function 'uri_to_fname'
        ...ack/packer/start/lsp-status.nvim/lua/lsp-status/util.lua:20: in function 'extract_symbols'
        ...tart/lsp-status.nvim/lua/lsp-status/current_function.lua:31: in function 'fn'
        ...ack/packer/start/lsp-status.nvim/lua/lsp-status/util.lua:71: in function 'handler'
        ....mount_nvimjm8lVJ/usr/share/nvim/runtime/lua/vim/lsp.lua:1043: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

:upside_down_face:

donbex commented 1 year ago

@NikosEfthias Since it's not included in your configuration snippet, what is the definition of that on_attach function? I suspect it might not be calling lsp-status's own on_attach.