jose-elias-alvarez / null-ls.nvim

Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
Other
3.63k stars 790 forks source link

per-buffer setup #1373

Open MurdeRM3L0DY opened 1 year ago

MurdeRM3L0DY commented 1 year ago

Issues

Feature description

Provide a function(eg: start_or_attach) to start null-ls server on a per-buffer basis such that it can be used in ftplugin/*

e.g ftplugin/lua.lua

local null = require 'null-ls'
null.start_or_attach { sources = { ... } }

I haven't looked too deeply into the codebase but I imagine this function could be reused in the setup function

Help

Yes, but I don't know how to start. I would need guidance

Implementation help

I would need help with the api design

jose-elias-alvarez commented 1 year ago

Attaching to the client or starting it if needed can be done using try_add (which isn't part of the public API but could be).

However, null-ls config is either global or source-specific, and sources themselves are filetype-specific, so I think proper per-buffer setup would require a larger rewrite.