From d1f2664dbf39486bf7827ab2879b0ecc53f326c8 Mon Sep 17 00:00:00 2001 From: Kemboi Elvis Date: Wed, 4 Jun 2025 12:26:43 +0300 Subject: [PATCH] fix: moved to prittier d --- lua/lazyvim/plugins/extras/formatting/prettier.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/formatting/prettier.lua b/lua/lazyvim/plugins/extras/formatting/prettier.lua index 6edd414c..6249f194 100644 --- a/lua/lazyvim/plugins/extras/formatting/prettier.lua +++ b/lua/lazyvim/plugins/extras/formatting/prettier.lua @@ -59,7 +59,7 @@ M.has_parser = LazyVim.memoize(M.has_parser) return { { "mason-org/mason.nvim", - opts = { ensure_installed = { "prettier" } }, + opts = { ensure_installed = { "prettierd", "prettier" } }, }, -- conform @@ -70,11 +70,17 @@ return { opts = function(_, opts) opts.formatters_by_ft = opts.formatters_by_ft or {} for _, ft in ipairs(supported) do - opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {} - table.insert(opts.formatters_by_ft[ft], "prettier") + opts.formatters_by_ft[ft] = { "prettierd", "prettier" } end opts.formatters = opts.formatters or {} + + opts.formatters.prettierd = { + condition = function(_, ctx) + return M.has_parser(ctx) and (vim.g.lazyvim_prettier_needs_config ~= true or M.has_config(ctx)) + end, + } + opts.formatters.prettier = { condition = function(_, ctx) return M.has_parser(ctx) and (vim.g.lazyvim_prettier_needs_config ~= true or M.has_config(ctx)) @@ -90,7 +96,7 @@ return { opts = function(_, opts) local nls = require("null-ls") opts.sources = opts.sources or {} - table.insert(opts.sources, nls.builtins.formatting.prettier) + table.insert(opts.sources, nls.builtins.formatting.prettierd) end, }, }