Skip to content

Automatically register linters and formatters installed in mason.nvim -- with async bugfix

License

Notifications You must be signed in to change notification settings

TungstnBallon/mason-bridge.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mason-bridge.nvim

mason-bridge automatically registers linters and formatters installed using mason.nvim in conform.nvim and nvim-lint.

Introduction

  • Automatically generates the formatters_by_ft and linters_by_ft tables to be used in their respective plugins
  • Provides and override in case the tool name and linter name mismatch e.g. snyk and snyk_iac

Requirements

  • neovim >= 0.7.0
  • mason.nvim
  • conform.nvim
  • nvim-lint

Installation

use {
    "williamboman/mason.nvim",
    "frostplexx/mason-bridge.nvim",
    "stevearc/conform.nvim",
    "mfussenegger/nvim-lint"
}
{
    "williamboman/mason.nvim",
    "frostplexx/mason-bridge.nvim",
    "stevearc/conform.nvim",
    "mfussenegger/nvim-lint"
}

Setup

It's important that you set up the plugins in the following order:

  1. mason.nvim
  2. mason-bridge
  3. conform.nvim and/or nvim-lint (this order doesnt matter)

Pay extra attention to this if you lazy-load plugins, or somehow "chain" the loading of plugins via your plugin manager.

require("mason").setup()
require("mason-bridge").setup()

-- After setting up mason-bridge you may set up conform.nvim and nvim-lint
require("conform").setup({
    formatters_by_ft = require("mason-bridge").get_formatters(),
})

require("lint").linters_by_ft = require("mason-bridge").get_linters()
-- ...

Refer to the Configuration section for information about which settings are available.

Configuration

You may optionally configure certain behavior of mason-bridge.nvim when calling the .setup() function. Refer to the default configuration for a list of all available settings.

Example:

require("mason-bridge").setup({
    overrides = {
        linters = {
            javascript = { "snyk_iac" },
            docker = { "snyk_iac" }
        },
        formatters = {
            my_language = {"formatter_1", "formatter_2"}
        }
    }
})

Default configuration

local DEFAULT_SETTINGS = {
    -- A table of filetypes with the respective tool (or tools) to be used
    overrides = {
        formatters = {},
        linters = {}
    }
}

Roadmap

  • Add a handler system similar to mason-lspconfig.nvim and mason-nvim-dap.nvim
  • Testing if the all filetypes are detected correctly is required
  • Add vim help file

Similar Projects

About

Automatically register linters and formatters installed in mason.nvim -- with async bugfix

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%