Skip to content

A collection of different linter and formatter configurations for diagnostic-language-server used for native nvim-lsp

License

Notifications You must be signed in to change notification settings

vianney-g/diagnosticls-nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

diagnosticls-nvim (Status: Experimental)

A collection of linters and formatters configured for diagnostic language server to work with nvim-lsp. Have a look at the currently supported linters/formatters below.

Installation

Requirements

  • Neovim v0.5
  • DiagnosticLS, globally installed: npm i -g diagnostic-languageserver
  • nvim-lspconfig

You will need to install diagnostic-languageserver and nvim-lspconfig before using this plugin. Using packer.nvim as an example:

use {
  'creativenull/diagnosticls-nvim',
  requires = { 'neovim/nvim-lspconfig' }
}

Setup

First you need to initialize the plugin, this is where you can pass your own LSP options:

local function on_attach(client)
  print('Attached to ' .. client.name)
end

require 'diagnosticls-nvim'.init {
  on_attach = on_attach -- Your custom attach function
}

Finally, setup the linters/formatters according to the filetype, here is an example for running eslint and prettier for javascript and javascriptreact filetype:

local eslint = require 'diagnosticls-nvim.linters.eslint'
local prettier = require 'diagnosticls-nvim.formatters.prettier'
require 'diagnosticls-nvim'.setup {
  ['javascript'] = {
    linter = eslint,
    formatter = prettier
  },
  ['javascriptreact'] = {
    linter = eslint,
    formatter = prettier
  }
}

Supported linters and formatters

Below are the supported linters and formatters that are configured to run with diagnostic-languageserver. Copy the require code into your setup() function shown above.

  • JavaScript
    • Linters
      • eslint => require 'diagnosticls-nvim.linters.eslint'
      • standard => require 'diagnosticls-nvim.linters.standard'
      • xo => require 'diagnosticls-nvim.linters.xo'
    • Formatters
      • prettier_eslint => require 'diagnosticls-nvim.formatters.prettier_eslint'
      • prettier_standard => require 'diagnosticls-nvim.formatters.prettier_standard'
      • prettier => require 'diagnosticls-nvim.formatters.prettier'
      • standard_fmt => require 'diagnosticls-nvim.formatters.standard_fmt'
      • xo_fmt => require 'diagnosticls-nvim.formatters.xo_fmt'
  • TypeScript
    • Linters
      • eslint => require 'diagnosticls-nvim.linters.eslint'
      • ts_standard => require 'diagnosticls-nvim.linters.ts_standard'
      • xo => require 'diagnosticls-nvim.linters.xo'
    • Formatters
      • prettier_eslint => require 'diagnosticls-nvim.formatters.prettier_eslint'
      • prettier => require 'diagnosticls-nvim.formatters.prettier'
      • ts_standard_fmt => require 'diagnosticls-nvim.formatters.ts_standard_fmt'
      • xo_fmt => require 'diagnosticls-nvim.formatters.xo_fmt'
  • Python
    • Linters
      • flake => require 'diagnosticls-nvim.linters.flake'
      • pylint => require 'diagnosticls-nvim.linters.pylint'
    • Formatters
      • autopep8 => require 'diagnosticls-nvim.formatters.autopep8'
  • Go
    • golangci_lint => require 'diagnosticls-nvim.linters.golangci_lint'
    • revive => require 'diagnosticls-nvim.linters.revive'
  • Ruby
    • reek => require 'diagnosticls-nvim.linters.reek'
    • rubocop => require 'diagnosticls-nvim.linters.rubocop'
  • CSS/SCSS/LESS
    • stylelint => require 'diagnosticls-nvim.linters.stylelint'
  • PHP
    • phpcs => require 'diagnosticls-nvim.linters.phpcs'
    • phpstan => require 'diagnosticls-nvim.linters.phpstan'
    • psalm => require 'diagnosticls-nvim.linters.psalm'
  • Vim
    • vint => require 'diagnosticls-nvim.linters.vint'

Contributing

Coming Soon

About

A collection of different linter and formatter configurations for diagnostic-language-server used for native nvim-lsp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%