From 4d242cc59b00e135b5666c914df54d411767d970 Mon Sep 17 00:00:00 2001 From: eidheim Date: Thu, 19 Apr 2018 07:43:34 +0200 Subject: [PATCH] Also check for format-files when language protocol is used --- src/source_language_protocol.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/source_language_protocol.cc b/src/source_language_protocol.cc index 660026a..6f1d9a1 100644 --- a/src/source_language_protocol.cc +++ b/src/source_language_protocol.cc @@ -380,7 +380,19 @@ Source::LanguageProtocolView::~LanguageProtocolView() { void Source::LanguageProtocolView::setup_navigation_and_refactoring() { if(capabilities.document_formatting) { format_style=[this](bool continue_without_style_file) { - if(!continue_without_style_file) + bool has_style_file=false; + auto style_file_search_path=this->file_path.parent_path(); + auto style_file='.'+language_id+"-format"; + while(true) { + if(boost::filesystem::exists(style_file_search_path/style_file)) { + has_style_file=true; + break; + } + if(style_file_search_path==style_file_search_path.root_directory()) + break; + style_file_search_path=style_file_search_path.parent_path(); + } + if(!has_style_file && !continue_without_style_file) return; class Replace {