null-ls, formatting

This commit is contained in:
mightypanders 2022-08-31 21:53:08 +02:00
parent 68fd48afed
commit a27ec9c950
4 changed files with 66 additions and 64 deletions

View File

@ -1,4 +1,3 @@
local set = vim.opt local set = vim.opt
set.modelines = 0 set.modelines = 0
set.hidden = true set.hidden = true

View File

@ -29,7 +29,7 @@ local on_attach = function(client, bufnr)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts) vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references, bufopts) vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<leader>f',function() vim.lsp.buf.format { async = true } end, bufopts) vim.keymap.set('n', '<leader>f', vim.lsp.buf.formatting, bufopts)
end end
local lsp_flags = { local lsp_flags = {
@ -44,7 +44,10 @@ require('mason-lspconfig').setup_handlers{
} }
end, end,
['rust_analyzer'] = function() ['rust_analyzer'] = function()
require('rust-tools').setup {} require('rust-tools').setup {
on_attach = on_attach,
flags = lsp_flags,
}
end, end,
['sumneko_lua'] = function() ['sumneko_lua'] = function()
require('lspconfig')["sumneko_lua"].setup { require('lspconfig')["sumneko_lua"].setup {

View File

@ -1,8 +1,8 @@
require("null-ls").setup({ require("null-ls").setup({
sources = { sources = {
require("null-ls").builtins.formatting.stylua, --require("null-ls").builtins.formatting.stylua,
require("null-ls").builtins.diagnostics.eslint, require("null-ls").builtins.diagnostics.eslint,
require("null-ls").builtins.completion.spell, -- require("null-ls").builtins.completion.spell,
}, },
}) })