quick-lint / quick-lint-js

quick-lint-js finds bugs in JavaScript programs
https://quick-lint-js.com
GNU General Public License v3.0
1.55k stars 192 forks source link

Adding quick-lint-js to my LazyVim config causes vim to stop working. #1195

Open tacolegs2004 opened 10 months ago

tacolegs2004 commented 10 months ago

I tried to add the plugin to my LazyVim config. However, once I added the following code to my config through a file called 'quick-lint-js.lua', whenever I ran 'nvim' in my terminal, Neovim simply wouldn't open.

return {
    'quick-lint/quick-lint-js', 
    rtp = 'plugin/vim/quick-lint-js.vim', 
    tag = '3.1.0', 
    opt = true
}

EDIT: I converted the packer.nvim snippet from here to a LazyVim return.

strager commented 9 months ago

The reason that LazyVim is quitting on start is that lazy.nvim is running quick-lint-js's test suite. (The test suite script exits when tests pass.)

Why does lazy.nvim run the test suite? Because lazy.nvim isn't respecting the rtp setting (which doesn't seem to exist; lazy.nvim always adds the whole Git repo to runtimepath) and because lazy.nvim recursively executes .vim files in quick-lint-js's plugin directory.

lazy.nvim's config hook runs after executing the .vim files, so we can't stop this behavior using a config hook. The cond hook does happen early enough, though, so we can exploit it to get lazy.nvim to not totally explode:

return {
  "quick-lint/quick-lint-js",
  tag = "3.1.0",
  cond = function(plugin)
    -- TODO(strager): Don't make this happen multiple times.
    plugin.dir = plugin.dir .. "/plugin/vim/quick-lint-js.vim"
    return true
  end
}

But this doesn't make quick-lint-js work yet. More investigation is needed.

strager commented 9 months ago

Here's a partially-working config for LazyVim:

return {
  "quick-lint/quick-lint-js",
  tag = "3.1.0",
  cond = function(plugin)
    -- TODO(strager): Don't make this happen multiple times.
    plugin.dir = plugin.dir .. "/plugin/vim/quick-lint-js.vim"
    return true
  end,
  config = function(_plugin)
    require("lspconfig/quick_lint_js").setup {}
  end,
}
strager commented 9 months ago

I filed an issue with lazy.nvim. https://github.com/folke/lazy.nvim/issues/1319