refactor lspconfig
This commit is contained in:
parent
48e0a8f399
commit
0a23e9529e
@ -107,6 +107,18 @@ opt.foldmethod = 'expr'
|
|||||||
opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||||
opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||||
|
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false,
|
||||||
|
signs = true,
|
||||||
|
float = {
|
||||||
|
border = 'single',
|
||||||
|
format = function(diagnostic)
|
||||||
|
return string.format('%s (%s) [%s]', diagnostic.message, diagnostic.source,
|
||||||
|
diagnostic.code or diagnostic.user_data.lsp.code)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-- Window border for floating windows
|
-- Window border for floating windows
|
||||||
require('lspconfig.ui.windows').default_options.border = 'rounded'
|
require('lspconfig.ui.windows').default_options.border = 'rounded'
|
||||||
|
|
||||||
|
@ -99,6 +99,38 @@ local on_attach = function(client, bufnr)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local efm_setup = function(capabilities)
|
||||||
|
local prettier = require('efmls-configs.formatters.prettier')
|
||||||
|
local stylua = require('efmls-configs.formatters.stylua')
|
||||||
|
local gersemi = require('efmls-configs.formatters.gersemi')
|
||||||
|
local black = require('efmls-configs.formatters.black')
|
||||||
|
local isort = require('efmls-configs.formatters.isort')
|
||||||
|
local cmake_lint = require('efmls-configs.linters.cmake_lint')
|
||||||
|
local flake8 = require('efmls-configs.linters.flake8')
|
||||||
|
local languages = {
|
||||||
|
lua = { stylua },
|
||||||
|
markdown = { prettier },
|
||||||
|
cmake = { gersemi, cmake_lint },
|
||||||
|
python = { isort, black, flake8 },
|
||||||
|
}
|
||||||
|
|
||||||
|
local efmls_config = {
|
||||||
|
-- filetypes = vim.tbl_keys(languages),
|
||||||
|
settings = {
|
||||||
|
rootMarkers = { '.git/' },
|
||||||
|
languages = languages,
|
||||||
|
},
|
||||||
|
init_options = {
|
||||||
|
documentFormatting = true,
|
||||||
|
documentRangeFormatting = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
require('lspconfig').efm.setup(vim.tbl_extend('force', efmls_config, {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}))
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
@ -278,48 +310,7 @@ return {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local prettier = require('efmls-configs.formatters.prettier')
|
efm_setup(capabilities)
|
||||||
local stylua = require('efmls-configs.formatters.stylua')
|
|
||||||
local gersemi = require('efmls-configs.formatters.gersemi')
|
|
||||||
local black = require('efmls-configs.formatters.black')
|
|
||||||
local isort = require('efmls-configs.formatters.isort')
|
|
||||||
local cmake_lint = require('efmls-configs.linters.cmake_lint')
|
|
||||||
local flake8 = require('efmls-configs.linters.flake8')
|
|
||||||
local languages = {
|
|
||||||
lua = { stylua },
|
|
||||||
markdown = { prettier },
|
|
||||||
cmake = { gersemi, cmake_lint },
|
|
||||||
python = { isort, black, flake8 },
|
|
||||||
}
|
|
||||||
|
|
||||||
local efmls_config = {
|
|
||||||
-- filetypes = vim.tbl_keys(languages),
|
|
||||||
settings = {
|
|
||||||
rootMarkers = { '.git/' },
|
|
||||||
languages = languages,
|
|
||||||
},
|
|
||||||
init_options = {
|
|
||||||
documentFormatting = true,
|
|
||||||
documentRangeFormatting = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
require('lspconfig').efm.setup(vim.tbl_extend('force', efmls_config, {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}))
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
|
||||||
virtual_text = false,
|
|
||||||
signs = true,
|
|
||||||
float = {
|
|
||||||
border = 'single',
|
|
||||||
format = function(diagnostic)
|
|
||||||
return string.format('%s (%s) [%s]', diagnostic.message, diagnostic.source,
|
|
||||||
diagnostic.code or diagnostic.user_data.lsp.code)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
end,
|
||||||
event = 'VeryLazy',
|
event = 'VeryLazy',
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user