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

bug: expected table, got nil when LSP is active #269

Closed
3 tasks done
HakonHarnes opened this issue Jan 5, 2024 · 1 comment
Closed
3 tasks done

bug: expected table, got nil when LSP is active #269

HakonHarnes opened this issue Jan 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@HakonHarnes
Copy link

Did you check the docs and existing issues?

  • I have read the docs
  • I have searched the existing issues

Neovim version (nvim -v)

NVIM v0.9.5

Operating system/version

Arch Linux (6.6.9)

Describe the bug

Oil throws the following error when attempting to create/delete files:

E5108: Error executing lua: vim/shared.lua:0: t: expected table, got nil
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'tbl_map'
        .../repro/.repro/plugins/oil.nvim/lua/oil/lsp/workspace.lua:99: in function 'get_matching_paths'
        .../repro/.repro/plugins/oil.nvim/lua/oil/lsp/workspace.lua:255: in function 'will_rename_files'
        ...on/repro/.repro/plugins/oil.nvim/lua/oil/lsp/helpers.lua:73: in function 'will_perform_file_operations'
        ...n/repro/.repro/plugins/oil.nvim/lua/oil/mutator/init.lua:370: in function 'process_actions'
        ...n/repro/.repro/plugins/oil.nvim/lua/oil/mutator/init.lua:527: in function 'cb'
        ...epro/.repro/plugins/oil.nvim/lua/oil/mutator/preview.lua:129: in function 'confirm'
        ...epro/.repro/plugins/oil.nvim/lua/oil/mutator/preview.lua:177: in function <...epro/.repro/plugins/oil.nvim/l
ua/oil/mutator/preview.lua:176>

This only happens if an LSP is active, and it does not happen for all LSPs. The error is thrown when using tsserver and marksman, but not when using texlab. Disabling LSP with :LspStop resolves the issue.

What is the severity of this bug?

blocking (cannot use plugin)

Steps To Reproduce

  1. nvim -u repro.lua index.ts
  2. Let LSP server install and close.
  3. nvim -u repro.lua index.ts
  4. (Observe one client is attached with :LspInfo)
  5. :Oil and attempt to create a new folder

Expected Behavior

Oil should work when the LSP is active.

Directory structure

No response

Repro

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/oil.nvim",
    config = function()
      require("oil").setup({
        -- add any needed settings here
      })
    end,
  },
  -- lsp
  "williamboman/mason.nvim",
  "williamboman/mason-lspconfig.nvim",
  {
    "neovim/nvim-lspconfig",
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

require("mason").setup()
require("mason-lspconfig").setup {
  ensure_installed = { "tsserver" },
}

local lspconfig = require("lspconfig")
lspconfig.tsserver.setup {}

Did you check the bug with a clean config?

  • I have confirmed that the bug reproduces with nvim -u repro.lua using the repro.lua file above.
@HakonHarnes HakonHarnes added the bug Something isn't working label Jan 5, 2024
@stevearc
Copy link
Owner

stevearc commented Jan 7, 2024

Thanks for the report! Should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants