Commit Graph

3443 Commits

Author SHA1 Message Date
Marcus Tillmanns
34fdac0d84 CMake: Improve remote parsing speed
To improve the speed of parsing the result of a remote
cmake call, we move the file fetching and parsing into a
mapped concurrent call.

We also first uniquify the list of files to remove duplicates.

Fixes: QTCREATORBUG-29618
Change-Id: I18108928ba3b5f4f8ec3d5610b216c5ccf060877
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-04 13:40:36 +00:00
Cristian Adam
7028e27a81 CMakePM: Add Debugger -> Start Debugging -> Start CMake Debugging
This is where the user would expect it.

It is an action, so the user can assign a keyboard shortcut if needed.

Change-Id: I4c6db3b1dafb5fb173a07c21d271715310a2b091
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2023-10-04 09:32:23 +00:00
Cristian Adam
298921be2d CMakePM: Do not show the same tooltip on mouse pointer change
Let's say you move the mouse left and right on the keyword, we shouldn't
flicker showing the same tooltip to the new position.

Change-Id: I45b69578d377384422535ce5f33f81bc916a42e2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-02 21:32:50 +00:00
Cristian Adam
3956d5b279 CMakePM: Remove caching of CMakeTool
No need to cache the value of the CMakeTool, since it causes issues with
the update mechanism.

Task-number: QTCREATORBUG-29683
Change-Id: Id5925b9a90d6010aa09b4a2f7b5ed3d447f5cd7a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-10-02 15:56:55 +00:00
Jarek Kobus
07e758147b CMakeFileCompletionAssist: Fix a crash on completion
Avoid calling not-thread safe functions from inside
the CMakeFileCompletionAssist::performAsync().

Move calling these functions before the asyncRun, collect
the needed data inside the PerformInputData structure
and pass it to the other thread instead.

Fixes: QTCREATORBUG-29683
Change-Id: I56127163a47339bc45d47f3a7d2c76d518b640f7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-02 15:47:51 +00:00
Cristian Adam
3705b4b609 CMakePM: Navigate to find_package CMake files
Fixes: QTCREATORBUG-25524
Change-Id: I6dc7dc1b2d0da06ceba0314438d3bd12467a3223
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-02 12:50:32 +00:00
Cristian Adam
762b0518a2 CMakePM: Handle include(CMakeFileWithoutSuffix) navigation
Check that the function operating upon is "include" and then match the
word under cursor with a file from the project.

Change-Id: Ia0131f08515c56582a1fb02a59d6b2e41ac04288
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-02 11:05:36 +00:00
Cristian Adam
15903ad17a CMakePM: Allow http(s) Url navigation
The CMake snippets do have comments with the origin of the snippet and
this patchset allows navigation to the url in question.

Change-Id: I6eb2565e8f7b9100a1cc19dbf8ccda430c698613
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-29 17:03:45 +00:00
Cristian Adam
7235e977ff CMakePM: Fix concurrent access crash
Change-Id: I9ea11619860d4066cb06dfd4a60def8208f21add
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-28 13:51:31 +00:00
Cristian Adam
776c8670d7 CMakePM: Handle project FindPackage package variables
For example find_package(ZLIB QUEIT) will result in the package
variables ZLIB_LIBRARY ZLIB_INCLUDE_DIR.

The variables are available for both code completion and navigation.

Change-Id: I4ea6090f44a980dc91632fcabbda16987b0f0285
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-28 10:49:56 +00:00
Cristian Adam
d08f1c6e94 CMakePM: Allow navigation to project targets
They were available via Ctrl-K and "cmo <target_name>". But they should
be working also in the text editor.

Change-Id: Iaad72b784485364776b67d6dfdef7ba73dd2df70
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-28 10:36:40 +00:00
Cristian Adam
d915e22adb CMakePM: Add imported targets to code completion / navigation
This allows e.g. Qt6::Core to be specified as argument for
target_link_libraries and navigation via F2.

Also fixes a bug introduced with
695952f84b which removed the project
specific features due to project being nullptr.

Change-Id: I5efa28c498d337e6bab564533a5445e6c364b26b
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-28 10:36:29 +00:00
Cristian Adam
695952f84b CMakePM: Integrate RSTParser into hover help / code completion
Change-Id: I1618be1aff83e8164c53040bb2c7230bcc1ec8ee
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-27 14:14:43 +00:00
Cristian Adam
94d7c76d67 CMakePM: Add missing features to RSTParser
To be able to parse the rst help files from CMake

Change-Id: Ibec21e8571324276d2080f81728b1268581601d0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-27 14:14:31 +00:00
Alessandro Portale
4924e5afec CMakeProjectManager: Fix warnings
Change-Id: I190646684a1cadbcc1a5906642ed48e9dd84ed88
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-09-27 12:57:12 +00:00
Jarek Kobus
4e90ca1b59 CMakeToolManager: Add static readFirstParagraphs()
Reuse it in CMakeEditor and CMakeFileCompletionAssistProvider.

Amends d04585b519

Change-Id: I8dbd59c815e017404ff215ca1ff68740d6653e91
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-09-27 11:21:50 +00:00
Jarek Kobus
d04585b519 CMakeProjectManager: Remove unused arg
Make some methods static.

Amends 05614ab740

Change-Id: Ia72a95c0c3bf0acf7a94e1bac0a162db23aa0c77
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-09-27 08:17:19 +00:00
Cristian Adam
ec13beff1c CMakePM: Initial import of the RSTparser
Change-Id: I45bc3d53df3358c1f52ca219b53a1dec8e85a4ca
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-26 10:43:34 +00:00
Christian Stenger
658e2a3197 CMakePM: Fix build with Qt6.2
Change-Id: Iac128851da0aa7895d5c2352be550702fbc1e7f9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-09-26 07:49:03 +00:00
Cristian Adam
cd94514dbb CMakePM: Add hover help for CMakeEditor
Fixes: QTCREATORBUG-25780
Change-Id: I954023f701e6c1c6ca5e25190b37f8b9a8becfb5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-09-25 13:41:44 +00:00
Cristian Adam
05614ab740 CMakePM: Display help details for code completion
The first 1024 bytes from the CMake .rst files are displayed raw data.

A .rst to html or markdown would be needed for nicer user experience.

Change-Id: Ie6adbb404d844ae88b868b465d4125c2177e6cfe
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-25 13:41:34 +00:00
Cristian Adam
53b8f0e495 CMakePM: Speed up CMake introspection
By listing files instead of running cmake and asking CMake to provide
the information.

For properties and modules now the information is taken from the active
CMake version and not from the Syntax-highlighting file.

Change-Id: I0974cc816d990fd382d9e855eb08416b50d0368b
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-22 15:26:07 +00:00
Cristian Adam
45a8dc4e44 CMakePM: Support local functions and variables for code completion
... and also navigation via F2.

Change-Id: I0f1242c6ff502973de180643b369c635636b0112
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-22 13:26:10 +00:00
Cristian Adam
0632648be6 CMakePM: Remove the CMake introspection after CMake project load
Will be done in the CMake editor. No need to slow the project loading
when you don't do any editing of CMake files.

Initially I wanted to have it already loaded when code completion is
done, but doing once when a CMake editor is opened is better.

Change-Id: I1eda2a64e708bfa4fab5ab749059a08769800eba
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-22 10:33:36 +00:00
Cristian Adam
ed1568309b CMakePM: Add CMake Profiler action
Change-Id: I17f258834724c37f0933d18b6214851be1965913
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-21 18:39:53 +00:00
Alessandro Portale
1d5ecdb5c7 CMakeProjectManager: Non-toolbar icon variant for "Reload CMake Presets"
Change-Id: Ieadbe94ce22367eaf0ea0da220150051e924a266
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-09-21 18:18:23 +00:00
Jarek Kobus
e753c4585c CMakeEditor: Fix unused variable
Drop a call to currentProject(), as currentBuildSystem()
already implies currentProject() isn't nullptr.

Amends a998269d7e

Change-Id: Ibf902dc78af5c59c6475366f52d0b3489e989789
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-09-21 12:05:19 +00:00
Cristian Adam
d88c270aaf CMakePM: Allow code completion for CMake files without a project
By taking the default CMake tool in Qt Creator. Similar to the editor.

Change-Id: Id1effa3c4f71dc59dcf940f0fc246aa87c9ba0f7
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-09-21 11:48:00 +00:00
Cristian Adam
c0d50cd00a CMakePM: Remove subsequent call to wordUnderCursor
Just use the value above it.

Change-Id: I16e1e3217de6e03d7bf9f16e6966c9854bd68930
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-09-21 11:32:52 +00:00
Alessandro Portale
813342b957 CMakeProjectManager: Fix implicit conversion warnings
Amends a998269d7e

Change-Id: If6d0bda51030a39cb26ec1e270be2086a2bb54a1
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-09-21 09:57:26 +00:00
Alessandro Portale
f3c84c6d4f CMakeProjectManager: Fix warning about shadowing
Amends a998269d7e

Change-Id: I5a36c3fc15e2913656a1d7bf7113ebd39cd6008c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-09-21 09:57:04 +00:00
Cristian Adam
a51380c2fd CMakePM: Add policy support for help and code completion
Change-Id: I82d291639fe890602bba61eded9d1dfd7d38ca41
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-20 21:11:10 +00:00
Cristian Adam
a998269d7e CMakePM: Expand help for variables, properties and modules
Not only CMake functions.

Change-Id: Icd21eb39a55533261f2b5c170a9dbd38a640e3e9
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-20 19:54:03 +00:00
Cristian Adam
52e3ab5272 CMakePM: code completion changes for cmake_print_variables|properties
They are CMake module functions and need only certain parameters.

Change-Id: I6e49359470cd228fec985fca2297a50d44c76ded
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-19 16:35:18 +00:00
Cristian Adam
bc1c24eb84 CMakePM: Revamp the CMake code completion
By using KSyntaxHighlighting's metadata from the cmake.xml file.

With this information the code completion has localized arguments for
functions.

Added support for Generator Expressions $< and function ${ completions.

The project functions/macros and options are also taken into
consideration.

The file completion is using FilePaths and should work remotely.

Change-Id: I79d1360c1249c65c9db65349f326be5d41f0f734
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-18 15:22:39 +00:00
Cristian Adam
e37bbb8e03 CMakePM: Show link for Ctrl + mouse for functions/macros in editor
Amends 4d358ae337

Change-Id: I7f89a1c2e4a32ec8944995074d0198e960a9d798
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-18 08:33:03 +00:00
David Schulz
0b85fc5aa0 ProjectExplorer: reduce the perceived startup time
... by moving restoreKits to the delayed initialize phase.

Change-Id: If72e41b64ee71f2917b3f7a317d9887afc6e29e8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-15 13:08:49 +00:00
Cristian Adam
78f89fc777 CMakePM: Proper support for Unity builds
A Unity build can be enabled by specifying CMAKE_UNITY_BUILD set to ON
globally or per target bases via the UNITY_BUILD property.

CMake would then add unity_NN_[cxx|c].[cxx|c] sources files that would
include the existing project files.

The existing project files would then be added as "headers" to the
project and exported via the CMake file-api.

This patch makes sure that these new "headers" are added to the Qt
Creator's code model and have proper syntax highlighting, be available
to plugins (e.g. Todo) and so on.

Fixes: QTCREATORBUG-23635
Fixes: QTCREATORBUG-26822
Fixes: QTCREATORBUG-29080
Change-Id: Ie8dd542504f632c01f91691f8736e51be8b19a01
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-09-14 18:10:27 +00:00
Cristian Adam
4d358ae337 CMakePM: Jump to function/macro/option definitions in CMake editor
Fixes: QTCREATORBUG-25523
Change-Id: If9ab6651a858e5fa08e8a1c321cb1f757831e14a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-14 18:10:22 +00:00
Tim Jenssen
1a3a8ecc96 Merge remote-tracking branch 'origin/qds/dev'
Change-Id: Id242ab4ca485527defdcc1555d204e12e50ddb7a
2023-09-14 17:37:24 +02:00
Tim Jenssen
a603b65f18 Merge remote-tracking branch 'origin/11.0' into qds/dev
Change-Id: I2bf1a2a72d9765d9b4088840414b4933644db47a
2023-09-14 12:23:01 +00:00
hjk
efb93d1366 CMakeProjectManager: Remote-ify CMakeFileCompletionAssist implementation
Change-Id: I18aa3d23244dd6475657f43bc18ce83298e278bf
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-09-14 11:27:09 +00:00
Cristian Adam
4f26d802ca CMakePM: Remove support for extra generators
They are marked as obsolete in CMake 3.27 and will be removed in a
future version of CMake.

Fixes: QTCREATORBUG-29603
Change-Id: I6e5d36441d05b87ee4467d13781f53d4269636ad
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-09-14 10:30:06 +00:00
Cristian Adam
74640c6d5b CMakePM: Fix crash
Amends 6528bd3eed

Fixes: QTCREATORBUG-29587
Change-Id: I62e469a461dd730858e05d0309151dba4e9fe93c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-12 11:56:28 +00:00
Cristian Adam
3a3bf41eef CMakePM: Add support for cmake-format config files
Fixes: QTCREATORBUG-28969
Change-Id: I0bb31993e4d2ffd8affcc67dee5fd70654e2c1d3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-12 10:49:22 +00:00
Marcus Tillmanns
77cc79b7b0 CMake: Cache CMakeTool capabilities
Change-Id: Ie81347a7864abeeb64aa2af6dee3f9def241fed8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-09-12 09:29:50 +00:00
Eike Ziller
dab19c4a8c Use Nanotrace to generate startup performance report
Add various trace points to the code, including the plugin
initialization methods (centrally in plugin manager), code that is
scheduled on the event loop with QTimer::singleShot or
QMetaObject::invokeMethod during initialization, and code that is
triggered from ICore::coreOpened

Can be turned on by configuring with `BUILD_LIBRARY_NANOTRACE=ON`
Run with `-trace <file>` to write trace file. If Nanotrace is not built,
the added code expands to nothing.

Changes in Nanotrace:
- turned generated data to microseconds instead of nanoseconds, because
  that is what Chrome tracing expects
- fixed serialization of duration (needs to be an item of the event, not
  in a "arg" subitem)
- fixed shutdown() to reset the initEvent

Change-Id: I994de82023b820d771e1be0a859ebd8da0b73d4d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-12 07:32:07 +00:00
Marco Bubke
e4a470ed0b CMake: Fix warning
glibc 2.12 is now over 10 years old. I think we do not support it
anymore.

Change-Id: I3df4ebaa73de07c22ff71e50ddbee5938bd0ce55
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-09-07 11:08:14 +00:00
Eike Ziller
2792166574 Merge remote-tracking branch 'origin/11.0'
Change-Id: Ifab8b72af33de4decf20d2a879bea4dfba1e9fbe
2023-09-07 11:15:32 +02:00
Marco Bubke
9e60df9f7f CMake: Silence warning in third party code
Adding SYSTEM_INCLUDE for which you get no warnings. Fix
PUBLIC_SYSTEM_INCLUDE to work for all cases where PUBLIC_INLCUDES works.

Change-Id: I7059c2879004743c13c368220596081dd054407a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
2023-09-07 08:53:43 +00:00