forked from qt-creator/qt-creator
ClangFormat: Support remote filesystems
Change-Id: Ic5c06a826154e1bee92e3c283ab508177e86c428 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "clangformatconstants.h"
|
||||
#include "clangformatsettings.h"
|
||||
#include "clangformatutils.h"
|
||||
#include "llvmfilesystem.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/editorconfiguration.h>
|
||||
@@ -25,6 +26,8 @@
|
||||
|
||||
namespace ClangFormat {
|
||||
|
||||
Internal::LlvmFileSystemAdapter llvmFileSystemAdapter;
|
||||
|
||||
namespace {
|
||||
void adjustFormatStyleForLineBreak(clang::format::FormatStyle &style,
|
||||
ReplacementsToKeep replacementsToKeep)
|
||||
@@ -735,8 +738,8 @@ void ClangFormatBaseIndenter::autoIndent(const QTextCursor &cursor,
|
||||
|
||||
clang::format::FormatStyle ClangFormatBaseIndenter::styleForFile() const
|
||||
{
|
||||
llvm::Expected<clang::format::FormatStyle> styleFromProjectFolder
|
||||
= clang::format::getStyle("file", m_fileName.path().toStdString(), "none");
|
||||
llvm::Expected<clang::format::FormatStyle> styleFromProjectFolder = clang::format::getStyle(
|
||||
"file", m_fileName.toFSPathString().toStdString(), "none", "", &llvmFileSystemAdapter);
|
||||
|
||||
const ProjectExplorer::Project *projectForFile
|
||||
= ProjectExplorer::SessionManager::projectForFile(m_fileName);
|
||||
@@ -748,7 +751,7 @@ clang::format::FormatStyle ClangFormatBaseIndenter::styleForFile() const
|
||||
? projectForFile->editorConfiguration()->codeStyle("Cpp")->currentPreferences()
|
||||
: TextEditor::TextEditorSettings::codeStyle("Cpp")->currentPreferences();
|
||||
|
||||
if (overrideStyleFile || !styleFromProjectFolder
|
||||
if (!styleFromProjectFolder || overrideStyleFile
|
||||
|| *styleFromProjectFolder == clang::format::getNoStyle()) {
|
||||
Utils::FilePath filePath = filePathToCurrentSettings(preferences);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user