Skip to content

Integrate null-ls with lsp-zero #28

Answered by VonHeikemen
Mohammed-Taher asked this question in Q&A
Discussion options

You must be logged in to vote

null-ls is not a regular language server, so the only option that makes sense to share is on_attach.

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...

Replies: 1 comment

Comment options

You must be logged in to vote
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
Category
Q&A
Labels
None yet
2 participants