jose-elias-alvarez / null-ls.nvim

Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
Other
3.64k stars 791 forks source link

HELP: where to put autostart #469

Closed theSafdarAwan closed 2 years ago

theSafdarAwan commented 2 years ago

FAQ

Issues

Neovim Version

0.6

null-ls config

local on_attach = require("lsp.lsp_util").on_attach
--=======================================================
--                      null-ls
--=======================================================
local null_ls = require("null-ls")
local builtins = null_ls.builtins
local sources = {
    builtins.formatting.stylua,
    builtins.diagnostics.luacheck,
    builtins.formatting.black.with({ extra_args = { "--fast" } }),
    builtins.diagnostics.flake8,
    builtins.diagnostics.eslint_d.with({
        condition = function(utils)
            return utils.root_has_file(".eslintrc.json")
        end,
    }),
    builtins.formatting.eslint_d,
    builtins.formatting.stylelint,
    builtins.formatting.clang_format,
    builtins.diagnostics.stylelint,
    -- builtins.diagnostics.htmlhint,
    builtins.formatting.prettier_d_slim.with({
        -- filetypes = { "html", "json", "css", "scss", "less", "yaml", "markdown" },
        filetypes = { "html", "json", "yaml", "markdown" },
    }),

    builtins.code_actions.gitsigns,
}
null_ls.setup({
    debug = true,
    sources = sources,
    on_attach = on_attach,
})

Steps to reproduce

update

Expected behavior

no

Actual behavior

i updated my plgugins after a week or so null ls changed some config i made the similar changes and now it's working but where is the autostart option because i can't autostart it using autostart=true

Debug log

no

Help

No

Implementation help

no

jose-elias-alvarez commented 2 years ago

You don't need to specifically set autostart for null-ls. It'll always show as false in :LspInfo, but null-ls will always start automatically. Are you having a specific issue?

jose-elias-alvarez commented 2 years ago

In 1c80377e0ab63f692540e75fba2a0c0c8d51de71 I added a note to the documentation to clarify that setting autostart is unnecessary. Feel free to open another issue if you're having any issues with null-ls attaching / not attaching to buffers.