LSP Zero and efm-langserver #293
olimorris
started this conversation in
Show and tell
Replies: 1 comment 2 replies
-
You think it would be worth adding some helper functions for efm? To create a config based on tools, instead of declaring tools for each language? I can make something like this: local lsp_zero = require('lsp-zero')
local efm_opts = lsp_zero.efm.tools({
{
name = 'eslint-fix',
formatCommand = "eslint --fix '${INPUT}'",
formatStdin = false,
languages = {'javascript', 'typescript'},
},
{
name = 'prettierd',
formatCommand = "prettierd '${INPUT}' ${--range-start=charStart} ${--range-end=charEnd}",
formatCanRange = true,
formatStdin = true,
rootMarkers = {'.prettierrc.json', '.prettierrc.js'},
languages = {'javascript', 'typescript'},
},
{
name = 'stylua',
formatCommand = 'stylua --color Never ${--range-start:charStart} ${--range-end:charEnd} -',
formatCanRange = false,
formatStdin = true,
rootMarkers = {'stylua.toml', '.stylua.toml'},
languages = {'lua'}
},
})
require('lspconfig').efm.setup(efm_opts)
lsp_zero.format_mapping('gq', {
servers = {
efm = lsp_zero.efm.langs({with = 'formatCommand'})
},
}) I know this will only be useful for those who hate yaml. (I hate yaml configs) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thought I'd share my LSP Zero and efm-langserver config, here.
Worth noting that I had to manually set some server capabilities for efm in the
lsp.on_attach
method:Beta Was this translation helpful? Give feedback.
All reactions