Skip to content

Commit

Permalink
feat(nvim): Make it easier to apply special config to efm-langserver …
Browse files Browse the repository at this point in the history
…modules
  • Loading branch information
mrjones2014 committed Jul 28, 2023
1 parent debdb07 commit 4b7014b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions nvim/lua/my/lsp/filetypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ M.config['javascriptreact'] = M.config['typescript']

M.filetypes = vim.tbl_keys(M.config)

local efm_customizations = {
['cbfmt'] = function()
local cbfmt = require('efmls-configs.formatters.cbfmt')
cbfmt.formatCommand =
string.format('%s --config %s', cbfmt.formatCommand, string.format('%s/.config/cbfmt.toml', vim.env.HOME))
return cbfmt
end,
}

local function load_efm_modules(mods, mod_type)
if not mods then
return nil
Expand All @@ -74,12 +83,8 @@ local function load_efm_modules(mods, mod_type)
return require(string.format('efmls-configs.%s.%s', mod_type, mods))
else
return vim.tbl_map(function(mod)
-- cbfmt is a special case, we need to pass our config file path
if mod == 'cbfmt' then
local cbfmt = require('efmls-configs.formatters.cbfmt')
cbfmt.formatCommand =
string.format('%s --config %s', cbfmt.formatCommand, string.format('%s/.config/cbfmt.toml', vim.env.HOME))
return cbfmt
if efm_customizations[mod] then
return efm_customizations[mod]()
end

return require(string.format('efmls-configs.%s.%s', mod_type, mod))
Expand Down

0 comments on commit 4b7014b

Please sign in to comment.