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.
- 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' }
}
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
}
}
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
- 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'
- Linters
- Python
- Go
golangci_lint
=>require 'diagnosticls-nvim.linters.golangci_lint'
revive
=>require 'diagnosticls-nvim.linters.revive'
- Ruby
- CSS/SCSS/LESS
stylelint
=>require 'diagnosticls-nvim.linters.stylelint'
- PHP
- Vim
vint
=>require 'diagnosticls-nvim.linters.vint'
Coming Soon