Skip to content

Latest commit

 

History

History
1886 lines (1193 loc) · 38.3 KB

BUILTINS.md

File metadata and controls

1886 lines (1193 loc) · 38.3 KB

Using built-in sources

null-ls includes a library of built-in sources meant to provide out-of-the-box functionality. Built-in sources run with optimizations to reduce startup time and enable user customization.

Loading and registering

null-ls exposes built-ins on null_ls.builtins, which contains the following groups of sources:

-- code action sources
null_ls.builtins.code_actions

-- diagnostic sources
null_ls.builtins.diagnostics

-- formatting sources
null_ls.builtins.formatting

-- hover sources
null_ls.builtins.hover

You can then register sources by passing a sources list into your config function:

local null_ls = require("null-ls")

-- register any number of sources simultaneously
local sources = {
    null_ls.builtins.formatting.prettier,
    null_ls.builtins.diagnostics.write_good,
    null_ls.builtins.code_actions.gitsigns,
}

null_ls.config({ sources = sources })

To run built-in sources, the command specified below must be available on your $PATH and visible to Neovim. For example, to check if eslint is available, run the following (Vim, not Lua) command:

" should echo 1 if available (and 0 if not)
:echo executable("eslint")

Configuration

Built-in sources have access to a special method, with(), which modifies the source's default options. For example, you can alter a source's file types as follows:

local sources = {
    null_ls.builtins.formatting.prettier.with({
        filetypes = { "html", "json", "yaml", "markdown" },
    }),
}

See the descriptions below or the relevant builtins source file to see the default options passed to each built-in source.

Note that setting filetypes = {} will enable the source for all filetypes, which isn't recommended for most sources.

You can override args using with({ args = your_args }), but if you want to add more flags, you should use extra_args instead:

local sources = {
    null_ls.builtins.formatting.shfmt.with({
        extra_args = { "-i", "2", "-ci" }
      })
  }

Note that environment variables and ~ aren't expanded in arguments. As a workaround, you can use vim.fn.expand:

local sources = {
    null_ls.builtins.formatting.stylua.with({
        extra_args = { "--config-path", vim.fn.expand("~/.config/stylua.toml") },
    }),
}

For diagnostics sources, you can change the format of diagnostic messages by setting diagnostics_format:

local sources = {
    -- will show code and source name
    null_ls.builtins.diagnostics.shellcheck.with({
        diagnostics_format = "[#{c}] #{m} (#{s})"
    }),
}

See CONFIG to learn about diagnostics_format. Note that specifying diagnostics_format for a built-in will override your global diagnostics_format for that source.

Conditional registration

null-ls supports dynamic registration, meaning that you can register sources whenever you want. To simplify this, built-ins have access to the conditional option, which should be a function that returns a boolean or nil indicating whether null-ls should register the source. null-ls will pass a single argument to the function, which is a table of utilities to handle common conditional checks (though you can use whatever you want, as long as the return value matches).

For example, to conditionally register stylua by checking if the root directory has a stylua.toml file:

local sources = {
    null_ls.builtins.formatting.stylua.with({
        condition = function(utils)
            return utils.root_has_file("stylua.toml")
        end,
    }),
}

To conditionally register one of two or more sources, you can use the conditional helper, which should return a source or nil and will register the first source returned.

local sources = {
    require("null-ls.helpers").conditional(function(utils)
        return utils.root_has_file(".eslintrc.js") and b.formatting.eslint_d or b.formatting.prettier
    end),
}

Note that if you pass conditional sources into null_ls.config, null-ls will check and register them at the point that you source your plugin config. To handle advanced dynamic registration behavior, you can use null_ls.register with a relevant autocommand event listener.

Available Sources

Formatting

About

Format your assembler code in a similar way that gofmt formats your go code.

Usage
local sources = { null_ls.builtins.formatting.asmfmt }
Defaults
  • filetypes = { "asm" }
  • command = "asmfmt"
  • args = {}
About

This pure text processing tool will reformat beancount input to right-align all the numbers at the same, minimal column.

  • It left-aligns all the currencies.
  • It only modifies whitespace.
Usage
local sources = { null_ls.builtins.formatting.bean_format }
Defaults
  • filetypes = { "beancount" }
  • command = "bean-format"
  • args = { "-" }
About

Uncompromising Python code formatter.

Usage
local sources = { null_ls.builtins.formatting.black }
Defaults
  • filetypes = { "python" }
  • command = "black"
  • args = { "--quiet", "--fast", "-" }
About

Tool to format C/C++/… code according to a set of rules and heuristics.

Usage
local sources = { null_ls.builtins.formatting.clang_format }
Defaults
  • filetypes = { "c", "cpp", "cs", "java" }
  • command = "clang-format"
  • args = { "-assume-filename=<FILENAME>" }
About

Format your listfiles nicely so that they don't look like crap.

Usage
local sources = { null_ls.builtins.formatting.cmake_format }
Defaults
  • filetypes = { "cmake" }
  • command = "cmake-format"
  • args = { "-" }
About

codespell fix common misspellings in text files.

Usage
local sources = { null_ls.builtins.formatting.codespell }
Defaults
  • filetypes = {}
  • command = "codespell"
  • args = { "--write-changes", "$FILENAME" }
About

Static analysis for elixir files for enforcing code consistency.

  • Searches upwards from the buffer to the project root and tries to find the first .credo.exs file in case nested credo configs are used.
  • When not using a global credo install, the diagnostic can be disable with a conditional checking for the config file with utils.root_has_file('.credo.exs')
Usage
local sources = { null_ls.builtins.diagnostics.credo }
Defaults
  • filetypes = { "elixir" }
  • command = "mix"
  • args = { "credo", "suggest", "--format", "json", "--read-from-stdin", "$FILENAME" }
About

A tool for automatically checking and correcting the style of code in a project.

Usage
local sources = { null_ls.builtins.formatting.crystal_format }
Defaults
  • filetypes = { "crystal" }
  • command = "crystal"
  • args = { "tool", "format" }
About

Formatter for D source code

Usage
local sources = { null_ls.builtins.formatting.dfmt }
Defaults
  • filetypes = { "d" }
  • command = "dfmt"
  • args = {}
About

Replace the whitespace in your program with formatting that follows Dart guidelines.

Usage
local sources = { null_ls.builtins.formatting.dart_format }
Defaults
  • filetypes = { "dart" }
  • command = "dart"
  • args = { "format" }
About

Use deno to format TypeScript and JavaScript code

Usage
local sources = { null_ls.builtins.formatting.deno_fmt }
Defaults
  • filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" }
  • command = "deno"
  • args = { "fmt", "-"}
About

elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide

Usage
local sources = { null_ls.builtins.formatting.elm_format }
Defaults
  • filetypes = { "elm" }
  • command = "elm-format"
  • args = { "--stdin", "--elm-version=0.19" }
About

Fixes problems in your JavaScript code.

  • Slow and not suitable for formatting on save. If at all possible, use eslint_d (described below).
Usage
local sources = { null_ls.builtins.formatting.eslint }
Defaults
  • filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte" }
  • command = "eslint"
  • args = { "--fix-dry-run", "--format", "JSON", "--stdin", "--stdin-filename", "$FILENAME" }
About

An absurdly fast formatter (and linter).

Usage
local sources = { null_ls.builtins.formatting.eslint_d }
Defaults
  • filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte" }
  • command = "eslint_d"
  • args = { "--fix-to-stdout", "--stdin", "--stdin-filepath", "$FILENAME" }
About

Opinionated erlang code formatter.

Usage
local sources = { null_ls.builtins.formatting.erlfmt }
Defaults
  • filetypes = { "erlang" }
  • command = "erlfmt"
  • args = { "-" }
About

Indent or otherwise prettify a piece of fish code.

Usage
local sources = { null_ls.builtins.formatting.fish_indent }
Defaults
  • filetypes = { "fish" }
  • command = "fish_indent"
  • args = {}
About

fixjson is a JSON file fixer/formatter for humans using (relaxed) JSON5.

Usage
local sources = { null_ls.builtins.formatting.fixjson }
Defaults
  • filetypes = { "json" }
  • command = "fixjson"
  • args = {}
local sources = {null_ls.builtins.formatting.fnlfmt}

fnlfmt is a Fennel code formatter which follows established lisp conventions when determining how to format a given piece of code.

  • filetypes: { "fennel", "fnl" }
  • command: "fnlfmt"
  • args: { "--fix" }
About

fprettify is an auto-formatter for modern Fortran code that imposes strict whitespace formattin.

Usage
local sources = { null_ls.builtins.formatting.fprettify }
Defaults
  • filetypes = { "fortran" }
  • command = "fprettify"
  • args = { "--silent" }
About

Applies a base formatter (eg. goimports or gofmt), then shorten long lines of code

Usage
local sources = { null_ls.builtins.formatting.golines }
Defaults
  • filetypes = { "go" }
  • command = "golines"
  • args = {}
About

Updates your Go import lines, adding missing ones and removing unreferenced ones.

Usage
local sources = { null_ls.builtins.formatting.goimports }
Defaults
  • filetypes = { "go" }
  • command = "goimports"
  • args = {}
About

Formats go programs.

  • It uses tabs for indentation and blanks for alignment.
  • Alignment assumes that an editor is using a fixed-width font.
Usage
local sources = { null_ls.builtins.formatting.gofmt }
Defaults
  • filetypes = { "go" }
  • command = "gofmt"
  • args = {}
About

Enforce a stricter format than gofmt, while being backwards compatible. That is, gofumpt is happy with a subset of the formats that gofmt is happy with.

Usage
local sources = { null_ls.builtins.formatting.gofumpt }
Defaults
  • filetypes = { "go" }
  • command = "gofumpt"
  • args = {}
About

python utility / library to sort imports alphabetically, and automatically separated into sections and by type.

Usage
local sources = { null_ls.builtins.formatting.isort }
Defaults
  • filetypes = { "python" }
  • command = "isort"
  • args = { "--stdout", "--profile", "black", "-" }
About

python utility tool for automatically reordering python imports. Similar to isort but uses static analysis more.

Usage
local sources = { null_ls.builtins.formatting.reorder_python_imports }
Defaults
  • filetypes = { "python" }
  • command = "reorder-python-imports"
  • args = { "-", "--exit-zero-even-if-changed" }
About

Provides a simple command line interface to validate and pretty-print JSON objects.

Usage
local sources = { null_ls.builtins.formatting.json_tool }
Defaults
  • filetypes = { "json" }
  • command = "python"
  • args = { "-m", "json.tool" }
About

A flexible but slow lua formatter. Not recommended for formatting on save.

Usage
local sources = { null_ls.builtins.formatting.lua_format }
Defaults
  • filetypes = { "lua" }
  • command = "lua-format"
  • args = { "-i" }
About

Can fix some (but not all!) markdownlint issues. If possible, use Prettier, which can also fix Markdown files.

Usage
local sources = { null_ls.builtins.formatting.markdownlint }
Defaults
  • filetypes = { "markdown" }
  • command = "markdownlint"
  • args = { "--fix", "$FILENAME" }
About

Build tool that provides tasks for creating, compiling, and testing elixir projects, managing its dependencies, and more.

Usage
local sources = { null_ls.builtins.formatting.mix }
Defaults
  • filetypes = { "elixir" }
  • command = "mix"
  • args = { "format", "-" }
About

A code formatter for Surface, the server-side rendering component library for Phoenix.

Usage
local sources = { null_ls.builtins.formatting.surface }
Defaults
  • filetypes = { "elixir", "surface" }
  • command = "mix"
  • args = { "surface.format", "-" }
About

Beautifies and formats nginx configuration files.

Usage
local sources = { null_ls.builtins.formatting.nginx_beautifier }
Defaults
  • filetypes = { "nginx" }
  • command = "nginxbeautifier"
  • args = { "-i" }
About

nixfmt is a formatter for Nix code, intended to easily apply a uniform style.

Usage
local sources = { null_ls.builtins.formatting.nixfmt }
Defaults
  • filetypes = { "nix" }
  • command = "nixfmt"
About

perl script which indents and reformats perl scripts to make them easier to read. If you write perl scripts, or spend much time reading them, you will probably find it useful.

Usage
local sources = { null_ls.builtins.formatting.perltidy }
Defaults
  • filetypes = { "perl" }
  • command = "perltidy"
  • args = { "-q" }
About

Tokenizes PHP files and detects violations of a defined set of coding standards.

Usage
local sources = { null_ls.builtins.formatting.phpcbf }
Defaults
  • filetypes = { "php" }
  • command = "phpcbf"
  • args = { "--standard=PSR12", "-" }
About
  • Supports both textDocument/formatting and textDocument/rangeFormatting
  • May not work on some filetypes.
Usage
local sources = { null_ls.builtins.formatting.prettier }
Defaults
  • filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte", "css", "scss", "less", "html", "json", "yaml", "markdown", "graphql" }
  • command = "prettier"
  • args = { "--stdin-filepath", "$FILENAME" }
About
  • A faster version of prettier that doesn't seem to work well on non-JavaScript filetypes.
  • Supports both textDocument/formatting and textDocument/rangeFormatting
  • May not work on some filetypes.
  • prettierd is more stable and recommended.
Usage
local sources = { null_ls.builtins.formatting.prettier_d_slim }
Defaults
  • filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte", "css", "scss", "less", "html", "json", "yaml", "markdown", "graphql" }
  • command = "prettier_d_slim"
  • args = { "--stdin", "--stdin-filepath", "$FILENAME" }
About
  • Another "prettier, but faster" formatter, with better support for non-JavaScript filetypes.

  • Does not support textDocument/rangeFormatting.

Usage
local sources = { null_ls.builtins.formatting.prettierd }
Defaults
  • filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte", "css", "scss", "less", "html", "json", "yaml", "markdown", "graphql" }
  • command = "prettierd"
  • args = { "$FILENAME" }
About

Formatter for prisma filetype.

Usage
local sources = { null_ls.builtins.formatting.prismaFmt }
Defaults
  • filetypes = { "prisma" }
  • command = "prisma-fmt"
  • args = { "format", "-i", "$FILENAME" }
About
  • Format R code automatically.
  • Supports both textDocument/formatting and textDocument/rangeFormatting.
Usage
local sources = { null_ls.builtins.formatting.format_r }
Defaults
  • filetypes = { "r", "rmd" }
  • command = "R"
  • args = { "--slave", "--no-restore", "--no-save", "-e", 'formatR::tidy_source(source="stdin")' }
About

Ruby static code analyzer and formatter, based on the community Ruby style guide.

Usage
local sources = { null_ls.builtins.formatting.rubocop }
Defaults
  • filetypes = { "ruby" }
  • command = "rubocop"
  • args = { "--auto-correct", "-f", "quiet", "--stderr", "--stdin", "$FILENAME" }
About

Opinionated ruby formatter.

Usage
local sources = { null_ls.builtins.formatting.rufo }
Defaults
  • filetypes = { "ruby" }
  • command = "rufo"
  • args = { "-x" }
About

Reformat Zig source into canonical form

Usage
local sources = { null_ls.builtins.formatting.zigfmt }
Defaults
  • filetypes = { "zig" }
  • command = "zig"
  • args = { "fmt", "--stdin" }
About

A tool for formatting rust code according to style guidelines.

Usage
local sources = { null_ls.builtins.formatting.rustfmt }
Defaults
  • filetypes = { "rust" }
  • command = "rustfmt"
  • args = { "--emit=stdout", "--edition=2018" }
About

CLI for organizing Tailwind CSS classes.

Usage
local sources = { null_ls.builtins.formatting.rustywind }
Defaults
  • filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte", "html", }
  • command = "rustywind"
  • args = { "--stdin" }
About

A shell script static analysis tool.

Usage
local sources = { null_ls.builtins.diagnostics.shellcheck }
Defaults
  • filetypes = { "sh" }
  • command = "shellcheck"
  • args = { "--format", "json1", "-" },
About

The sqlformat command-line tool can be used to reformat SQL file according to specified options.

Usage
local sources = { null_ls.builtins.formatting.sqlformat }
Defaults
  • filetypes = { "sql" }
  • command = "sqlformat"
  • args = { "--reindent", "-" }
About

Code formatter for Scala

Usage
local sources = { null_ls.builtins.formatting.scalafmt }
Defaults
  • filetypes = { "scala" }
  • command = "scalafmt"
  • args = { "--stdin" }
About

A shell parser, formatter, and interpreter with bash support

Usage
local sources = { null_ls.builtins.formatting.shfmt }
Defaults
  • filetypes = { "sh", "zsh" }
  • command = "shfmt"
  • args = {}
About

Hardens shell scripts by quoting variables, replacing `function_call` with $(function_call), and more

Usage
local sources = { null_ls.builtins.formatting.shellharden }
Defaults
  • filetypes = { "sh" }
  • command = "shellharden"
  • args = { "--transform", "$FILENAME" }
About

Ruby Style Guide, with linter & automatic code fixer. Based on Rubocop.

Usage
local sources = { null_ls.builtins.formatting.standardrb }
Defaults
  • filetypes = { "ruby" }
  • command = "standardrb"
  • args = { "--fix", "--format", "quiet", "--stderr", "--stdin", "$FILENAME" }
About
  • Non-invasive pretty printing of R code.
  • Supports both textDocument/formatting and textDocument/rangeFormatting.
Usage
local sources = { null_ls.builtins.formatting.styler }
Defaults
  • filetypes = { "r", "rmd" }
  • command = "R"
  • args = { "--slave", "--no-restore", "--no-save", "-e", 'con=file("stdin");output=styler::style_text(readLines(con));close(con);print(output, colored=FALSE)' }
About
  • A fast and opinionated Lua formatter written in Rust. Highly recommended!
  • Supports both textDocument/formatting and textDocument/rangeFormatting. Note that as of now, the range must include a top-level statement for range formatting to work (see this issue for details).
Usage
local sources = { null_ls.builtins.formatting.stylua }
Defaults
  • filetypes = { "lua" }
  • command = "stylua"
  • args = { "-s", "-" }
About

SwiftFormat is a code library and command-line tool for reformatting swift code on macOS or Linux.

Usage
local sources = { null_ls.builtins.formatting.swiftformat }
Defaults
  • filetypes = { "swift" }
  • command = "swiftformat"
  • args = {}
About

The terraform-fmt command is used to rewrite terraform configuration files to a canonical format and style.

Usage
local sources = { null_ls.builtins.formatting.terraform_fmt }
Defaults
  • filetypes = { "tf", "hcl" }
  • command = "terraform"
  • args = { "fmt", "-" }

trim_newlines

About

A simple wrapper around awk to remove trailing newlines.

Usage
local sources = { null_ls.builtins.formatting.trim_newlines }
Defaults
  • filetypes = { }
  • command = "awk"
  • args = { 'NF{print s $0; s=""; next} {s=s ORS}' }

if you want to use this with specific filetypes you can set using with

local sources = { null_ls.builtins.formatting.trim_newlines.with({
    filetypes = { "lua", "c", "cpp }
}) }

trim_whitespace

About

A simple wrapper around awk to remove trailing whitespace.

Usage
local sources = { null_ls.builtins.formatting.trim_whitespace }
Usage
  • filetypes = { }
  • command = "awk"
  • args = { '{ sub(/[ \t]+$/, ""); print }' }

if you want to use this with specific filetypes you can set using with

local sources = { null_ls.builtins.formatting.trim_whitespace.with({
    filetypes = { "lua", "c", "cpp }
}) }
About

A source code beautifier for C, C++, C#, ObjectiveC, D, java, pawn and VALA.

Usage
local sources = { null_ls.builtins.formatting.uncrustify }
Defaults
  • filetypes = { "c", "cpp", "cs", "java" }
  • command = "uncrustify"
  • args = { "-q", "-l <LANG>" }
About

Formatter for python files

Usage
local sources = { null_ls.builtins.formatting.yapf }
Defaults
  • filetypes = { "python" }
  • command = "yapf"
  • args = { "--quiet" }
About

Formatter for python files

Usage
local sources = { null_ls.builtins.formatting.autopep8 }
Defaults
  • filetypes = { "python" }
  • command = "autopep8"
  • args = { "-" }
About

Formatter for php files

Usage
local sources = { null_ls.builtins.formatting.phpcsfixer }
Defaults
  • filetypes = { "php" }
  • command = "php-cs-fixer"
  • args = { '--no-interaction', '--quiet', 'fix', "$FILENAME" }
About

A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.

Usage
local sources = { null_ls.builtins.formatting.stylelint }
Defaults
  • filetypes = { "scss", "less", "css", "sass" }
  • command = "stylelint"
  • args = { "--fix", "--stdin", "-" }

Diagnostics

About

latex semantic linter.

Usage
local sources = { null_ls.builtins.diagnostics.chktex }
Defaults
  • filetypes = { "tex" }
  • command = "chktex"
  • args = { "-q", "-I0", "-f%l:%c:%d:%k:%m\n" }
About

codespell fix common misspellings in text files.

Usage
local sources = { null_ls.builtins.diagnostics.codespell }
Defaults
  • filetypes = {}
  • command = "codespell"
  • args = { "-" }
About

A linter for the javascript ecosystem.

  • Note that the null-ls builtin requires your eslint executable to be available on your $PATH.
  • To use local (project) executables, use the integration in nvim-lsp-ts-utils or try the ESLint language server.
Usage
local sources = { null_ls.builtins.diagnostics.eslint }
Defaults
  • filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte" }
  • command = "eslint"
  • args = { "-f", "json", "--stdin", "--stdin-filename", "$FILENAME" }
About

An absurdly fast linter (and formatter).

  • See the notes re: ESLint above.
Usage
local sources = { null_ls.builtins.diagnostics.eslint_d }
Defaults
  • filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte" }
  • command = "eslint"
  • args = { "-f", "json", "--stdin", "--stdin-filename", "$FILENAME" }
About

flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.

Usage
local sources = { null_ls.builtins.diagnostics.flake8 }
Defaults
  • filetypes = { "python" }
  • command = "flake8"
  • args = { "--stdin-display-name", "$FILENAME", "-" }
About

A smarter Dockerfile linter that helps you build best practice Docker images.

Usage
local sources = { null_ls.builtins.diagnostics.hadolint }
Defaults
  • filetypes = { "Dockerfile", "dockerfile" }
  • command = "hadolint"
  • args = { "--no-fail", "--format=json", "$FILENAME" }
About

A tool for linting and static analysis of lua code.

Usage
local sources = { null_ls.builtins.diagnostics.luacheck }
Defaults
  • filetypes = { "lua" }
  • command = "luacheck"
  • args = { "--formatter", "plain", "--codes", "--ranges", "--filename", "$FILENAME", "-" }
About

A tool for fast static analysis of C/C++ code

Usage
local sources = { null_ls.builtins.diagnostics.cppcheck }
Defaults
  • filetypes = { "cpp" , "c" }
  • command = "cppcheck"
  • args = { "--enable=warning,style,performance,portability", "--template=gcc", "$FILENAME" }
About

English prose linter.

Usage
local sources = {null_ls.builtins.diagnostics.write_good}
Defaults
  • filetypes = { "markdown" }
  • command = "write"-good
  • args = { "--text=$TEXT", "--parse" }
About

An English prose linter.

proselint places the world’s greatest writers and editors by your side, where they whisper suggestions on how to improve your prose.

-- Proselint

Usage
local sources = { null_ls.builtins.diagnostics.proselint }
Defaults
  • filetypes = { "markdown", "tex" }
  • command = "proselint"
  • args = { "--json" }
About

markdown style and syntax checker.

Usage
local sources = { null_ls.builtins.diagnostics.markdownlint }
Defaults
  • filetypes = { "markdown" }
  • command = "markdownlint"
  • args = { "--stdin" }
About

Pylint is a Python static code analysis tool which looks for programming errors, helps enforcing a coding standard, sniffs for code smells and offers simple refactoring suggestions.

Usage
local sources = { null_ls.builtins.diagnostics.pylint }
Defaults
  • filetypes = { "python" }
  • command = "pylint"
  • args = {"--from-stdin", "$FILENAME", "-f", "json"}
About

Syntax-aware linter for prose built with speed and extensibility in mind.

Usage
  • vale does not include a syntax by itself, so you probably need to grab a vale.ini (at "~/.vale.ini") and a StylesPath (somewhere, pointed from vale.ini) from here.
local sources = {null_ls.builtins.diagnostics.vale}
Defaults
  • filetypes = { "markdown", "tex" }
  • command = "vale"
  • args = { "--no-exit", "--output=JSON", "$FILENAME" }
About

Lints and suggestions for the nix programming language

Usage
local sources = {null_ls.builtins.diagnostics.statix}
Defaults
  • filetypes = { "nix" }
  • command = "statix"
  • args = { "check", "--format=errfmt", "--", "$FILENAME" }
About

Turns tl check command into a linter. Works on change.

LSP Support
Usage
local sources = { null_ls.builtins.diagnostics.teal }
Defaults
  • filetypes = { "teal" }
  • command = "tl"
  • args = { "check", "$FILENAME" }
About

Correct commonly misspelled English words in source files

Usage
local sources = { null_ls.builtins.diagnostics.misspell }
Defaults
  • filetypes = {}
  • command = "misspell"
  • args = { "$FILENAME" }
About

Linter for vimscript.

Usage
local sources = { null_ls.builtins.diagnostics.vint }
Defaults
  • filetypes = { "vim" }
  • command = "vint"
  • args = { "-s", "-j", "$FILENAME" }
About

Command line tool designed to help write correct and idiomatic lua code.

Usage
local sources = { null_ls.builtins.diagnostics.selene }
Defaults
  • filetypes = { "lua" }
  • command = "selene"
  • args = { "--display-style", "quiet", "-" }
About

The Ruby Linter/Formatter that Serves and Protects.

Usage
local sources = { null_ls.builtins.diagnostics.standardrb }
Defaults
  • filetypes = { "ruby" }
  • command = "standardrb"
  • args = { "--no-fix", "-f", "json", "--stdin", "$FILENAME" }
About

PHP Static Analysis Tool

Usage
local sources = { null_ls.builtins.diagnostics.phpstan }
Defaults
  • filetypes = { "php" }
  • command = "phpstan"
  • args = { "analyze", "--error-format", "json", "--no-progress", "$FILENAME" }
Requirements

A valid phpstan.neon at root.

About

A static analysis tool for finding errors in PHP applications

Usage
local sources = { null_ls.builtins.diagnostics.psalm }
Defaults
  • filetypes = { "php" }
  • command = "psalm"
  • args = { "--output-format=json", "--no-progress", "$FILENAME" }
Requirements

A valid psalm.xml at root.

About

PHP_CodeSniffer is a script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard.

Usage
local sources = { null_ls.builtins.diagnostics.phpcs }
Defaults
  • filetypes = { "php" }
  • command = "phpcs"
  • args = { "--report=json", "-s", "-" }
About

The Ruby Linter/Formatter that Serves and Protects.

Usage
local sources = { null_ls.builtins.diagnostics.rubocop }
Defaults
  • filetypes = { "ruby" }
  • command = "rubocop"
  • args = { "-f", "json", "--stdin", "$FILENAME" }
About

A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.

Usage
local sources = { null_ls.builtins.diagnostics.stylelint }
Defaults
  • filetypes = { "scss", "less", "css", "sass" }
  • command = "stylelint"
  • args = { "--formatter", "json", "--stdin-filename", "$FILENAME" }
About

A linter for YAML files.

Usage
local sources = { null_ls.builtins.diagnostics.yamllint }
Defaults
  • filetypes = { "yaml" }
  • command = "yamllint"
  • args = { "--format", "parsable", "-" }

Code actions

About

Injects code actions for Git operations at the current cursor position (stage / preview / reset hunks, blame, etc.).

Usage
local sources = { null_ls.builtins.code_actions.gitsigns }
Defaults
  • filetypes = {}
About

The Refactoring library based off the Refactoring book by Martin Fowler.

Usage
  • Requires visually selecting the code you want to refactor and calling :'<,'>lua vim.lsp.buf.range_code_action() (for the default handler) or :'<,'>Telescope lsp_range_code_actions (for Telescope).
local sources = { null_ls.builtins.code_actions.refactoring }
Defaults
  • filetypes = { "go", "javascript", "lua", "python", "typescript" }
About

Lints and suggestions for the nix programming language.

Usage
local sources = { null_ls.builtins.code_actions.statix }
Defaults
  • filetypes = { "nix" }
  • command = "statix"
  • args = { "check", "--format=json", "--", "$FILENAME" }
About

An English prose linter. Can fix some issues via code actions.

Usage
local source = { null_ls.builtins.code_actions.proselint }
Defaults
  • filetypes = { "markdown", "tex" }
  • command = "proselint"
  • args = { "--json" }

Hover

Dictionary definitions via dictionaryapi.dev

About

Shows the first available definition for the current word under the cursor.

Usage
  • Proof-of-concept for hover functionality. PRs to add more info (e.g. more than one definition, part of speech) are welcome.
  • Depends on Plenary's curl module, which itself depends on having curl installed and available on your $PATH.
  • See the Hover section of the documentation for limitations.
local sources = { null_ls.builtins.hover.dictionary }
Defaults
  • filetypes = { "txt", "markdown" }