/efm-langserver

General purpose Language Server

Primary LanguageGo

efm-langserver

General purpose Language Server that can use specified error message format generated from specified command. This is useful for editing code with linter.

efm

Usage

Usage of efm-langserver:
  -c string
        path to config.yaml
  -log string
        logfile

Example for config.yaml

Location of config.yaml is:

  • UNIX: $HOME/.config/efm-langserver/config.yaml
  • Windows: %APPDATA%\efm-langserver\config.yaml

Below is example for config.yaml .

languages:
  eruby:
    lint-command: 'erb -x -T - | ruby -c'
    lint-stdin: true
    lint-offset: 1
    format-command: 'htmlbeautifier'

  vim:
    lint-command: 'vint -'
    lint-stdin: true

  markdown:
    lint-command: 'markdownlint -s'
    lint-stdin: true
    lint-formats:
      - '%f: %l: %m'

  yaml:
    lint-command: 'yamllint -f parsable -'
    lint-stdin: true
    lint-formats:
      - '%f:%l:%c: %m'

Configuration for vim-lsp

augroup LspEFM
  au!
  autocmd User lsp_setup call lsp#register_server({
      \ 'name': 'efm-langserver-erb',
      \ 'cmd': {server_info->['efm-langserver', '-c=/path/to/your/config.yaml']},
      \ 'whitelist': ['eruby', 'markdown'],
      \ })
augroup END

Configuration for coc.nvim

coc-settings.json

  // languageserver
  "languageserver": {
    "efm": {
      "command": "efm-langserver",
      "args": [],
      // custom config path
      // "args": ["-c", "/path/to/your/config.yaml"],
      "filetypes": ["vim", "eruby", "markdown", "yaml"]
    }
  },

Supported Lint tools

Installation

$ go get github.com/mattn/efm-langserver

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)