mattn / efm-langserver

General purpose Language Server
MIT License
1.34k stars 61 forks source link

Adding support for erb-lint by Shopify #191

Open weizheheng opened 2 years ago

weizheheng commented 2 years ago

Name: erb-lint URL: https://github.com/Shopify/erb-lint

There is this issue open on the Ale's repository. I am curious is this possible to add this here?

I was trying around and thought I might be able to change the lintingCommand and formatCommand to get it work. But I am not really sure what that two commands are expecting. Would love some input on whether this integration is possible.

adamyonk commented 4 months ago

This gets close, I'm still having some weirdness with erblint writing random configs to disk with this setup, still looking into that.

local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
local erblint = {
    lintCommand = "erblint --format compact --stdin ${INPUT}",
    lintStdin = true,
    lintFormats = {
      "%f:%l:%c: %m",
    },
    lintIgnoreExitCode = true,
    formatCommand = "erblint --autocorrect --stdin ${INPUT} | tail -n +5",
    formatStdin = true,
}
lspconfig.efm.setup {
    capabilities = capabilities,
    init_options = { documentFormatting = true },
    settings = {
        rootMarkers = {".git/"},
        languages = {
            eruby = {erblint},
        }
    },
    filetypes = {
        "eruby",
    }
}