Merge remote-tracking branch 'origin/15.0'

Conflicts:
	src/plugins/clangcodemodel/clangdclient.cpp

Change-Id: Ibcfdf6d940d4d0e60f990c77c79cf3ed4438971b
This commit is contained in:
Eike Ziller
2024-12-10 13:54:02 +01:00
21 changed files with 172 additions and 134 deletions

View File

@@ -87,74 +87,70 @@ jobs:
string(REPLACE "." "" qt_version_dotless "${qt_version}") string(REPLACE "." "" qt_version_dotless "${qt_version}")
if ("${{ runner.os }}" STREQUAL "Windows") if ("${{ runner.os }}" STREQUAL "Windows")
set(url_os "windows_x86") set(url_os "windows_x86")
set(qt_package_arch_suffix "win64_msvc2022_64") set(compiler_id "win64_msvc2022_64")
set(qt_dir_prefix "${qt_version}/msvc_64")
set(qt_package_suffix "-Windows-Windows_11_23H2-MSVC2022-Windows-Windows_11_23H2-X86_64")
elseif ("${{ runner.os }}" STREQUAL "Linux") elseif ("${{ runner.os }}" STREQUAL "Linux")
set(url_os "linux_x64") set(url_os "linux_x64")
set(qt_package_arch_suffix "linux_gcc_64") set(compiler_id "linux_gcc_64")
set(qt_dir_prefix "${qt_version}/gcc_64")
set(qt_package_suffix "-Linux-RHEL_8_10-GCC-Linux-RHEL_8_10-X86_64")
elseif ("${{ runner.os }}" STREQUAL "macOS") elseif ("${{ runner.os }}" STREQUAL "macOS")
set(url_os "mac_x64") set(url_os "mac_x64")
set(qt_package_arch_suffix "clang_64") set(compiler_id "clang_64")
set(qt_dir_prefix "${qt_version}/macos")
set(qt_package_suffix "-MacOS-MacOS_14-Clang-MacOS-MacOS_14-X86_64-ARM64")
endif() endif()
set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}/qt6_${qt_version_dotless}") set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}/qt6_${qt_version_dotless}")
file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS) file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS)
file(READ ./Updates.xml updates_xml) file(READ ./Updates.xml updates_xml)
string(REGEX MATCH "<Name>qt.qt6.*<Version>([0-9+-.]+)</Version>" updates_xml_output "${updates_xml}") # get the package sections, only for given compiler, without the "debug info" ones
set(qt_package_version ${CMAKE_MATCH_1}) string(REGEX REPLACE "<PackageUpdate>" ";<PackageUpdate>" sections "${updates_xml}")
list(FILTER sections EXCLUDE REGEX "<Name>.*debug.*</Name>")
list(FILTER sections INCLUDE REGEX "<Name>.*${compiler_id}.*</Name>")
# Save the path for other steps # Save the path for other steps
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt6/${qt_dir_prefix}" qt_dir) file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt/" qt_dir)
file(APPEND "$ENV{GITHUB_OUTPUT}" "qt_dir=${qt_dir}") file(APPEND "$ENV{GITHUB_OUTPUT}" "qt_dir=${qt_dir}")
function(get_sub_url outvar module)
set(filtered ${sections})
list(FILTER filtered INCLUDE REGEX "<DownloadableArchives>.*${module}.*</DownloadableArchives>")
list(LENGTH filtered count)
if (count LESS 1)
set(${outvar} "<notfound>" PARENT_SCOPE)
return()
endif()
list(GET filtered 0 section)
string(REGEX MATCH "<Name>(.*)</Name>" match "${section}")
set(name ${CMAKE_MATCH_1})
string(REGEX MATCH "<Version>(.*)</Version>" match "${section}")
set(version ${CMAKE_MATCH_1})
string(REGEX MATCH "<DownloadableArchives>.*(${module}[^,]+).*</DownloadableArchives>" match "${section}")
set(archive ${CMAKE_MATCH_1})
set(${outvar} "${name}/${version}${archive}" PARENT_SCOPE)
endfunction()
message("Downloading Qt to ${qt_dir}") message("Downloading Qt to ${qt_dir}")
function(downloadAndExtract url archive subdir) function(downloadAndExtract module subdir)
file(MAKE_DIRECTORY "${qt_dir}/${subdir}") file(MAKE_DIRECTORY "${qt_dir}/${subdir}")
message("Downloading ${url}") set(archive "${module}.7z")
get_sub_url(sub_url ${module})
set(url "${qt_base_url}/${sub_url}")
message("Downloading ${module} from ${url}")
message("... extracting to ${qt_dir}/${subdir}") message("... extracting to ${qt_dir}/${subdir}")
file(DOWNLOAD "${url}" "$ENV{GITHUB_WORKSPACE}/${archive}" SHOW_PROGRESS) file(DOWNLOAD "${url}" "$ENV{GITHUB_WORKSPACE}/${archive}" SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf "$ENV{GITHUB_WORKSPACE}/${archive}" WORKING_DIRECTORY "${qt_dir}/${subdir}") execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf "$ENV{GITHUB_WORKSPACE}/${archive}" WORKING_DIRECTORY "${qt_dir}/${subdir}")
endfunction() endfunction()
foreach(package qtbase qtdeclarative) foreach(package qtbase qtdeclarative qt5compat qtshadertools)
downloadAndExtract( downloadAndExtract(${package} "")
"${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
${package}.7z
""
)
endforeach()
foreach(package qt5compat qtshadertools)
downloadAndExtract(
"${qt_base_url}/qt.qt6.${qt_version_dotless}.addons.${package}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
${package}.7z
""
)
endforeach() endforeach()
# uic depends on libicu*.so # uic depends on libicu*.so
if ("${{ runner.os }}" STREQUAL "Linux") if ("${{ runner.os }}" STREQUAL "Linux")
if (qt_version VERSION_LESS "6.7.0") downloadAndExtract("icu" "lib")
set(uic_suffix "Rhel7.2-x64")
else()
set(uic_suffix "Rhel8.6-x86_64")
endif()
downloadAndExtract(
"${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-${uic_suffix}.7z"
icu.7z
"lib"
)
endif() endif()
execute_process(COMMAND ${qt_dir}/bin/qmake -query) execute_process(COMMAND ${qt_dir}/bin/qmake -query)
- name: Download Qt Creator - name: Download Qt Creator
uses: qt-creator/install-dev-package@v1.2 uses: qt-creator/install-dev-package@v1.6
with: with:
version: ${{ env.QT_CREATOR_VERSION }} version: ${{ env.QT_CREATOR_VERSION }}
unzip-to: 'qtcreator' unzip-to: 'qtcreator'

View File

@@ -53663,19 +53663,19 @@ Die Datei &quot;%1&quot; konnte nicht geöffnet werden.</translation>
</message> </message>
<message> <message>
<source>Ctrl+Alt+.</source> <source>Ctrl+Alt+.</source>
<translation type="unfinished"></translation> <translation>Ctrl+Alt+.</translation>
</message> </message>
<message> <message>
<source>Ctrl+Alt+,</source> <source>Ctrl+Alt+,</source>
<translation type="unfinished"></translation> <translation>Ctrl+Alt+,</translation>
</message> </message>
<message> <message>
<source>Sort by Filenames</source> <source>Sort by Filenames</source>
<translation type="unfinished"></translation> <translation>Nach Dateiname sortieren</translation>
</message> </message>
<message> <message>
<source>Ctrl+Alt+P</source> <source>Ctrl+Alt+P</source>
<translation type="unfinished"></translation> <translation>Ctrl+Alt+P</translation>
</message> </message>
<message> <message>
<source>Alt+Meta+M</source> <source>Alt+Meta+M</source>
@@ -54910,19 +54910,19 @@ Bestimmt das Verhalten bezüglich der Einrückung von Fortsetzungszeilen.
</message> </message>
<message> <message>
<source>Fold Recursively</source> <source>Fold Recursively</source>
<translation type="unfinished"></translation> <translation>Rekursiv einklappen</translation>
</message> </message>
<message> <message>
<source>Fold All</source> <source>Fold All</source>
<translation type="unfinished"></translation> <translation>Alle einklappen</translation>
</message> </message>
<message> <message>
<source>Unfold Recursively</source> <source>Unfold Recursively</source>
<translation type="unfinished"></translation> <translation>Rekursiv aufklappen</translation>
</message> </message>
<message> <message>
<source>Unfold All</source> <source>Unfold All</source>
<translation type="unfinished"></translation> <translation>Alle aufklappen</translation>
</message> </message>
<message> <message>
<source>Zoom: %1%</source> <source>Zoom: %1%</source>
@@ -56062,11 +56062,11 @@ Um den Stil von benutzerdefinierten Operatoren festzulegen, verwenden Sie &quot;
</message> </message>
<message> <message>
<source>Attribute</source> <source>Attribute</source>
<translation type="unfinished"></translation> <translation>Attribut</translation>
</message> </message>
<message> <message>
<source>Attributes.</source> <source>Attributes.</source>
<translation type="unfinished"></translation> <translation>Attribute.</translation>
</message> </message>
<message> <message>
<source>Comment</source> <source>Comment</source>
@@ -56545,7 +56545,7 @@ Außer Leerzeichen innerhalb von Kommentaren und Zeichenketten.</translation>
</message> </message>
<message> <message>
<source>Copy Hash to Clipboard</source> <source>Copy Hash to Clipboard</source>
<translation type="unfinished"></translation> <translation>Hash in die Zwischenablage kopieren</translation>
</message> </message>
<message> <message>
<source>&lt;b&gt;Note:&lt;/b&gt; &quot;%1&quot; or &quot;%2&quot; is enabled in the instant blame settings.</source> <source>&lt;b&gt;Note:&lt;/b&gt; &quot;%1&quot; or &quot;%2&quot; is enabled in the instant blame settings.</source>
@@ -56598,23 +56598,23 @@ Außer Leerzeichen innerhalb von Kommentaren und Zeichenketten.</translation>
</message> </message>
<message> <message>
<source>Select Previous Suggestion</source> <source>Select Previous Suggestion</source>
<translation type="unfinished"></translation> <translation>Vorangehenden Vorschlag auswählen</translation>
</message> </message>
<message> <message>
<source>Select Next Suggestion</source> <source>Select Next Suggestion</source>
<translation type="unfinished"></translation> <translation>Nächsten Vorschlag auswählen</translation>
</message> </message>
<message> <message>
<source>Apply (%1)</source> <source>Apply (%1)</source>
<translation type="unfinished">Anwenden (%1)</translation> <translation>Anwenden (%1)</translation>
</message> </message>
<message> <message>
<source>Apply Word (%1)</source> <source>Apply Word (%1)</source>
<translation type="unfinished">Wort anwenden (%1)</translation> <translation>Wort anwenden (%1)</translation>
</message> </message>
<message> <message>
<source>Apply Line</source> <source>Apply Line</source>
<translation type="unfinished"></translation> <translation>Zeile anwenden</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -57107,11 +57107,11 @@ Die Trace-Daten sind verloren.</translation>
</message> </message>
<message> <message>
<source>Add to project:</source> <source>Add to project:</source>
<translation type="unfinished"></translation> <translation>Zu Projekt hinzufügen:</translation>
</message> </message>
<message> <message>
<source>Chosen project wizard does not support the build system.</source> <source>Chosen project wizard does not support the build system.</source>
<translation type="unfinished"></translation> <translation>Das Buildsystem wird vom gewählten Assistenten nicht unterstützt.</translation>
</message> </message>
<message> <message>
<source>Directory &quot;%1&quot; will be created.</source> <source>Directory &quot;%1&quot; will be created.</source>
@@ -57368,7 +57368,7 @@ Die Trace-Daten sind verloren.</translation>
</message> </message>
<message> <message>
<source>renameFile is not implemented for &quot;%1&quot;.</source> <source>renameFile is not implemented for &quot;%1&quot;.</source>
<translation type="unfinished"></translation> <translation>renameFile ist für &quot;%1&quot; nicht implementiert.</translation>
</message> </message>
<message> <message>
<source>fileContents is not implemented for &quot;%1&quot;.</source> <source>fileContents is not implemented for &quot;%1&quot;.</source>
@@ -57388,11 +57388,11 @@ Die Trace-Daten sind verloren.</translation>
</message> </message>
<message> <message>
<source>Failed to watch &quot;%1&quot;.</source> <source>Failed to watch &quot;%1&quot;.</source>
<translation type="unfinished"></translation> <translation>Watch für &quot;%1&quot; ist fehlgeschlagen.</translation>
</message> </message>
<message> <message>
<source>Failed to watch &quot;%1&quot;, it does not exist.</source> <source>Failed to watch &quot;%1&quot;, it does not exist.</source>
<translation type="unfinished"></translation> <translation>Watch für &quot;%1&quot; ist fehlgeschlagen, es existiert nicht.</translation>
</message> </message>
<message> <message>
<source>Refusing to remove the standard directory &quot;%1&quot;.</source> <source>Refusing to remove the standard directory &quot;%1&quot;.</source>
@@ -57416,7 +57416,7 @@ Die Trace-Daten sind verloren.</translation>
</message> </message>
<message> <message>
<source>Failed to rename file &quot;%1&quot; to &quot;%2&quot;: %3</source> <source>Failed to rename file &quot;%1&quot; to &quot;%2&quot;: %3</source>
<translation type="unfinished"></translation> <translation>Die Datei &quot;%1&quot; konnte nicht in &quot;%2&quot; umbenannt werden: %3</translation>
</message> </message>
<message> <message>
<source>File &quot;%1&quot; does not exist.</source> <source>File &quot;%1&quot; does not exist.</source>
@@ -57448,7 +57448,7 @@ Die Trace-Daten sind verloren.</translation>
</message> </message>
<message> <message>
<source>removeFile is not implemented for &quot;%1&quot;.</source> <source>removeFile is not implemented for &quot;%1&quot;.</source>
<translation type="unfinished"></translation> <translation>removeFile ist für &quot;%1&quot; nicht implementiert.</translation>
</message> </message>
<message> <message>
<source>Cannot copy &quot;%1&quot; to &quot;%2&quot;: %3</source> <source>Cannot copy &quot;%1&quot; to &quot;%2&quot;: %3</source>
@@ -57531,7 +57531,7 @@ Die Trace-Daten sind verloren.</translation>
</message> </message>
<message> <message>
<source>Failed to set up scratch buffer in &quot;%1&quot;.</source> <source>Failed to set up scratch buffer in &quot;%1&quot;.</source>
<translation type="unfinished"></translation> <translation>Notizbereich in &quot;%1&quot; konnte nicht erzeugt werden.</translation>
</message> </message>
<message> <message>
<source>%1 on %2</source> <source>%1 on %2</source>
@@ -57557,7 +57557,7 @@ Die Trace-Daten sind verloren.</translation>
</message> </message>
<message> <message>
<source>Failed to move %1 to %2. Removing the source file failed: %3</source> <source>Failed to move %1 to %2. Removing the source file failed: %3</source>
<translation type="unfinished"></translation> <translation>Das Verschieben von %1 nach %2 ist fehlgeschlagen. Das Entfernen der Quelldatei ist fehlgeschlagen: %3</translation>
</message> </message>
<message> <message>
<source>No &quot;localSource&quot; device hook set.</source> <source>No &quot;localSource&quot; device hook set.</source>
@@ -57724,7 +57724,7 @@ Die Trace-Daten sind verloren.</translation>
</message> </message>
<message> <message>
<source>Failed to expand macros in process arguments: %1</source> <source>Failed to expand macros in process arguments: %1</source>
<translation type="unfinished"></translation> <translation>Das Expandieren von Makros in Prozessargumenten ist fehlgeschlagen: %1</translation>
</message> </message>
<message> <message>
<source>%1: Full path including file name.</source> <source>%1: Full path including file name.</source>
@@ -59562,7 +59562,7 @@ Check settings or ensure Valgrind is installed and available in PATH.</source>
</message> </message>
<message> <message>
<source>Cannot commit: %1</source> <source>Cannot commit: %1</source>
<translation type="unfinished"></translation> <translation>Commit fehlgeschlagen: %1</translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<source>%1 %2/%n File(s)</source> <source>%1 %2/%n File(s)</source>
@@ -59922,19 +59922,19 @@ should a repository require SSH-authentication (see documentation on SSH and the
</message> </message>
<message> <message>
<source>The chosen directory is an emsdk location.</source> <source>The chosen directory is an emsdk location.</source>
<translation type="unfinished"></translation> <translation>Das gewählte Verzeichnis ist der Ort eines emsdk.</translation>
</message> </message>
<message> <message>
<source>An SDK is installed.</source> <source>An SDK is installed.</source>
<translation type="unfinished"></translation> <translation>Ein SDK ist installiert.</translation>
</message> </message>
<message> <message>
<source>An SDK is activated.</source> <source>An SDK is activated.</source>
<translation type="unfinished"></translation> <translation>Ein SDK ist aktiviert.</translation>
</message> </message>
<message> <message>
<source>The activated SDK is usable by %1.</source> <source>The activated SDK is usable by %1.</source>
<translation type="unfinished"></translation> <translation>Das aktivierte SDK ist von %1 benutzbar.</translation>
</message> </message>
<message> <message>
<source>The activated version %1 is not supported by %2. Activate version %3 or higher.</source> <source>The activated version %1 is not supported by %2. Activate version %3 or higher.</source>

View File

@@ -116,6 +116,9 @@ void TypePrettyPrinter::visit(UndefinedType *)
_text.prepend(QLatin1String("signed")); _text.prepend(QLatin1String("signed"));
else if (_fullySpecifiedType.isUnsigned()) else if (_fullySpecifiedType.isUnsigned())
_text.prepend(QLatin1String("unsigned")); _text.prepend(QLatin1String("unsigned"));
} else if (_fullySpecifiedType.isAuto()) {
prependSpaceUnlessBracket();
_text.prepend("auto");
} }
prependCv(_fullySpecifiedType); prependCv(_fullySpecifiedType);

View File

@@ -268,7 +268,7 @@ QString asciify(const QString &input)
if (c.isPrint() && c.unicode() < 128) if (c.isPrint() && c.unicode() < 128)
result.append(c); result.append(c);
else else
result.append(QString::fromLatin1("u%1").arg(c.unicode(), 4, 16, QChar('0'))); result.append(QString::fromLatin1("u%1").arg(int16_t(c.unicode()), 4, 16, QChar('0')));
} }
return result; return result;
} }

View File

@@ -21,17 +21,13 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <cplusplus/AST.h> #include <cplusplus/AST.h>
#include <cplusplus/ASTPath.h> #include <cplusplus/ASTPath.h>
#include <cplusplus/Icons.h>
#include <cppeditor/compilationdb.h> #include <cppeditor/compilationdb.h>
#include <cppeditor/cppcodemodelsettings.h> #include <cppeditor/cppcodemodelsettings.h>
#include <cppeditor/cppeditorconstants.h>
#include <cppeditor/cppeditorwidget.h> #include <cppeditor/cppeditorwidget.h>
#include <cppeditor/cppmodelmanager.h> #include <cppeditor/cppmodelmanager.h>
#include <cppeditor/cpprefactoringchanges.h> #include <cppeditor/cpprefactoringchanges.h>
#include <cppeditor/cppsemanticinfo.h> #include <cppeditor/cppsemanticinfo.h>
#include <cppeditor/cpptoolsreuse.h> #include <cppeditor/cpptoolsreuse.h>
#include <cppeditor/cppvirtualfunctionassistprovider.h>
#include <cppeditor/cppvirtualfunctionproposalitem.h>
#include <cppeditor/semantichighlighter.h> #include <cppeditor/semantichighlighter.h>
#include <languageclient/diagnosticmanager.h> #include <languageclient/diagnosticmanager.h>
#include <languageclient/languageclienthoverhandler.h> #include <languageclient/languageclienthoverhandler.h>
@@ -46,15 +42,12 @@
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/devicesupport/devicekitaspects.h> #include <projectexplorer/devicesupport/devicekitaspects.h>
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/devicesupport/devicekitaspects.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectnodes.h>
#include <projectexplorer/projecttree.h> #include <projectexplorer/projecttree.h>
#include <projectexplorer/projectmanager.h> #include <projectexplorer/projectmanager.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/codeassist/iassistprovider.h>
#include <texteditor/texteditor.h> #include <texteditor/texteditor.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/async.h> #include <utils/async.h>
@@ -62,9 +55,7 @@
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/mimeconstants.h> #include <utils/mimeconstants.h>
#include <utils/itemviews.h>
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
#include <utils/utilsicons.h>
#include <QAction> #include <QAction>
#include <QElapsedTimer> #include <QElapsedTimer>
@@ -472,8 +463,10 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir, c
progressManager()->setTitleForToken( progressManager()->setTitleForToken(
indexingToken(), project ? Tr::tr("Indexing %1 with clangd").arg(project->displayName()) indexingToken(), project ? Tr::tr("Indexing %1 with clangd").arg(project->displayName())
: Tr::tr("Indexing session with clangd")); : Tr::tr("Indexing session with clangd"));
progressManager()->setCancelHandlerForToken(indexingToken(), [this, project]() { progressManager()->setCancelHandlerForToken(indexingToken(), [this, p = QPointer(project)]() {
CppEditor::ClangdProjectSettings projectSettings(project); if (!p)
return;
CppEditor::ClangdProjectSettings projectSettings(p);
projectSettings.blockIndexing(); projectSettings.blockIndexing();
progressManager()->endProgressReport(indexingToken()); progressManager()->endProgressReport(indexingToken());
}); });

View File

@@ -3,6 +3,7 @@
#include "documentclangtoolrunner.h" #include "documentclangtoolrunner.h"
#include "clangtoolscompilationdb.h"
#include "clangtoolsconstants.h" #include "clangtoolsconstants.h"
#include "clangtoolrunner.h" #include "clangtoolrunner.h"
#include "clangtoolsutils.h" #include "clangtoolsutils.h"
@@ -158,6 +159,18 @@ static Environment projectBuildEnvironment(Project *project)
void DocumentClangToolRunner::run() void DocumentClangToolRunner::run()
{ {
for (const ClangToolType type : {ClangToolType::Tidy, ClangToolType::Clazy}) {
ClangToolsCompilationDb &db = ClangToolsCompilationDb::getDb(type);
db.disconnect(this);
if (db.generateIfNecessary()) {
connect(&db, &ClangToolsCompilationDb::generated, this, [this](bool success) {
if (success)
run();
}, Qt::SingleShotConnection);
return;
}
}
if (m_projectSettingsUpdate) if (m_projectSettingsUpdate)
disconnect(m_projectSettingsUpdate); disconnect(m_projectSettingsUpdate);
m_taskTreeRunner.reset(); m_taskTreeRunner.reset();

View File

@@ -65,19 +65,24 @@ static LocatorMatcherTasks cmakeMatchers(const BuildAcceptor &acceptor)
return AcceptResult(); return AcceptResult();
}; };
} }
bool realTarget = false; // We want to show real targets (executables, libraries) and also
if (!target.backtrace.isEmpty() && target.targetType != UtilityType) { // custom targets defined in the project via add_custom_target.
bool targetOfInterest = false;
if (!target.backtrace.isEmpty()) {
const FilePath path = target.backtrace.last().path; const FilePath path = target.backtrace.last().path;
const int line = target.backtrace.last().line; const int line = target.backtrace.last().line;
entry.linkForEditor = {path, line}; entry.linkForEditor = {path, line};
entry.extraInfo = path.shortNativePath(); entry.extraInfo = path.shortNativePath();
realTarget = true;
if (target.targetType != UtilityType || path == projectPath
|| path.isChildOf(projectPath))
targetOfInterest = true;
} else { } else {
entry.extraInfo = projectPath.shortNativePath(); entry.extraInfo = projectPath.shortNativePath();
} }
entry.highlightInfo = ILocatorFilter::highlightInfo(match); entry.highlightInfo = ILocatorFilter::highlightInfo(match);
entry.filePath = cmakeProject->projectFilePath(); entry.filePath = cmakeProject->projectFilePath();
if (acceptor || realTarget) { if (acceptor || targetOfInterest) {
if (match.capturedStart() == 0) if (match.capturedStart() == 0)
entries[int(ILocatorFilter::MatchLevel::Best)].append(entry); entries[int(ILocatorFilter::MatchLevel::Best)].append(entry);
else if (match.lastCapturedIndex() == 1) else if (match.lastCapturedIndex() == 1)

View File

@@ -125,11 +125,12 @@ void addCMakePresets(FolderNode *root, const Utils::FilePath &sourceDir)
presetFileNames << "CMakePresets.json"; presetFileNames << "CMakePresets.json";
presetFileNames << "CMakeUserPresets.json"; presetFileNames << "CMakeUserPresets.json";
const CMakeProject *cp = static_cast<const CMakeProject *>( const auto cmakeProject = qobject_cast<const CMakeProject *>(
ProjectManager::projectForFile(sourceDir.pathAppended(Constants::CMAKE_LISTS_TXT))); ProjectManager::projectForFile(sourceDir.pathAppended(Constants::CMAKE_LISTS_TXT)));
QTC_ASSERT(cmakeProject, return);
if (cp && cp->presetsData().include) if (cmakeProject->presetsData().include)
presetFileNames.append(cp->presetsData().include.value()); presetFileNames.append(cmakeProject->presetsData().include.value());
std::vector<std::unique_ptr<FileNode>> presets; std::vector<std::unique_ptr<FileNode>> presets;
for (const auto &fileName : presetFileNames) { for (const auto &fileName : presetFileNames) {

View File

@@ -146,6 +146,11 @@ OpenEditorsWindow::OpenEditorsWindow(QWidget *parent)
auto layout = new QVBoxLayout(this); auto layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(m_editorView); layout->addWidget(m_editorView);
// Close the popup and clear it if documents are closed behind the back of the view
connect(DocumentModel::model(), &QAbstractItemModel::rowsAboutToBeRemoved, this, [this] {
setVisible(false);
});
} }
void OpenEditorsWindow::selectAndHide() void OpenEditorsWindow::selectAndHide()
@@ -159,6 +164,8 @@ void OpenEditorsWindow::setVisible(bool visible)
QWidget::setVisible(visible); QWidget::setVisible(visible);
if (visible) if (visible)
setFocus(); setFocus();
else
m_editorView->m_model.clear();
} }
bool OpenEditorsWindow::eventFilter(QObject *obj, QEvent *e) bool OpenEditorsWindow::eventFilter(QObject *obj, QEvent *e)

View File

@@ -35,10 +35,10 @@ namespace CppEditor {
namespace Internal { namespace Internal {
namespace Tests { namespace Tests {
QList<TestDocumentPtr> singleDocument(const QByteArray &original, QList<TestDocumentPtr> singleDocument(
const QByteArray &expected) const QByteArray &original, const QByteArray &expected, const QByteArray fileName)
{ {
return {CppTestDocument::create("file.cpp", original, expected)}; return {CppTestDocument::create(fileName, original, expected)};
} }
BaseQuickFixTestCase::BaseQuickFixTestCase(const QList<TestDocumentPtr> &testDocuments, BaseQuickFixTestCase::BaseQuickFixTestCase(const QList<TestDocumentPtr> &testDocuments,

View File

@@ -86,8 +86,8 @@ public:
int operationIndex = 0); int operationIndex = 0);
}; };
QList<TestDocumentPtr> singleDocument(const QByteArray &original, QList<TestDocumentPtr> singleDocument(
const QByteArray &expected); const QByteArray &original, const QByteArray &expected, const QByteArray fileName = "file.cpp");
} // namespace Tests } // namespace Tests
} // namespace Internal } // namespace Internal

View File

@@ -1883,17 +1883,17 @@ foo::foo2::MyType<int> foo::foo2::bar()
QByteArray original = QByteArray original =
"class Foo\n" "class Foo\n"
"{\n" "{\n"
" template<class U>\n" " template<class U, auto N>\n"
" void fun@c();\n" " void fun@c();\n"
"};\n"; "};\n";
QByteArray expected = QByteArray expected =
"class Foo\n" "class Foo\n"
"{\n" "{\n"
" template<class U>\n" " template<class U, auto N>\n"
" void fun@c();\n" " void fun@c();\n"
"};\n" "};\n"
"\n" "\n"
"template<class U>\n" "template<class U, auto N>\n"
"inline void Foo::func()\n" "inline void Foo::func()\n"
"{\n" "{\n"
"\n" "\n"

View File

@@ -107,9 +107,23 @@ public:
Scope *scopeAtInsertPos = m_toFile->cppDocument()->scopeAt(l.line(), l.column()); Scope *scopeAtInsertPos = m_toFile->cppDocument()->scopeAt(l.line(), l.column());
// construct definition // construct definition
const QString funcDec = inlinePrefix(m_toFile->filePath(), [this] { return m_type == MoveOutside; }) const QString inlinePref = inlinePrefix(m_toFile->filePath(), [this] {
+ definitionSignature(m_operation, funcAST, m_fromFile, m_toFile, return m_type == MoveOutside;
scopeAtInsertPos); });
QString funcDec = definitionSignature(m_operation, funcAST, m_fromFile, m_toFile,
scopeAtInsertPos);
QString input = funcDec;
int inlineIndex = 0;
const QRegularExpression templateRegex("template\\s*<[^>]*>");
while (input.startsWith("template")) {
const QRegularExpressionMatch match = templateRegex.match(input);
if (match.hasMatch()) {
inlineIndex += match.captured().size() + 1;
input = input.mid(match.captured().size() + 1);
}
}
funcDec.insert(inlineIndex, inlinePref);
QString funcDef = prefix + funcDec; QString funcDef = prefix + funcDec;
const int startPosition = m_fromFile->endOf(funcAST->declarator); const int startPosition = m_fromFile->endOf(funcAST->declarator);
const int endPosition = m_fromFile->endOf(funcAST); const int endPosition = m_fromFile->endOf(funcAST);
@@ -1182,11 +1196,11 @@ private slots:
"class Foo { void fu@nc(); };\n" "class Foo { void fu@nc(); };\n"
"\n" "\n"
"template<class T>\n" "template<class T>\n"
"void Foo<T>::func() {}\n"; "inline void Foo<T>::func() {}\n";
; ;
MoveFuncDefOutside factory; MoveFuncDefOutside factory;
QuickFixOperationTest(singleDocument(original, expected), &factory); QuickFixOperationTest(singleDocument(original, expected, "file.h"), &factory);
} }
void testConcept() void testConcept()

View File

@@ -1674,35 +1674,31 @@ bool BreakHandler::contextMenuEvent(const ItemViewEvent &ev)
} }
); );
QList<Breakpoint> enabledBreakpoints; bool canDisableAll = false;
QList<Breakpoint> disabledBreakpoints; bool canEnableAll = false;
forItemsAtLevel<1>([&enabledBreakpoints, &disabledBreakpoints](Breakpoint bp) { forItemsAtLevel<1>([&canDisableAll, &canEnableAll](Breakpoint bp) {
if (bp) { if (bp)
if (bp->isEnabled()) (bp->isEnabled() ? canDisableAll : canEnableAll) = true;
enabledBreakpoints.append(bp);
else
disabledBreakpoints.append(bp);
}
}); });
addAction(this, menu, Tr::tr("Disable All Breakpoints"), addAction(this, menu, Tr::tr("Disable All Breakpoints"), canDisableAll, [this] {
!enabledBreakpoints.isEmpty(), forItemsAtLevel<1>([this](Breakpoint bp) {
[this, enabledBreakpoints] { if (bp && bp->isEnabled()) {
for (Breakpoint bp : enabledBreakpoints) { if (GlobalBreakpoint gbp = bp->globalBreakpoint())
if (GlobalBreakpoint gbp = bp->globalBreakpoint()) gbp->setEnabled(false, false);
gbp->setEnabled(false, false); requestBreakpointEnabling(bp, false);
requestBreakpointEnabling(bp, false); }
} });
}); });
addAction(this, menu, Tr::tr("Enable All Breakpoints"), addAction(this, menu, Tr::tr("Enable All Breakpoints"), canEnableAll, [this] {
!disabledBreakpoints.isEmpty(), forItemsAtLevel<1>([this](Breakpoint bp) {
[this, disabledBreakpoints] { if (bp && !bp->isEnabled()) {
for (Breakpoint bp : disabledBreakpoints) { if (GlobalBreakpoint gbp = bp->globalBreakpoint())
if (GlobalBreakpoint gbp = bp->globalBreakpoint()) gbp->setEnabled(true, false);
gbp->setEnabled(true, false); requestBreakpointEnabling(bp, true);
requestBreakpointEnabling(bp, true); }
} });
}); });
addAction(this, menu, addAction(this, menu,

View File

@@ -254,8 +254,8 @@ QString escapeUnprintable(const QString &str, int unprintableBase)
QString encoded; QString encoded;
while (arrayView.size() >= 4) { while (arrayView.size() >= 4) {
char32_t c; int32_t c;
memcpy(&c, arrayView.constData(), sizeof(char32_t)); memcpy(&c, arrayView.constData(), sizeof(int32_t));
if (QChar::isPrint(c)) if (QChar::isPrint(c))
encoded += toQString(arrayView.sliced(0, 4)); encoded += toQString(arrayView.sliced(0, 4));

View File

@@ -5058,5 +5058,7 @@ void FakeVimTester::test_vim_qtcreator()
} // FakeVim::Internal } // FakeVim::Internal
#include "fakevim_test.moc" #undef N
#undef X
#include "fakevim_test.moc"

View File

@@ -977,7 +977,7 @@ QString quoteUnprintable(const QString &ba)
else if (cc == '\n') else if (cc == '\n')
res += "<CR>"; res += "<CR>";
else else
res += QString("\\x%1").arg(c.unicode(), 2, 16, QLatin1Char('0')); res += QString("\\x%1").arg(int16_t(c.unicode()), 2, 16, QLatin1Char('0'));
} }
return res; return res;
} }

View File

@@ -514,6 +514,10 @@ void setupGuiModule()
sol::factories([guard](const sol::table &children) { sol::factories([guard](const sol::table &children) {
return constructWidgetType<PushButton>(children, guard); return constructWidgetType<PushButton>(children, guard);
}), }),
"setText",
&PushButton::setText,
"setIconPath",
&PushButton::setIconPath,
sol::base_classes, sol::base_classes,
sol::bases<Widget, Object, Thing>()); sol::bases<Widget, Object, Thing>());

View File

@@ -1406,6 +1406,7 @@ static FilePaths findCompilerCandidates(OsType os,
if (os == OsTypeWindows && fileName.endsWith(u".exe", Qt::CaseInsensitive)) if (os == OsTypeWindows && fileName.endsWith(u".exe", Qt::CaseInsensitive))
fileName.chop(4); fileName.chop(4);
// Do not `continue`, proceed to detect further variants
if (fileName == compilerName) if (fileName == compilerName)
compilerPaths << executable; compilerPaths << executable;
@@ -1426,7 +1427,7 @@ static FilePaths findCompilerCandidates(OsType os,
// if not at the end, it must by followed by a hyphen and a digit between 1 and 9 // if not at the end, it must by followed by a hyphen and a digit between 1 and 9
pos += cl; pos += cl;
if (pos != fileName.size()) { if (pos != fileName.size()) {
if (pos + 2 >= fileName.size()) if (pos + 1 >= fileName.size())
continue; continue;
if (fileName.at(pos) != '-') if (fileName.at(pos) != '-')
continue; continue;

View File

@@ -14,6 +14,7 @@
#include <coreplugin/editormanager/documentmodel.h> #include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>

View File

@@ -493,8 +493,10 @@ void TextDocument::applyFontSettings()
block = block.next(); block = block.next();
} }
updateLayout(); updateLayout();
if (d->m_highlighter) if (d->m_highlighter) {
d->m_highlighter->setFontSettings(d->m_fontSettings); d->m_highlighter->setFontSettings(d->m_fontSettings);
d->m_highlighter->scheduleRehighlight();
}
} }
void TextDocument::slotCodeStyleSettingsChanged() { } void TextDocument::slotCodeStyleSettingsChanged() { }