golangci-lint-langserver

command module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 12 Imported by: 0

README

golangci-lint-langserver

golangci-lint-langserver is golangci-lint language server.

asciicast

Installation

go get github.com/nametake/golangci-lint-langserver

Options

  -debug
        output debug log
  -nolintername
        don't show a linter name in message

Configuration

You need to set golangci-lint command to initializationOptions with --out-format json.

Configuration for coc.nvim

coc-settings.json

{
  "languageserver": {
    "golangci-lint-languageserver": {
      "command": "golangci-lint-langserver",
      "filetypes": ["go"],
      "initializationOptions": {
        "command": ["golangci-lint", "run", "--enable-all", "--disable", "lll", "--out-format", "json"]
      }
    }
  }
}
Configuration for vim-lsp
augroup vim_lsp_golangci_lint_langserver
  au!
  autocmd User lsp_setup call lsp#register_server({
      \ 'name': 'golangci-lint-langserver',
      \ 'cmd': {server_info->['golangci-lint-langserver']},
      \ 'initialization_options': {'command': ['golangci-lint', 'run', '--enable-all', '--disable', 'lll', '--out-format', 'json']},
      \ 'whitelist': ['go'],
      \ })
augroup END

vim-lsp-settings provide installer for golangci-lint-langserver.

Configuration for nvim-lspconfig

Requires Neovim HEAD/nightly (v0.5 prerelease).

local lspconfig = require 'lspconfig'
local configs = require 'lspconfig/configs'

if not lspconfig.golangcilsp then
 	configs.golangcilsp = {
		default_config = {
			cmd = {'golangci-lint-langserver'},
			root_dir = lspconfig.util.root_pattern('.git', 'go.mod'),
			init_options = {
					command = { "golangci-lint", "run", "--enable-all", "--disable", "lll", "--out-format", "json" };
			}
		};
	}
end
lspconfig.golangcilsp.setup {
	filetypes = {'go'}
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL