From e566cb84877ea058334c163cbe8b745bb98570ea Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 29 Nov 2022 09:31:22 +0100 Subject: [PATCH] Temporary solution to enable prettier plugins: add a file, for instance .prettier-sql, to enable prettier for sql files in that directory and its subdirectories --- src/source.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/source.cpp b/src/source.cpp index 39e5864..cbbc8b9 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -767,6 +767,21 @@ void Source::View::setup_format_style(bool is_generic_view) { shown = true; } + if(!prettier.empty() && !prefer_prettier) { + auto search_path = file_path.parent_path(); + auto file = ".prettier-" + language_id; + while(true) { + boost::system::error_code ec; + if(boost::filesystem::exists(search_path / file, ec)) { + prefer_prettier = true; + break; + } + if(search_path == search_path.root_directory()) + break; + search_path = search_path.parent_path(); + } + } + if(!prettier.empty() && prefer_prettier) { if(is_generic_view) { goto_next_diagnostic = [this] {