Commit Graph

171 Commits

Author SHA1 Message Date
hjk
5646aae859 CMake: Use setup functions for a few more cmake related items
Change-Id: I7a1bbea9507d7d168584348a51d557f4a910de47
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2024-01-29 13:42:27 +00:00
Cristian Adam
76a8966739 CMakePM: Refactor CMakeLists|Cache.txt as constants
Change-Id: I7165fa1d219a0c59bc519a9af1cd194414c4311c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-01-29 11:50:21 +00:00
hjk
cf4f221065 CMakeProjectManager: Move CMakeIndenter class definition to .cpp
Leaner internal interface.

Change-Id: I297c74e667891efbeab0edabbfc82fb058501aa2
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-12-21 14:59:10 +00:00
hjk
6685f0255d Utils/all: Move mime constants into a central place
They are reasonably standardized, and generally usable cross-plugin,
so this can help to avoid a few cross-plugin compiletime dependencies.

Change-Id: Icb2b010c3e12dee69df54ab16f6f8e90d9cffba6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-11-08 09:59:26 +00:00
Cristian Adam
bcc45d8bb9 CMakePM: Allow navigation to ${PROJECT_NAME}
Task-number: QTCREATORBUG-27211
Change-Id: I23e2c6f39ff3d4c89ef78a66c10e619e3df3245f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-31 15:52:41 +00:00
Cristian Adam
524634f124 CMakePM: Add support for "$ENV{" code completion and help
CMake has a few environment variables that are documented and this
commit adds support for them.

Change-Id: Iaa31bdc97b343581fcf519d19e66bc6ce8ace150
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-10 18:08:13 +00:00
Cristian Adam
399e12c973 CMakePM: Fix crash in findLinkAt
Fixes: QTCREATORBUG-29715
Change-Id: I4db919c8858631beb573789d1888b3dbee606c50
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-10-09 10:26:10 +00:00
Cristian Adam
224b409013 CMakePM: Fix opening context help via F1 in hover tooltip
Change-Id: I9ebd6a6ec8e00c63bd6f9182ba8530944f3437ea
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-05 15:16:48 +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
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
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
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
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
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
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
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
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
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
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
Cristian Adam
925b7a3566 CMakePM: Replace QDir with Utils::FilePath in editor
This way we could handle remote files.

Change-Id: I7062445cb743a2838f3c9f1bcff89611127011ca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-08-31 13:04:53 +00:00
Cristian Adam
bd36af75eb CMakePM: Add F2 jump for CMAKE_SOURCE_DIR and more
This will allow opening CMake files via F2 when using include statements
like: include(${CMAKE_SOURCE_DIR}/cmake/api.cmake)

CMAKE_BINARY_DIR and CMAKE_CURRENT_BINARY_DIR are also supported.

Fixes: QTCREATORBUG-29467
Change-Id: I9adb417d98e8a8fccf6cd3e5038562db02cb28c2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-08-25 08:51:34 +00:00
David Schulz
4743724d4c Editor: replace Utils::Text::Replacement with Utils::ChangeSet::EditOp for formatting
Removes the last usage of Utils::Text::Replacement with a more commonly used pattern.

Change-Id: I0912bf61388a58ddaba424380ec139f9aa15fc4c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-04 11:39:30 +00:00
Tasuku Suzuki
6e59fa4305 Remove unimplimented method declaration
Change-Id: Idea9e31ccca7de4a00a8cd9cde5c40491ae1dcbc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-07-03 15:00:38 +00:00
hjk
19a6428f54 More deprecation induced busywork
QString::count() will vanish.

Change-Id: I65672fa648c0969930e9398ec4e541a0771c8a57
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-08 07:00:01 +00:00
David Schulz
be0a129543 CMake: fix find link at
Change-Id: I1afcd3bd2b4db53ff8284f9acbe2b07102e66205
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-07 07:38:16 +00:00
David Schulz
ea108f4857 Editor: Adjust remaining usages of BaseTextEditor:convertPosition
amends 9bb126c0d6

Change-Id: I42b96f1f7364f75da88eccd7a86fc25b9cd1499d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-05-30 13:35:07 +00:00
David Schulz
9bb126c0d6 Utils: make column of convertPosition 0-based to merge it into Position
Change-Id: I239b3cb33b8ad59ac4097c919155ab5ca7d57b8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-24 11:53:28 +00:00
Alessandro Portale
e27f82b49e Translations: Merge "OpenWith::Editors" into "QtC::Core"
Change-Id: I241ccc53afa11fa3faa1f1ca9363421827081812
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-02-20 08:00:37 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Jarek Kobus
d0e24654f6 CMakeProjectManager: Pass context object to lambda connections
Remove some unneeded lambda () brackets.
Remove some unneeded lambda return type specifiers.

Change-Id: I9695367d66a151f2611554b9fe5897c1bac7ef5c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-08 15:28:50 +00:00
hjk
ab4c9b9679 CMake: Move to Tr::tr
Change-Id: I169da93b5184351cb915d4c198fd33318fcfe06f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-30 06:56:21 +00:00
Eike Ziller
e3f375925d Prefer project's Qt version for context help
To avoid additional dependencies, let the QtSupport plugin register a
function for filtering help URLs, and add information about the
originating file path to the help items created by the context help
handlers. The filter hook then finds out the corresponding project,
active target, and corresponding Qt version, and filters the help URLs
accordingly.

With the default setting in "Kits > Qt Versions > Register
documentation", only the highest versioned documentation set within a
major Qt version is registered, so context help now shows the highest
versioned help from Qt 5 or Qt 6 depending on active target. If that is
changed to "All", context help now shows documentation from exactly the
version that is currently used by the project.

Fixes: QTCREATORBUG-10331
Change-Id: I7d87793737cc5ab7d228ee4bfe568d7e8343ee7d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-26 09:24:55 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Cristian Adam
8d99df9a7c CMakePM: remove unused headers, enforce sorting of headers
Used clangd hints.

Change-Id: Iade4de67c1d2e5fdd1a880c5603b31203170ebbe
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-11 08:43:09 +00:00
Christian Kandeler
a167bd9ad2 Do not pass Utils::LinkHandler by rvalue ref
There is nothing special about this type that justifies it sticking out
everywhere it appears.

Change-Id: Iccdc95163d477db8a031d0d520f28fea26432a44
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-06-07 09:22:30 +00:00
Christian Kandeler
5693c518bc Utils: Rename ProcessLinkCallback to something less clumsy
Change-Id: Icce4995f4aa886524dc3eedb7cf9ba72adbe8783
Reviewed-by: hjk <hjk@qt.io>
2022-06-03 13:23:28 +00:00
David Schulz
356bfcc9fd Utils: filepathify Link
Change-Id: Ie62500bde139158e776f9698ee0ea00c2a113f93
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-25 17:32:18 +00:00
Eike Ziller
82bb6a3c72 CMake: Fix "Jump to File" with special characters
Fixes "Jump to File" from the context menu and the ctrl+click navigation
for files that contain special characters.

Fixes: QTCREATORBUG-25572
Change-Id: I7c26c6d517ced26f803c2224f0c09397f373b3b5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-04-13 12:32:29 +00:00
Tobias Hunger
5350288e45 CMake: Fix includes all over the CMake plugin
Keep internals internal, remove some unnecessary includes, add
some that should have been there.

This reduces the number of files that get rebuild when working
on CMake internals from over 1000 to about 200.

This patch also moves some code around that ended up being
in the wrong file.

Change-Id: Icd7366ac760dc85031040720418fbb16336dce9b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-04-20 10:05:24 +00:00
Tobias Hunger
74a07f906f CMake: Rename some constants
Rename some constants to get a bit more consistency into the
naming scheme. I am so tiered of missing a constant due to it
not having _ in the expected places!

Change-Id: Ibb5e82ea4e25ccb559352839b96c8a64394f3085
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-04-17 13:24:43 +00:00
hjk
afd8bc2c9e De-Q_OBJECT-ify various IEditorFactory derived classes
Change-Id: I1470b06d4e10073bb6e4f7ae735f9829fab3bb7b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-13 12:38:35 +00:00
Igor Sidorov
a9e40ad14c Add final specifies to classes
Warning -Wfinal-dtor-non-final-class in clang trunk

Change-Id: I2bf17064bf8898eab10b82b69583a283157766d0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-05 09:33:55 +00:00
Eike Ziller
42b8a22840 CMakeEditor: Add fallback help ID
Like we do for the BaseTextEditor.
This allows users to get context help also for items that are not
"commands", like various variables that have a meaning for CMake.

Change-Id: Ie1af61bdffdeecb406b1dc7e6127000c17ea5a8e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-08-19 06:49:56 +00:00
Tobias Hunger
02e224fcfa CMake: Support CMAKE_CURRENT_LIST_DIR and CMAKE_CURRENT_SOURCE_DIR
Support CMAKE_CURRENT_LIST_DIR and CMAKE_CURRENT_SOURCE_DIR as
variables in filenames when handling links in the CMake editor.

Having a way to find out variable values in CMake would be nice,
till that arrives, we have to live with hacks to make the most
common variables work:-/

Task-number: QTCREATORBUG-21065
Change-Id: Iffaaae8665e0662226d08b88de37b66d5a5fc4d4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-07-29 08:47:08 +00:00