From 725f770d472f18ea59e31ce8b34991d8a9463830 Mon Sep 17 00:00:00 2001 From: Lucas Garcia Rubio Date: Sat, 19 Apr 2025 21:01:04 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20cria=20fun=C3=A7=C3=A3o=20para=20retorn?= =?UTF-8?q?ar=20formatter=20quando=20filetype=20for=20typescript?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index ddfe0e2c..d323462b 100644 --- a/init.lua +++ b/init.lua @@ -768,7 +768,16 @@ require('lazy').setup({ -- -- You can use 'stop_after_first' to run the first available formatter from the list javascript = { 'prettierd', 'prettier', 'prettierrc', stop_after_first = true }, - typescript = { 'deno_fmt', 'prettier', ' prettierd', 'prettierrc', stop_after_first = true }, + typescript = function() + local root_dir = vim.loop.cwd() + local deno_json_path = root_dir .. '/deno.json' + local deno_jsonc_path = root_dir .. '/deno.jsonc' + if vim.loop.fs_stat(deno_json_path) or vim.loop.fs_stat(deno_jsonc_path) then + return { 'deno_fmt' } + else + return { 'prettier', 'prettierd', 'prettierrc', stop_after_first = true } + end + end, }, }, },