From 0255b8fdb16e81a84d3642df96bd8d504fcb4a40 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 6 Jun 2024 17:38:12 +0200 Subject: [PATCH] fix(prettier): use prettier to check if prettier should run on the file --- lua/lazyvim/plugins/extras/formatting/prettier.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/extras/formatting/prettier.lua b/lua/lazyvim/plugins/extras/formatting/prettier.lua index 13cdf433..c0a84cba 100644 --- a/lua/lazyvim/plugins/extras/formatting/prettier.lua +++ b/lua/lazyvim/plugins/extras/formatting/prettier.lua @@ -57,9 +57,8 @@ return { return true end if enabled[ctx.filename] == nil then - enabled[ctx.filename] = vim.fs.find(function(name, path) - return name:match("^%.prettierrc%.?") or name:match("^prettier%.config%.") - end, { path = ctx.filename, upward = true })[1] ~= nil + vim.fn.system({ "prettier", "--find-config-path", ctx.filename }) + enabled[ctx.filename] = vim.v.shell_error == 0 end return enabled[ctx.filename] end,