Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table index is nil in util.lua #69

Open
gabysbrain opened this issue Oct 31, 2021 · 6 comments
Open

table index is nil in util.lua #69

gabysbrain opened this issue Oct 31, 2021 · 6 comments

Comments

@gabysbrain
Copy link

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 #9 (comment) 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.

@scrouthtv
Copy link

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

@gabysbrain
Copy link
Author

gabysbrain commented Dec 10, 2021 via email

@wbthomason
Copy link
Collaborator

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
Copy link
Collaborator

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?

@scrouthtv
Copy link

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.

@gabysbrain
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants