Created
July 6, 2019 20:32
-
-
Save DanielChabrowski/24b6481cade657f4af7f0c615d1a9be2 to your computer and use it in GitHub Desktop.
Fix QtCreator symlinks in include completion.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f52618b086f02a87ccaed124c00a2767a3bfbef1 Mon Sep 17 00:00:00 2001 | |
From: DanielChabrowski <dantezstudio@gmail.com> | |
Date: Wed, 3 Jul 2019 01:56:49 +0200 | |
Subject: [PATCH] CppTools: Follow symlinks for include completion | |
--- | |
.../clangcodemodel/clangcompletionassistprocessor.cpp | 9 +++++++++ | |
1 file changed, 9 insertions(+) | |
diff --git a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp | |
index 6f1397c487..c14277e8f1 100644 | |
--- a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp | |
+++ b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp | |
@@ -476,6 +476,7 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor) | |
const ::Utils::MimeType mimeType = ::Utils::mimeTypeForName("text/x-c++hdr"); | |
const QStringList suffixes = mimeType.suffixes(); | |
+ QStringList uniqueHeaderPaths; | |
foreach (const ProjectExplorer::HeaderPath &headerPath, headerPaths) { | |
QString realPath = headerPath.path; | |
if (!directoryPrefix.isEmpty()) { | |
@@ -484,6 +485,14 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor) | |
if (headerPath.type == ProjectExplorer::HeaderPathType::Framework) | |
realPath += QLatin1String(".framework/Headers"); | |
} | |
+ | |
+ realPath = QDir{realPath}.canonicalPath(); | |
+ if (!realPath.isEmpty() && !uniqueHeaderPaths.contains(realPath)) { | |
+ uniqueHeaderPaths.append(std::move(realPath)); | |
+ } | |
+ } | |
+ | |
+ foreach (const QString& realPath, uniqueHeaderPaths) { | |
completeIncludePath(realPath, suffixes); | |
} | |
-- | |
2.20.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment