Closed yosiat closed 2 years ago
Can you switch to a prettier config file instead of using package.json
? You'll just need to create .prettierrc.js
with the content:
module.exports = {
...require("shared-config-pkg"),
};
and remove the "prettier"
key from you package.json
file.
@MunifTanjim I am working on lots (20+) projects that are synced into github, doing this manual change and making sure not committing those changed will be cumbersome..
The change to support this way of work, what it requires from prettier.nvim
except from changing config_file_exists
function to check for package.json
file with prettier
key?
With the latest commit (https://github.com/MunifTanjim/prettier.nvim/commit/643fa3aba695eb1dfcbce8993c3b30a09b91ed6f) you can setup prettier.nvim
like this:
prettier.setup({
["null-ls"] = {
condition = function()
return prettier.config_exists({
check_package_json = true,
})
end,
-- other null-ls options
},
-- other prettier options
})
And it'll look for "prettier"
key in the package.json
file.
Hi,
I am trying to use this plugin together with null-ls and looks it can't work in my projects setup, since I configure prettier (with shared config) in package.json like:
Prettier is not being active source (checked with
NullLsInfo
) because of this line - https://github.com/MunifTanjim/prettier.nvim/blob/main/lua/prettier/utils.lua#L17Is there any option to get configuration option working with current existing code? or a PR is needed?
Update: Managed to get prettier working with null-ls formatting support.