Added null-ls plugin.This enables certain tools to act as LSPs

(formatters, linters, etc)
This commit is contained in:
Afonso Franco 2022-12-15 04:18:13 +00:00
parent 0baee67ded
commit 13b0b340f9
Signed by: afonso
GPG key ID: C459E0BB3DCEE899
3 changed files with 69 additions and 46 deletions

View file

@ -1,8 +1,7 @@
local mason_lspconfig = require "mason-lspconfig"
mason_lspconfig.setup({
ensure_installed = { "sumneko_lua", "rust_analyzer" , "texlab", "hls"},
ensure_installed = { "sumneko_lua", "rust_analyzer", "texlab", "hls", "yamlls" },
automatic_installation = true
})
@ -42,6 +41,9 @@ local on_attach = function(client, bufnr)
-- pattern = '<buffer>',
-- callback = function() vim.lsp.buf.format({ async = true }) end
-- })
if client.name == "yamlls" then
client.server_capabilities.document_formatting = true
end
end
local lspconfig = require "lspconfig"

View file

@ -0,0 +1,10 @@
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.rustfmt,
null_ls.builtins.formatting.prettierd.with({
filetypes = { "html", "json", "yaml", "markdown" },
}),
}
})

View file

@ -1,4 +1,3 @@
local packer = require("packer")
local plugins = packer.startup({ function(use)
@ -41,6 +40,12 @@ local plugins = packer.startup({function(use)
require 'plugins.lualine'
end
}
use { 'rcarriga/nvim-notify',
config = function()
vim.notify = require("notify")
end
}
-------------------------------------------------------LSP----------------------------------------------
use { "williamboman/mason.nvim",
@ -57,6 +62,12 @@ local plugins = packer.startup({function(use)
end
}
use { "jose-elias-alvarez/null-ls.nvim",
config = function()
require "plugins.null-ls"
end
}
use { "L3MON4D3/LuaSnip",
requires = {
"rafamadriz/friendly-snippets",