practicalli / practicalli/nvim-astro

none-ls: override default tool configuration

Open
#60 0 comments 0 reactions 1 assignee View on GitHub

@practicalli-johnny is already working on this.

Since Jul 28, 2025.

Dominant language
Lua
Stars
13
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Add a configuration file that allows none-ls (formerly null-ls) default tool configurations.

Example:

  • use a JSONC configuration to provide personal rules use by the markdownlint tool for markdown file type
-- ---------------------------------------------------------
-- Configure format & lint tools
--
-- Ensure tools are installed via Mason
-- Pass configuration files to each tool
-- ---------------------------------------------------------

-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE

---@type LazySpec
return {
  -- use mason-lspconfig to configure LSP installations
  -- use mason-null-ls to configure Formatters/Linter installation for null-ls sources
  {
    "jay-babu/mason-null-ls.nvim",
    -- overrides `require("mason-null-ls").setup(...)`
    opts = function(_, opts)
      -- add more things to the ensure_installed table protecting against community packs modifying it
      opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
        "markdownlint",
        -- add more arguments for adding more null-ls sources
      })
      opts.handlers = {
        markdownlint = function(source_name, methods)
          local null_ls = require "null-ls"
          null_ls.register(null_ls.builtins.diagnostics.markdownlint.with {
            -- extra_args = { "--config", "~/.config/markdownlint.yaml" },
            extra_args = { "--config", "~/.config/markdown-lint.jsonc" },
          })
        end,
      }
    end,
  },
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.