plugins.none-ls.settings

Options provided to the require('null-ls').setup function.

Type: attribute set of anything

Default: { }

Example:

{
  diagnostics_format = "[#{c}] #{m} (#{s})";
  on_attach = ''
    function(client, bufnr)
      -- Integrate lsp-format with none-ls
      require('lsp-format').on_attach(client, bufnr)
    end
  '';
  on_exit = ''
    function()
      print("Goodbye, cruel world!")
    end
  '';
  on_init = ''
    function(client, initialize_result)
      print("Hello, world!")
    end
  '';
  root_dir = ''
    function(fname)
      return fname:match("my-project") and "my-project-root"
    end
  '';
  root_dir_async = ''
    function(fname, cb)
      cb(fname:match("my-project") and "my-project-root")
    end
  '';
  should_attach = ''
    function(bufnr)
      return not vim.api.nvim_buf_get_name(bufnr):match("^git://")
    end
  '';
  temp_dir = "/tmp";
  update_in_insert = false;
}

Declared by:

plugins.none-ls.settings.border

Defines the border to use for the :NullLsInfo UI window. Uses NullLsInfoBorder highlight group (see Highlight Groups). Accepts same border values as nvim_open_win(). See :help nvim_open_win() for more info.

Type: null or (attribute set) or string or raw lua code

Default: null

Plugin default: null

Declared by:

plugins.none-ls.settings.cmd

Defines the command used to start the null-ls server. If you do not have an nvim binary available on your $PATH, you should change this to an absolute path to the binary.

Type: null or (list of (string or raw lua code))

Default: null

Plugin default:

[
  "nvim"
]

Declared by:

plugins.none-ls.settings.debounce

The debounce setting controls the amount of time between the last change to a buffer and the next textDocument/didChange notification. These notifications cause null-ls to generate diagnostics, so this setting indirectly controls the rate of diagnostic generation (affected by update_in_insert, described below).

Lowering debounce will result in quicker diagnostic refreshes at the cost of running diagnostic sources more frequently, which can affect performance. The default value should be enough to provide near-instantaneous feedback from most sources without unnecessary resource usage.

Type: null or unsigned integer, meaning >=0, or raw lua code

Default: null

Plugin default: 250

Declared by:

plugins.none-ls.settings.debug

Displays all possible log messages and writes them to the null-ls log, which you can view with the command :NullLsLog. This option can slow down Neovim, so it’s strongly recommended to disable it for normal use.

debug = true is the same as setting log_level to "trace".

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

plugins.none-ls.settings.default_timeout

Sets the amount of time (in milliseconds) after which built-in sources will time out. Note that built-in sources can define their own timeout period and that users can override the timeout period on a per-source basis, too (see BUILTIN_CONFIG.md).

Specifying a timeout with a value less than zero will prevent commands from timing out.

Type: null or unsigned integer, meaning >=0, or raw lua code

Default: null

Plugin default: 5000

Declared by:

plugins.none-ls.settings.diagnostic_config

Specifies diagnostic display options for null-ls sources, as described in :help vim.diagnostic.config(). (null-ls uses separate namespaces for each source, so server-wide configuration will not work as expected.)

You can also configure diagnostic_config per built-in by using the with method, described in BUILTIN_CONFIG.

Type: null or (attribute set) or string or raw lua code

Default: null

Plugin default: { }

Declared by:

plugins.none-ls.settings.diagnostics_format

Sets the default format used for diagnostics. The plugin will replace the following special components with the relevant diagnostic information:

  • #{m}: message
  • #{s}: source name (defaults to null-ls if not specified)
  • #{c}: code (if available)

For example, setting diagnostics_format to the following:

  diagnostics_format = "[#{c}] #{m} (#{s})"

Formats diagnostics as follows:

  [2148] Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. (shellcheck)

You can also configure diagnostics_format per built-in by using the with method, described in BUILTIN_CONFIG.

Type: null or string or raw lua code

Default: null

Plugin default: "#{m}"

Declared by:

plugins.none-ls.settings.fallback_severity

Defines the severity used when a diagnostic source does not explicitly define a severity. See :help diagnostic-severity for available values.

Type: null or unsigned integer, meaning >=0, or raw lua code

Default: null

Plugin default:

{
  __raw = "vim.diagnostic.severity.ERROR";
}

Declared by:

plugins.none-ls.settings.log_level

Enables or disables logging to file.

Plugin logs messages on several logging levels to following destinations:

  • file, can be inspected by :NullLsLog.
  • neovim’s notification area.

Type: null or one of “off”, “error”, “warn”, “info”, “debug”, “trace” or raw lua code

Default: null

Plugin default: "warn"

Declared by:

plugins.none-ls.settings.notify_format

Sets the default format for vim.notify() messages. Can be used to customize 3rd party notification plugins like nvim-notify.

Type: null or string or raw lua code

Default: null

Plugin default: "[null-ls] %s"

Declared by:

plugins.none-ls.settings.on_attach

Defines an on_attach callback to run whenever null-ls attaches to a buffer. If you have a common on_attach you’re using for LSP servers, you can reuse that here, use a custom callback for null-ls, or leave this undefined.

Type: null or lua function string

Default: null

Plugin default: null

Declared by:

plugins.none-ls.settings.on_exit

Defines an on_exit callback to run when the null-ls client exits.

Type: null or lua function string

Default: null

Plugin default: null

Declared by:

plugins.none-ls.settings.on_init

Defines an on_init callback to run when null-ls initializes. From here, you can make changes to the client (the first argument) or initialize_result (the second argument, which as of now is not used).

Type: null or lua function string

Default: null

Plugin default: null

Declared by:

plugins.none-ls.settings.root_dir

Determines the root of the null-ls server. On startup, null-ls will call root_dir with the full path to the first file that null-ls attaches to.

If root_dir returns nil, the root will resolve to the current working directory.

Type: null or lua function string

Default: null

Plugin default: "require('null-ls.utils').root_pattern('.null-ls-root', 'Makefile', '.git')"

Example:

''
  function(fname)
    return fname:match("my-project") and "my-project-root"
  end
''

Declared by:

plugins.none-ls.settings.root_dir_async

Like root_dir but also accepts a callback parameter allowing it to be asynchronous. Overwrites root_dir when present.

For a utility that asynchronously finds a matching file, see utils.root_pattern_async.

Type: null or lua function string

Default: null

Plugin default: null

Example:

''
  function(fname, cb)
    cb(fname:match("my-project") and "my-project-root")
  end
''

Declared by:

plugins.none-ls.settings.should_attach

A user-defined function that controls whether to enable null-ls for a given buffer. Receives bufnr as its first argument.

To cut down potentially expensive calls, null-ls will call should_attach after its own internal checks pass, so it’s not guaranteed to run on each new buffer.

Type: null or lua function string

Default: null

Plugin default: null

Example:

''
  function(bufnr)
    return not vim.api.nvim_buf_get_name(bufnr):match("^git://")
  end
''

Declared by:

plugins.none-ls.settings.temp_dir

Defines the directory used to create temporary files for sources that rely on them (a workaround used for command-based sources that do not support stdio).

To maximize compatibility, null-ls defaults to creating temp files in the same directory as the parent file. If this is causing issues, you can set it to /tmp (or another appropriate directory) here. Otherwise, there is no need to change this setting.

Note: some null-ls built-in sources expect temp files to exist within a project for context and so will not work if this option changes.

You can also configure temp_dir per built-in by using the with method, described in BUILTIN_CONFIG.

Type: null or string or raw lua code

Default: null

Plugin default: null

Declared by:

plugins.none-ls.settings.update_in_insert

Controls whether diagnostic sources run in insert mode. If set to false, diagnostic sources will run upon exiting insert mode, which greatly improves performance but can create a slight delay before diagnostics show up. Set this to true if you don’t experience performance issues with your sources.

Note that by default, Neovim will not display updated diagnostics in insert mode. Together with the option above, you need to pass update_in_insert = true to vim.diagnostic.config for diagnostics to work as expected. See :help vim.diagnostic.config for more info.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by: