1
0

fix: try adding efm for lua formatting

This commit is contained in:
Rokas Puzonas 2021-10-31 18:49:48 +02:00
parent 91d973e6b4
commit 14f29a1981
2 changed files with 19 additions and 0 deletions

View File

@ -4,7 +4,20 @@ local M = {}
M.flags = { debounce_text_changes = 150 } M.flags = { debounce_text_changes = 150 }
local general_settings = { } local general_settings = { }
M.server_init_options = {
efm = {documentFormatting = true},
}
M.server_settings = { M.server_settings = {
efm = {
rootMarkers = {".git/"},
languages = {
lua = {
{ formatCommand = "lua-format -i", formatStdin = true }
}
}
}
-- sumneko_lua = { -- sumneko_lua = {
-- Lua = { -- Lua = {
-- runtime = { -- runtime = {
@ -90,6 +103,10 @@ function M.get_server_settings(name)
return M.server_settings[name] return M.server_settings[name]
end end
function M.get_server_init_options(name)
return M.server_init_options[name]
end
---@diagnostic disable-next-line: empty-block ---@diagnostic disable-next-line: empty-block
if packer_plugins['nvim-lsp-installer'] and packer_plugins['nvim-lsp-installer'].loaded then if packer_plugins['nvim-lsp-installer'] and packer_plugins['nvim-lsp-installer'].loaded then
-- local lspconfig = require('lspconfig') -- local lspconfig = require('lspconfig')

View File

@ -3,6 +3,7 @@ local lsp_instller = require 'nvim-lsp-installer'
local lsp_installer_servers = require'nvim-lsp-installer.servers' local lsp_installer_servers = require'nvim-lsp-installer.servers'
local M = {} local M = {}
-- local autoinstall_servers = {"sumneko_lua", "efm"}
local autoinstall_servers = {"sumneko_lua"} local autoinstall_servers = {"sumneko_lua"}
for _, name in ipairs(autoinstall_servers) do for _, name in ipairs(autoinstall_servers) do
local ok, server = lsp_installer_servers.get_server(name) local ok, server = lsp_installer_servers.get_server(name)
@ -15,6 +16,7 @@ local capabilities = lspconfig_config.get_capabilities()
lsp_instller.on_server_ready(function(server) lsp_instller.on_server_ready(function(server)
server:setup{ server:setup{
init_options = lspconfig_config.get_server_init_options(server.name),
on_attach = lspconfig_config.on_attach, on_attach = lspconfig_config.on_attach,
on_init = lspconfig_config.on_init, on_init = lspconfig_config.on_init,
flags = lspconfig_config.flags, flags = lspconfig_config.flags,