Commit Graph

36 Commits

Author SHA1 Message Date
Jarek Kobus
dcaa3afd6d Various Plugins: Replace setPaused() with setSuspended()
Fix warnings about deprecated QFutureWatcherBase::setPaused().

Change-Id: I7c4637bcaf141bbda46e34da48306a25c68f039f
Reviewed-by: hjk <hjk@qt.io>
2024-07-22 06:09:07 +00:00
Christian Kandeler
faa595e38b CppEditor: Introduce per-project code model settings
Change-Id: I325cc39e60d4b1f0fba1651502d772bfb9c6a91c
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-03-15 14:21:21 +00:00
Christian Kandeler
1de045f687 CppEditor: Move some convenience functions to CppCodeModelSettings class
Change-Id: I0af8560c23374ce4f6c46f98d498d44f7cb50db3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-03-12 08:55:11 +00:00
Christian Kandeler
2ad3520e5a CppEditor/LanguageClient: Do not rename in generated files by default
Fixes: QTCREATORBUG-29778
Change-Id: I4e56b6bda4e22c71995ab19ac6469ea88d22ee11
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-25 11:49:01 +00:00
Christian Kandeler
0a058bb657 CppEditor: Consider symbol occurrences in comments
... when renaming.
For local renaming, we consider only function parameters.

Task-number: QTCREATORBUG-12051
Change-Id: I7948d69f11b97663c9bd747ae6241a82dd9bdd82
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-09-01 11:42:17 +00:00
Christian Kandeler
098ddf11e8 CppEditor: Introduce testing infrastructure for symbol renaming
Also add two example tests.

Change-Id: Ia76c4d92e7643971c1f201081b3df1f77f1e89a5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-08-25 12:12:28 +00:00
hjk
0b83f110f4 CppEditor: Make a few CppModelManager functions static
... to simplify code using it.

Change-Id: Ib2bfbb5a17a1d48088a9cf4973d4c3f006cd34e4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-12 13:08:09 +00:00
Christian Kandeler
8e75381fce CppEditor: Give C++ file name settings a per-project variant
Fixes: QTCREATORBUG-22033
Change-Id: If37517bb091438e70c5af5102bf833ed46d0c951
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-06-08 08:23:01 +00:00
Jarek Kobus
c879aeb565 SearchResultItem: Introduce SearchResultItems
And reuse it.

Change-Id: Ia052297340f2bf2478fbfdb2427b45e30bd9d067
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-08 06:41:41 +00:00
Jarek Kobus
8b3aa900da Utils: Move SearchResultItem/Color into Utils
It's going to be reused inside FileSearch.

Change-Id: I8993d7158ff31c311c2283d32bc43465a8946a52
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-08 06:41:27 +00:00
Jarek Kobus
a3a5b8f806 Utils: Rename asynctask.{cpp,h} -> async.{cpp,h}
Follows AsyncTask -> Async rename.

Change-Id: I37f18368ab826c9960a24087b52f6691bb33f225
Reviewed-by: hjk <hjk@qt.io>
2023-05-03 13:24:20 +00:00
Christian Kandeler
a03bea81c7 CppEditor: Remove WorkingCopy::contains()
Most uses involved a double look-up.

Change-Id: Ifeb62ea2361222ed0faad749f44a59735c8d6930
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-05-03 09:50:53 +00:00
Jarek Kobus
a8214665fe CppEditor: Use QtConcurrent invocation for async run
Change-Id: Ibbac7f7788fe966c0dd846d68b7d17c43acadb0e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-09 11:28:24 +00:00
hjk
3e7d93c788 ProjectExplorer: Move some not-fully-session related bits
... out of SessionManager.

The idea is to later move SessionManager into the Core plugin,
which both is sensible conceptually and also prerequisite to
merge the Bookmark plugin into TextEditor plugin.

Currently, only the interface is split, as the load/save
implemetations are non-mechanical to disentangle.

Change-Id: I31631db3094ea192825a2ccaa6add6188662940b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-01 09:26:50 +00:00
Christian Kandeler
0d909c353c Designer: Update C++ code model on an object name change in designer
We try to locate the old symbol name in the generated ui header and
rename the symbol in the background.

Task-number: QTCREATORBUG-1179
Change-Id: Iaf68e3922cd728cbc87d0dc97125e34b8bdaa6be
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-27 10:02:52 +00:00
Alessandro Portale
f7bcd4f574 CppEditor: Convert to Tr::tr
Change-Id: Ic4025e06e17c45eb6dc2162fb7f21f5b8aebe84d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-12 06:46:45 +00:00
hjk
b87f0519e3 CppEditor: Use FilePath for ProjectPath::m_sourceFiles
... and update using code.

Change-Id: I682727a4b2982dba388e7cc7b9488225748d591f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-11 09:54:25 +00:00
hjk
a2d2150261 CppEditor: Re-use Symbol::filePath()
Change-Id: Ic958fc0b8916c1afe8b955b140a5cf76e971623d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-09 11:32:48 +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
hjk
4159c4b5d5 CppEditor: More migration to FilePath
Change-Id: I261b713671e00bb567f61b4ee5ecf6fa83473bff
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-14 09:14:12 +00:00
hjk
f68db427ef CPlusPlus: Migrate Macro to FilePath
Change-Id: I94e8702e81e809e4d8318572cc070a0531edaefa
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-28 13:11:28 +00:00
hjk
49d6456b66 CppEditor: Remove WorkingCopy::get(QString) overload
... and fix fallout.

Change-Id: I8fe67616f8f327428b1c166ae69ec34c2924ee9f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-25 13:34:34 +00:00
hjk
67e9c2d7a0 CppEditor: Proliferate FilePath use
Remove SnapShot::{find,contains}(QString) overloads and fix fallout.

Change-Id: I50c415826939e09ac111f33def611c7478fa5d97
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-25 09:01:05 +00:00
Christian Kandeler
bfecefabc0 CppEditor: Let users check for unused functions in (sub-)projects
Note that especially in C++, there can be a lot of false positives,
especially in template-heavy code bases. We filter out the most notorious
offenders, namely:
    - templates themselves
    - constructors and destructors
    - *begin() and *end()
    - qHash()
    - main()
Since the code model does not know about symbol visibility, the
functionality is quite useless for libraries, unless you want to check
your test coverage.
The procedure is rather slow, but that shouldn't matter so much, as it's
something you'll only run "once in a while".

Fixes: QTCREATORBUG-6772
Change-Id: If00a537b760a9b0babdda6c848133715c3240155
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-24 09:27:03 +00:00
hjk
fa1adf4d40 CPlusPlus: Proliferate FilePath use
The starts with CppDocument::filePath(), plus a bit of the fallout

This is one patch of potentially many. It is hard to draw the
line where to stop this kind of chunk, this here converts a few
additional functions for which including it in the patch looked
like less churn than without.

Converting is mostly fromString/toString, with a few exceptions
for "already seem" like caches, that use cheaper "path()" to
avoid likely performance regressions (on Windows FilePath
comparison is currently case-insenstive, and more expensive).

There should be no difference for local operation with this patch.

Change-Id: I7b35f98a0a6f0bfed4ea0f8f987faf586f7a8f2b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-22 15:30:00 +00:00
Christian Kandeler
d891e18edc CPlusPlus: Make Usage::Type QFlags-based
We want to extend the enum with more non-exclusive values.

Change-Id: I4d8ebe1f7327139c7817b9f621b4b74a883c5e09
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-07 11:33:33 +00:00
Christian Kandeler
a522215840 CppEditor: Move renameFilesForSymbol() to ProjectExplorer
We'd like to use it outside of CppEditor in the future.

Change-Id: Ie7553a17aa1d86fb898eaa315a1613ac0ff6b452
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-22 07:09:38 +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
hjk
0197a62fcf CPlusPlus: Microoptimizations
Inline some simple accessors, return references instead of copies in
some getters,

Change-Id: I136574823c79ad0c63ed354b78e1ad83908e7ae5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-10 14:45:28 +00:00
Jarek Kobus
a64ca6d071 CppFindReferences: Avoid using sender()
Change-Id: I8db77d9c4fecbb89875128555050a4dd5a248a42
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-07-21 16:07:21 +00:00
Jarek Kobus
cfd002ebf0 SearchResult: Rename cancelled() into canceled()
Make it consistent with Qt American style.

Change-Id: I01a70f282d654d23f2341352cf4f6fea22aa49fa
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-07-20 13:17:36 +00:00
hjk
ffa3aad576 CPlusPlus: Inline some simple central functions
Depending on context, callgrind sees contributions of >8% to
the total cost of project parsing for these functions. The
functional are actualy executed executed out-of-line, often
for a function body of one "payload" instruction only.

Inlining removes the call/endbr64/ret overhead.

Change-Id: I6886f08e322fcaa4e0f54d424279e0a8c24e4718
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-24 11:49:41 +00:00
Christian Kandeler
e128c8cbde CppEditor: Fix looking up containing function for search result
- Move look-up to CplusPlus::FindUsages, where we are guaranteed that
  we actually have the document source.
- Use the same straightforward algorithm as with clangd.
- Undo the changes to CppDocument::functionAt(), which broke
  the autotest.
Amends 6f7e7980d2.

Change-Id: I008d05ba41a3b63b71e3131d7021e0d4e7d0641f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-13 06:54:58 +00:00
Ihor Ivlev
6f7e7980d2 Display parent functions in the Find Usages menu
To display the parent function, first we find it in displayResults and
store the information to SearchResultItem, then
SearchResultTreeItemDelegate gets the information and renders it.

Similar approach is applied to ClangdClient, in addSearchResultsForFile.

This change also adds default style for containing function highlight in
the search.
Default foreground and background colors are same as usual text colors.

Task-number: QTCREATORBUG-27550
Change-Id: Id1251afa192f8d1232524742b7c211770bcb83fb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-25 15:05:25 +00:00
Artem Sokolovskii
dea72a4003 CppEditor: Remove foreach / Q_FOREACH usage part 2
Task-number: QTCREATORBUG-27464
Change-Id: I352bf37bd017e7381fbd7b050fbb55c9a73bd668
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-09 13:30:46 +00:00
Christian Kandeler
284817fae6 Merge CppTools into CppEditor
There was no proper separation of responsibilities between these
plugins. In particular, CppTools had lots of editor-related
functionality, so it's not clear why it was separated out in the first
place.
In fact, for a lot of code, it seemed quite arbitrary where it was put
(just one example: switchHeaderSource() was in CppTools, wheras
switchDeclarationDefinition() was in CppEditor).
Merging the plugins will enable us to get rid of various convoluted
pseudo-abstractions that were only introduced to keep up the artificial
separation.

Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-01 14:53:58 +00:00