Integrate null-ls with lsp-zero #28
Answered
by
VonHeikemen
Mohammed-Taher
asked this question in
Q&A
-
Hi. Can null-ls integrate with lsp-zero? I tried but I don know how to pass the options from lsp-zero to null-ls. Thank you. |
Beta Was this translation helpful? Give feedback.
Answered by
VonHeikemen
Jul 23, 2022
Replies: 1 comment
-
null-ls is not a regular language server, so the only option that makes sense to share is local lsp = require('lsp-zero')
lsp.preset('recommended')
local null_ls = require('null-ls')
null_opts = lsp.build_options('null-ls', {
on_attach = function(client, bufnr)
---
-- this function is optional
---
end
})
null_ls.setup({
on_attach = null_opts.on_attach
sources = {
---
-- do what you have to do...
---
}
})
lsp.setup() You could also do this. local null_ls = require('null-ls')
null_opts = lsp.build_options('null-ls', {})
null_ls.setup({
on_attach = function(client, bufnr)
null_opts.on_attach(client, bufnr)
--- your code goes here...
end,
sources = {
---
-- do what you have to do...
---
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Mohammed-Taher
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
null-ls is not a regular language server, so the only option that makes sense to share is
on_attach
.You could also do this.