mattn / efm-langserver

General purpose Language Server
MIT License
1.32k stars 59 forks source link

Get efm log file in nvim for debugging #235

Closed TamaMcGlinn closed 4 months ago

TamaMcGlinn commented 1 year ago

When trying to configure a new linter / formatter, it would be great to be able to view the log from efm. Adding this to vimrc does not work:

require"lspconfig".efm.setup {
    init_options = {documentFormatting = true},
    settings = {
        rootMarkers = {".git/"},
        version = 2,
        logFile = "/home/myname/efmlog.txt",
        logLevel = 1,
        languages = {
            sh = {
                {
                    lintCommand = 'shellcheck -f gcc -x',
                    lintSource = 'shellcheck',
                    lintFormats = {
                        '%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m',
                        '%f:%l:%c: %tote: %m'
                    },
                    lintIgnoreExitCode = true
                }
            }
        }
    }
}

I have no idea why. Instead, I needed to put this in ~/.config/efm-langserver/config.yaml:

version: 2
log-file: /home/myname/efmlog.txt
log-level: 1

In general it would be great if an example config could be included in the readme, because I had to guess that lint-source in yaml becomes lintSource in lua vimrc.