This repository has been archived by the owner on Aug 12, 2023. It is now read-only.
Replies: 1 comment
-
So instead of registering all of your sources at once, you could instead register sources dynamically. I'm not sure what your exact setup looks like, but assuming you're loading a Lua file, something like this might do the trick: require("null-ls").setup({
on_init = function()
local has_project_local_setup = pcall(require, "project-local-setup")
if not has_project_local_setup then
-- general setup when project-specific setup does not exist
require("null-ls").register({
require("null-ls.builtins.formatting.prettier"),
})
end
end,
})
-- project-local setup (lives in a separate file)
require("null-ls").register({
require("null-ls.builtins.formatting.prettier").with({
command = "/path/to/project/.yarn/sdks/prettier/index.js",
}),
}) I've also seen people do this in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For lsp servers, I do the following:
on_init
client.config.settings
However, for null-ls I cannot do this, because I do not have access to a sources settings.
How can I make project-local settings?
This was a very general question, but my specific usecase is about setting a local executable for a prettierd command. One of my project uses Yarn PnP and prettier executable is located in
/path/to/project/.yarn/sdks/prettier/index.js
. The easiest solution would be to useprefer_local
, however there are 2 issues with it:node_modules/.bin
for other projects)index.js
file if we just extend it to support tables.Beta Was this translation helpful? Give feedback.
All reactions