-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
fix(docs): Reduce scope of lspconfig example to quick-lint-js #1072
Conversation
CLA Assistant Lite bot Thank you for your contribution! Like many free software projects, you must sign our Contributor License Agreement before we can accept your contribution. EDIT: All contributors have signed quick-lint-js' Contributor License Agreement (CLA-v1.md). |
I have read and hereby agree to quick-lint-js' Contributor License Agreement (CLA-v1.md). |
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with( | ||
vim.lsp.diagnostic.on_publish_diagnostics, { | ||
update_in_insert = true, | ||
local nvim_lsp = require('lspconfig') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must fix: When I tried this, I got the following error:
Error detected while processing /nix/store/01pnpqhja7iinp0xl74sygvsiixcr2i6-init.vim:
line 16:
E5108: Error executing lua [string ":lua"]:6: attempt to index global 'nvm_lsp' (a nil value)
stack traceback:
[string ":lua"]:6: in main chunk
Here's the vimrc (Nix template; ${packages.quick-lint-js}
is replaced with a full path):
lua << EOF
require('lspconfig/quick_lint_js').setup {
cmd = {"${packages.quick-lint-js}/bin/quick-lint-js", "--lsp-server"},
}
local nvim_lsp = require('lspconfig')
nvm_lsp.quick_lint_js.setup {
handlers = {
['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true
}
)
}
}
EOF
Did I do something wrong?
This vimrc works without issues:
lua << EOF
require('lspconfig/quick_lint_js').setup {
cmd = {"${packages.quick-lint-js}/bin/quick-lint-js", "--lsp-server"},
handlers = {
['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true
}
)
},
}
EOF
I think we should put the setup code inside the existing setup block instead of making a separate setup block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that was my intention and this is consistent with the documentation below this section which shows new options but with the call to the setup call. I've added a new commit which should be more consistent and edited the sentence before to further clarify, let me know what you think. I'd be happy to make more changes if needed. The section below this for example covers some specific examples of options available to all language servers via the lspconfig vim API, so maybe we could move this configuration to its own tagged section, and/or link to the lspconfig docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a new commit which should be more consistent and edited the sentence before to further clarify, let me know what you think.
New version looks great!
The section below this for example covers some specific examples of options available to all language servers via the lspconfig vim API, so maybe we could move this configuration to its own tagged section, and/or link to the lspconfig docs.
Some config options should be set by our plugin and shouldn't normally be customized by the user (for example name, root_dir, on_new_config, and single_file_support (from nvim-lspconfig), and capabilities (from Neovim itself)).
Keeping our current docs, but referencing nvim-lspconfig's docs, sounds like a good idea. It's not necessary for this PR though.
Is this ready to merge? |
Yes, unless you want the commits squashed. |
Landed as commit b7aa1c8. |
Fixes #909