Skip to content

Commit

Permalink
null-ls config as lsp dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
danwetherald committed Jul 27, 2023
1 parent 6497654 commit 8363323
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions nvim_custom/configs/null-ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local sources = {
formatting.rubocop,
formatting.stylua,
formatting.prettier,
formatting.erb_format,

-- diagnostics
diagnostics.rubocop,
Expand All @@ -21,15 +22,14 @@ local sources = {
null_ls.setup {
debug = true,
sources = sources,

on_attach = function(client, bufnr)
if client.supports_method "textDocument/formatting" then
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format { bufnr = bufnr, timeout_ms = 5000 }
vim.lsp.buf.format { async = true, bufnr = bufnr, timeout_ms = 5000 }
end,
})
end
Expand Down
29 changes: 15 additions & 14 deletions nvim_custom/plugins.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
local plugins = {
{
"neovim/nvim-lspconfig",
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end,
},

{
"jose-elias-alvarez/null-ls.nvim",
after = "nvim-lspconfig",
config = function()
require "custom.configs.null-ls"
end,
},
"neovim/nvim-lspconfig",
dependencies = {
{
-- format & linting
"jose-elias-alvarez/null-ls.nvim",
config = function()
require("custom.configs.null-ls")
end,
},
},
config = function()
require("plugins.configs.lspconfig")
require("custom.configs.lspconfig")
end,
},

{
"williamboman/mason.nvim",
Expand Down

0 comments on commit 8363323

Please sign in to comment.