fix(none-ls): Only extend sources, don't replace (#19)

This commit is contained in:
ItsDrike 2024-07-10 12:00:00 +00:00 committed by Micah Halter
parent b3f629a30e
commit 20450d8a65
No known key found for this signature in database
GPG Key ID: 4224A6EA9A8CAAA8

View File

@ -5,18 +5,20 @@ if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
---@type LazySpec ---@type LazySpec
return { return {
"nvimtools/none-ls.nvim", "nvimtools/none-ls.nvim",
opts = function(_, config) opts = function(_, opts)
-- config variable is the default configuration table for the setup function call -- opts variable is the default configuration table for the setup function call
-- local null_ls = require "null-ls" -- local null_ls = require "null-ls"
-- Check supported formatters and linters -- Check supported formatters and linters
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
config.sources = {
-- Only insert new sources, do not replace the existing ones
-- (If you wish to replace, use `opts.sources = {}` instead of the `list_insert_unique` function)
opts.sources = require("astrocore").list_insert_unique(opts.sources, {
-- Set a formatter -- Set a formatter
-- null_ls.builtins.formatting.stylua, -- null_ls.builtins.formatting.stylua,
-- null_ls.builtins.formatting.prettier, -- null_ls.builtins.formatting.prettier,
} })
return config -- return final config table
end, end,
} }