lsp-status.nvim icon indicating copy to clipboard operation
lsp-status.nvim copied to clipboard

table index is nil in util.lua

Open gabysbrain opened this issue 3 years ago • 6 comments

I tried setting up lsp-status according to the example config in the readme but once my lsp loads I get an error (also see https://github.com/nvim-lua/lsp-status.nvim/issues/9#issuecomment-913260530 who seems to be having the same issue):

Error executing vim.schedule lua callback: .../start/lsp-status.nvim/lua/lsp-status/util.lua:62: table index is nil

My lsp/lsp-status config is here. It's basically the lsp-status config from the readme but integrated into the default config from lspconfig.

-- setup lsp status
local lsp_status = require('lsp-status')
lsp_status.config({
})
lsp_status.register_progress()

local nvim_lsp = require('lspconfig')

-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
  local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
  local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end

  -- Enable completion triggered by <c-x><c-o>
  buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')

-- key bindings

-- lsp_status
  lsp_status.on_attach(client)
end

-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'julials' }
for _, lsp in ipairs(servers) do
  nvim_lsp[lsp].setup {
    on_attach = on_attach,
    capabilities = lsp_status.capabilities,
    flags = {
      debounce_text_changes = 150,
    }
  }
end

From looking at the lsp-status source my guess is that id is never set but I can't figure out why.

gabysbrain avatar Oct 31 '21 19:10 gabysbrain

I have the same issue with a similar config, have you found a fix yet?

scrouthtv avatar Dec 03 '21 08:12 scrouthtv

Nope, I can't use this plugin until it's fixed unfortunuately.

On Fri, Dec 03, 2021 at 12:14:05AM -0800, scrouthtv wrote:

I have the same issue with a similar config, have you found a fix yet?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.*

gabysbrain avatar Dec 10 '21 15:12 gabysbrain

Sorry for neglecting to get to this for so long. I've been unable to reproduce this issue with your config - do you see this error with servers other than JuliaLS, or just that server?

wbthomason avatar Dec 10 '21 22:12 wbthomason

Also, if you're willing to help debug this, could you please try putting print calls with unique messages at the calls to util.ensure_init in lsp_status.messaging.register_client and lsp_status.messaging.progress_callback, so that we can narrow down where the nil value is occurring?

wbthomason avatar Dec 10 '21 22:12 wbthomason

I'm also not able to reproduce this issue anymore. I tried some things in my config, I guess the order in which plugins are loaded is relevant. The plugin is currently working for me.

scrouthtv avatar Dec 11 '21 09:12 scrouthtv

yes, it's working for me too now! lightline doesn't seem to support animations but that's fine.

gabysbrain avatar Dec 12 '21 15:12 gabysbrain