Diagnosticls Configs Nvim Versions Save

An unofficial collection of linters and formatters configured for diagnostic-languageserver for neovim.

v0.1.9

9 months ago

What's Changed

Full Changelog: https://github.com/creativenull/diagnosticls-configs-nvim/compare/v0.1.8...v0.1.9

v0.1.2

2 years ago

Main

  • fs for formatter executables
  • Simplify tests
  • Use stdout whenever possible before using doesWriteToFile option

Linters

  • vulture - python

Formatters

  • deno - js/ts
  • yapf - python
  • autoflake - python
  • autoimport - python
  • isort - python

v0.1.1

2 years ago
  • :checkhealth support for nvim 0.5 and 0.5.1

v0.1.0

2 years ago

First initial release of this plugin! 🎉

Here is what have been done since it's inception back in March, 2021. FYI, this is a long post 😅

Why?

So before I dive in, maybe a bit on why this plugin?

For me, when I tried out the diagnostic-languageserver I saw that I had to implement each linter myself, from there I saw that I needed to: first, ensure that the tool is installed in the right place, and second, do some RegEx or JSON parsing to get the linter to work properly in neovim. As for formatting I had to ensure that the results is either taken from stdout or written directly to the file. As you can see there are many things to do and tinker about just get the linter/formatter to properly work.

So I decided to make this plugin, to make it easier for users of neovim, where they can just copy/paste the setup into their config and have it working without the need to figure out if the RegEx they wrote works or not, or if the the JSON result parsed properly or not - saving an hour or probably days and just start writing that code/feature their boss demanded months ago but alas stuck in the init.lua config hell (I'm also still in that same boat 😉). So here it is!

Detect linter/formatter from a project specific location, or globally

As the initial diagnostic-languageserver does not have that capability (and provides the base API to the user to implement themselves), this plugin will provide this detection if the linter/formatter tool is located in the project directory (e.g. in a node project, a linter can be installed in the node_modules directory on the project) or globally.

For project specific detection, this only works for: node/npm, php/composer and ruby/bundler projects at this point. More can be added in the future.

Additionally, :checkhealth will notify users if the tool wasn't found in either of those locations, however DiagnosticLS server will run without issue (maybe another check is necessary if strictness is required) but will not complain, so better to check the status with :checkhealth first before trouble shooting the server itself. Improvements on this can be done slowly for now, depending on the demand.

Default configurations

In case a user does not want to individually define configuration, they can add the default_config to their init() to try out the plugin without the needed setup().

Advanced configuration

Sometimes, the configured tools might need a bit more tweaking for the user. For this case, they can easily extend the config with vim.tbl_extend() and add their own changes.

BTW, users don't really need the init() or the setup() functions provided by this plugin. If your desire is to only use the configuration provided in lua/diagnosticls-configs/linters and lua/diagnosticls-configs/formatters then you can do so without any hassle. Adding them to the relevant linters and formatters properties in lspconfig.diagnosticls.setup() is more than enough to work. This plugin just simplifies that setup for you.

Documentation

A list of all linters/formatters can be found in the documentation, where users can browse through and copy/paste the relevant code within their own config. You can see the supported list documentation here.

Additionally, the README provides some first steps documentation, as well as, the vim help docs in :help diagnosticls-configs

Tests

An initial implementation of testing has been added, with the help of plenary.nvim we can start testing if the linter/formatter config is properly written. At this point it will only check if the sourceName, command and args is provided in each config. Will need to keep working on adding new linters/formatters so that we can keep on testing and see what else we might be missing that can be added as part of the test.

Thanks to the contributors 😃

And last but not least, a HUGE thanks to those who contributed in some form of a PR or posting their problems on the Issues page. For things I myself couldn't do (like adding the swiftlint linter, which required a mac machine to access it, for example). Many many thanks!!

Future

For the future, development will still go on by adding more linters and formatters that are not already added. And probably reach a certain stability for the list. So mainly depending on how active the diagnostic language server repo is, this plugin will try to keep up-to-date with the lsp server.

What's Changed

New Contributors

Full Changelog: https://github.com/creativenull/diagnosticls-configs-nvim/commits/v0.1.0