[go: up one dir, main page]

Skip to content

Minimalistic alternative to the plugin mason-null-ls with support for external sources.

License

Notifications You must be signed in to change notification settings

Zeioth/none-ls-autoload.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimalistic alternative to the plugin mason-null-ls with support for none-ls external sources.

Table of contents

Why

Problem:

  • Normally when you use none-ls you would have to manually register the sources you want to load.
  • You would also have to manually deregister sources when you uninstall them, or none-ls will display errors.

Solution:

  • By using none-ls-autoload.nvim, you don't have to worry about any of that. This plugin will take care of automatically load/unload all mason packages you install/uninstall when necessary.

How to install

{
  "zeioth/none-ls-autoload.nvim",
  event = "BufEnter",
  dependencies = { "williamboman/mason.nvim", "nvimtools/none-ls.nvim" },
  opts = {},
},

How to use none-ls external sources

What are they?

The none-ls project stop supporting builtin sources when they have not been maintained for a while. Knowing that: External sources are packages you can install to use sources not oficially supported by none-ls.

How to install them

  • You install the dependency.
  • Then you tell none-ls-autoload.nvim where to find it with the option external_sources.
{
  "zeioth/none-ls-autoload.nvim",
  event = "BufEnter",
  dependencies = {
    "williamboman/mason.nvim",
    "zeioth/none-ls-external-sources.nvim" -- To install a external sources library.
  },
  opts = {
    external_sources = {
      -- To specify where to find a external source.
      'none-ls-external-sources.formatting.reformat_gherkin'
    },
  },
},

It's important to be aware a source is just a way to tell none-ls how to use a mason package. You HAVE to install the mason package to use it.

Available options

Option Default Description
external_sources {} If a mason package is not directly supported through a none-ls builtin source, you can specify a external source, so none-ls-autoload.nvim know how to load/unload it automatically when needed.
methods { diagnostics = true, formatting = true, code_actions = true, completion = true, hover = true } The type of sources we should load. This is handy in case you want to disable a certain kind of client. Or in case you want to manage a certain functionality using a different plugin.

🌟 Support the project

If you want to help me, please star this repository to increase the visibility of the project.

Stargazers over time

FAQ

  • Do I need mason for this plugin to work? Yes.
  • Do this plugin interfere with my none-ls options? No.
  • Do external sources have priority over builtin sources? Yes, if both are present, the external source you define will have priority.
  • How is this plugin different from mason-null-ls? Only a couple things. We add a new feature: support for external sources. We remove a feature: We don't provide commands to manually load/unload sources, as we do it automatically anyway. Aditionally, we aim to keep the code easier to understand and contribute to.
  • My external none-ls source doesn't load correctly: The source you pass must be formated like '<anything-you-want>.<method>.<source-name>', as we extract the last two fields to load it. For example 'package_name.subdirectory.formatting.reformat_gherkin'. So if the external source you are trying to pass come from a repository not formatted that way, just fork it and fix its directory structure.
  • Where can I find external sources?: Here.