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

A missing language server gives a poor error message #737

Closed
llimllib opened this issue Feb 17, 2021 · 4 comments
Closed

A missing language server gives a poor error message #737

llimllib opened this issue Feb 17, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@llimllib
Copy link
Contributor

llimllib commented Feb 17, 2021

  • nvim --version:
NVIM v0.5.0-dev+78f0f00cd Build type: Release LuaJIT 2.1.0-beta3 Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210125-25323-1inurn2/build/config -I/tmp/neovim-20210125-25323-1inurn2/src -I/usr/local/include -I/tmp/neovim-20210125-25323-1inurn2/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20210125-25323-1inurn2/build/src/nvim/auto -I/tmp/neovim-20210125-25323-1inurn2/build/include Compiled by llimllib@threebody

Features: +acl +iconv +tui
See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-78f0f00/share/nvim"

Run :checkhealth for more info

  • nvim-lsp version(commit hash): 0c8f28f
  • What language server (If the problem is related to a specific language server): I believe this is not related to a particular language server
  • Is the problem isolated to a particular language server: I don't believe so
  • Operating system/version: Mac OS 11.2

How to reproduce the problem from neovim startup

  1. Do not have diagnostic-languageserver installed
  2. Foolishly add lua config for it that you copied from somewhere else
-- to install run: -- yarn global add diagnostic-languageserver lsp.diagnosticls.setup({ on_attach = on_attach, filetypes={ "markdown", "javascript", "typescript", "javascriptreact", "typescriptreact" }, init_options = { linters = { eslint = { sourceName = "eslint", command = "eslint_d", rootPatterns = { ".git" }, args = { "--stdin", "--stdin-filename", "%filepath", "--format", "json" }, debounce = 100, parseJson = { errorsRoot = "[0].messages", line = "line", column = "column", endLine = "endLine", endColumn = "endColumn", message = "${message} [${ruleId}]", security = "severity" }, securities = { [2] = "error", [1] = "warning", }, }, markdownlint = { sourceName = "markdownlint", command = "markdownlint", args = { "--stdin" }, isStderr = true, debounce = 100, offsetLine = 0, offsetColumn = 0, formatLines = 1, formatPattern = { "^.*?:\\s+(\\d+):\\s+(.*)(\\r|\\n)*$", { line = 1, column = -1, message = 2 } } } }, filetypes = { markdown = "markdownlint", javascript = "eslint", typescript = "eslint", javascriptreact = "eslint", typescriptreact = "eslint", } } })
  1. Run neovim on one of the configured filetypes
  2. get a confusing error:
Error detected while processing FileType Autocommands for "markdown":
E5108: Error executing lua ...share/nvim/plugged/nvim-lspconfig/lua/lspconfig/util.lua:248: attempt to index field 'log' (a nil value)
Press ENTER or type command to continue
  1. install dynamic-languageserver and note that you no longer get no errors

Actual behaviour

Get an error attempt to index field 'log'

Expected behaviour

Get an error that indicates there's a problem with the diagnostic-languageserver not being present

(I tried to repro this error with your minimal_init.lua, but got stuck at:

E5113: Error while calling lua chunk: minimal_init.lua:10: Vim(packadd):E919: Directory not found in 'packpath': "pack/*/opt/packer.nvim"

)

@llimllib llimllib added the bug Something isn't working label Feb 17, 2021
@lithammer
Copy link
Collaborator

Too old Neovim version I suspect. You need neovim/neovim#13843 which was merged some 9 days ago.

@mjlbach
Copy link
Contributor

mjlbach commented Feb 17, 2021

Yep, update your nightly and the problem should be gone.

@mjlbach mjlbach closed this as completed Feb 17, 2021
@llimllib
Copy link
Contributor Author

Confirmed, apologies for the specious report.

@mjlbach
Copy link
Contributor

mjlbach commented Feb 17, 2021

No worries, I usually only merge changes that require an updated nightly after ~1 week once the feature hits core. This won't be an issue once 0.5 is cut (no idea when that will be though).

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

3 participants