Commit Graph

97 Commits

Author SHA1 Message Date
Christian Kandeler
78b9edd251 TextEditor: Rename class RefactoringChanges
... and remove outdated comment.

Change-Id: I6dcd0a38608192ccdd6734affd33e170d39e8299
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-20 14:37:19 +00:00
Christian Kandeler
09e495f01a ClangCodeModel: Fall back to built-in code model when following symbols
In normal interactive mode, users likely want fuzzy look-up, e.g. to a
non-matching overload if no exact match is present.

Fixes: QTCREATORBUG-29814
Change-Id: I55ca32c001e619d374cc015a7dd2f1564ed2a2c9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-09 11:50:22 +00:00
David Schulz
05ce5ea14d CppEditor: Fix crash when calling CppModelManager::projectPart
find and end of QMap potentially detach the container, so we have to use
constFind and constEnd

Fixes: QTCREATORBUG-29716
Change-Id: I2fef46580ff5b58a70201841423e5ca0a7b4d107
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-11-07 08:39:05 +00:00
Eike Ziller
8f3e77a3ae Tr: Re-fix plurals
The number for the plural must be given as the 3rd argument
to the tr() call, not as an arg().

Amends 1359e9c84f

Change-Id: I45241a6acd82041c320bbe476cd2b4cc92247ef3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-10-18 11:22:11 +00:00
Eike Ziller
1359e9c84f Tr: Fix some plurals
Change-Id: I9d7a52a64536e6e1c0a9da4f3cb2f3a116afb6cd
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-10-16 13:19:28 +00:00
hjk
6193cb3294 CppEditor: Stop updating things when shutting down
Fixes: QTCREATORBUG-29735
Change-Id: Ic1ee1798e156b5ddf564a721f5a4e8892ae40f63
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-10-11 12:23:55 +00:00
David Schulz
f491d93d2a CppEditor: remove superfluous locker in model manager
This locker potentially results in a freeze since the called projectPart
might require to lock for writing, which is not possible if the read
locker is still there. Additionally there is nothing we would need the
lock for in projectPartFromDependencies.

Change-Id: If957edfb4ebc45e18141cb14a63bf9567242cc48
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-09-13 08:48:22 +00:00
David Schulz
96c21b0e36 CppEditor: optimize CppModelManager projectPartForFile
Calling FilePath::canonicalPath is expensive on Windows, so only call it
if we cannot find the filePath in the cache and save the result to the
cache again. This reduces the time to parse the auto test for the Qt
Creator repository from 10s to 2s here. It also improves the performance
of various quickfixes and follow symbol of the built-in code model by a
similar factor.

Change-Id: I7025828e1b91f492825b10753e3b97e1c917fbfd
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-09-11 10:19:12 +00:00
hjk
017d7c0e47 ProjectExplorer: Rename kitinformation.{h,cpp} to kitaspects.{h,cpp}
Change-Id: I069bddeb457366210d339edcbb8ffb359a40fab8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-08-15 07:31:03 +00:00
Christian Kandeler
099fe7d5d1 CppEditor: Let users fold/unfold all comment blocks
Fixes: QTCREATORBUG-2449
Change-Id: Ib090f1bb0d0866f14ddb6dfb10bf2ff2563585e0
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-08-08 08:52:55 +00:00
hjk
8423d2b5e5 CppEditor: Proliferate use of FilePath a bit
Change-Id: I7e314d73a427bf40c10f3ca6c4c5804e31482f88
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-25 13:46:22 +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
hjk
90ba140545 CplusPlus: Use plainer callbacks to interact to the CppEditor
Lets us remove a few explicit CppModelManager::instance() call
in user code later.

Change-Id: Id8d846d06a0715b3d609cc5d52cc031e1d025fb1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-12 13:00:48 +00:00
Christian Kandeler
cf6bd7e012 Fix occurrences of the contains/insert anti-pattern
Introduce and make use of Utils::insert() for QSet with a return value
that indicates whether insertion actually happened.

Change-Id: I655e4bc3553b74fea5ae8956205e4d8070118d63
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-23 09:51:54 +00:00
Eike Ziller
edd1a89807 Move SessionManager to Core plugin
Sessions are independent from projects, and this allows for removal of
e.g. the dependency from Bookmarks to ProjectExplorer.

Includes moving the command line arguments (-lastsession, <session>) to
Core plugin.

Change-Id: I6c578fd15c4990902e7196501de20f39376e90e8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-05-25 11:15:41 +00:00
Jarek Kobus
c8c48d899f Locator: Fix style and reuse LocatorFilterEntries
Fix names of private members of LocatorModel to have
one common style.

Reuse LocatorFilterEntries where possible.

Change-Id: Icca1e396b9fafd165adf35939dd7859032f90c0c
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-16 08:33:36 +00:00
Jarek Kobus
b1d520c6b1 CppLocatorFilters: Remove the old matchesFor() implementation
Move the implementation of CppCurrentDocumentFilter into
cpplocatorfilter.h/cpp.

Rename CppLocatorFilter into CppAllSymbolsFilter to
conform to the other names.

Remove some unneeded intermediate classes now.

Change-Id: Ia911dc826b83ba11894757fc353ff72211910ff7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-05-12 06:45:27 +00:00
Jarek Kobus
7d87233c9c ClangCodeModel: Remove the old matchesFor() implementation
Rename some filter classes to conform to the names for cpp filters.
Remove some unneeded intermediate classes now.

Change-Id: Ib4fa295fa60da61c42c792556751d954ddb936e7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-11 10:24:08 +00:00
Jarek Kobus
a0f6e8dc04 Utils: Rename qtcprocess.{cpp,h} -> process.{cpp,h}
Follows QtcProcess -> Process rename.

Change-Id: I97235a9a40cb7fd52944515b7ab878d96528f919
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-04 05:52:26 +00:00
Jarek Kobus
470c95c94b Utils: Rename QtcProcess -> Process
Task-number: QTCREATORBUG-29102
Change-Id: Ibc264f9db6a32206e4097766ee3f7d0b35225a5c
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>
2023-05-04 05:52:16 +00:00
Jarek Kobus
b1e65195ac CppEditor/LanguageClient: Reuse MatcherType enum
Change-Id: I95a8c902ddf6d7525543ccbc2acf45fe273a12f4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-21 15:19:49 +00:00
Jarek Kobus
64f946445c CppLocatorFilter: Add cppCurrentDocumentMatcher()
Add also a test for it.

Change-Id: I324b1a2cbe89c0a1258dde93524689cb85e06737
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-04-20 11:59:01 +00:00
Jarek Kobus
99b5d93cfb LocatorMatcher: Introduce MatcherType enum
Use it for registering/getting different kinds of matchers.

Change-Id: I6f944e0332bf8c512892a00b8ba88f9939f34682
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-04-20 09:18:11 +00:00
Jarek Kobus
6e8988c926 CppModelManager: Use locator matcher for unused functions
With this patch, when both cpp and lsp function filters
are available, they now run in parallel. The execution time
for getting the filter results (~110 K hits) for the
Creator codebase went goes from ~1100 ms into ~650 ms.

This patch also solves the potential issue with interference
between parallel runs of functions filter in locator and
in find unused functions.

Change-Id: I8f7f0b85d325848c04760ab76a7b9f02bcb5991e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-04-19 12:54:25 +00:00
Jarek Kobus
8f44964059 CppCurrentDocumentFilter: Get rid of the arg from c'tor
It's always CppModelManager::instance().

Change-Id: Ia049ad3bd452f8773d679549c33981460c2705d4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-04-19 12:14:41 +00:00
Jarek Kobus
0c3789726d LocatorMatcher: Introduce LocatorMatcherTaskCreator
Register cpp and lsp matchers for all symbols,
classes and functions.

Change-Id: Id85c8164077ec395dac7e6ff45acc89db9e6ae08
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-04-18 11:40:16 +00:00
Jarek Kobus
37f2d68464 CppModelManager: Pass context object into signal connection
Change-Id: I6b66fbc6300597534a1498e4abbd8c3162cee73e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-05 12:29:47 +00:00
Jarek Kobus
36463f3c87 CppLocatorFilter: Don't repeat CppLocatorData arg in c'tors
It's always the same instance of:
CppEditor::CppModelManager::instance()->locatorData().

Change-Id: I7d8aa2da6f0055d91b519efb6ebdf2177794e0b7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-04-04 08:08:09 +00:00
Jarek Kobus
f83dbc3316 CppModelManager: Avoid using ILocatorFilter::allLocatorFilters()
Use dedicated CppModelManager::functionsFilter().

Change-Id: Iafc93ae9d1d1f6a4767289238e2fd36b276611c2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-04 08:00:47 +00:00
hjk
884a1d6f94 Replace a few \returns by Returns
Change-Id: I09c633e610421f5cc8257b15de60ffa98d890ee0
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-03-24 14:51:55 +00:00
Jarek Kobus
215f79f580 LocatorFilter classes: Use more linkForEditor
Limit the usage of ambiguous internalData.

Change-Id: Ice67884b9fb2ff303939cd5998c6e80453e82530
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-03-03 14:06:08 +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
Jarek Kobus
b364e4a9cd LocatorFilter classes: Use Core namespace
Change-Id: I4fd1b1ed6aa9d844ed49123e80bfb066b9fa7af2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-02-23 08:28:45 +00:00
Eike Ziller
379bf65e96 Some fixes in translated strings
- doesn't make sense to translate "%1"
- showPreprocessedFile: "reason" contains full stop, put at the end
- add missing closing >
- remove whitespace at the end of translated string
- added missing quotes and full stops
- Remove some control text from tr

Change-Id: I5537c3d12d038e25e2209af1198129fbf959b43c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-02-15 12:45:48 +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
hjk
2ce413112b Utils: Push FilePath::toString border line a bit further
... in SaveFile

Change-Id: I80164853b8a756af8c74038b0375c423a6f500e2
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-01-13 09:50:11 +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
4ddd28ae22 Utils: Rename QtcProcess::readAllStandard* to readAllRawStandard*
... and re-use the old QtcProcess::readAllStandard* names for
a QString-returning 'decoded' version.

For now, only use that in 'full Utf8' cases, to stay bug-compatible,
the plan is, however, to employ the QTextCodecs we have already
in the channel buffers. That will be one-by-one, though.

Change-Id: Id209e0671920d4ea4197918e872f441254112d52
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-10 12:08:53 +00:00
Jarek Kobus
63783f22c3 CppIndexingSupport: Flatten class hierarchy
Don't make CppIndexingSupport a pure virtual class as there is
only one subclass.

Change-Id: I9f216a2f1f5d04f601d07b9507a4e9cf27ff7c46
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-09 12:17:35 +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
e42d24fca9 CppEditor: FilePathify some of the refactoring operations
... and adjust surrounding code.

Change-Id: I1d36e5a0c6ba14a1d9b8fd59340f1bb2a1e45ad1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-16 14:27:50 +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
b354421f27 CppEditor: Use FilePath in fileSizeExceedsLimit()
... and adapt caller side.

Change-Id: Idd832101962dcdc8b24f96bebbdb77fd3e29ba7c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-08 12:07:45 +00:00
hjk
39ffdb416f CPlusPlus: Use FilePath for resolved include paths
... and fix fallout.

Change-Id: I66886e91ff476eff15db51cc024a8021e952d44d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-30 17:27:56 +00:00
hjk
83720540a1 CppEditor: Convert parts of ModelManagerInterface to FilePath
Change-Id: If7503b6d6732e1735eb8d48ece6e80886d10c647
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-29 12:27:10 +00:00
hjk
03a91f9f98 CppEditor: Remove Snapshot::remove(QString) overload
... and fix fallout.

Change-Id: Ibbf865c3e4158fc98bb9b5372ce0633807b85576
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-29 08:25:16 +00:00
hjk
196e73fa16 CppEditor: Convert AbstractEditorSupport interface to FilePath
Change-Id: I47439e154bc28d40e112b7eef46fa1f57a8b3fce
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-28 14:02:05 +00:00
hjk
038771051d CppEditor: Switch to FilePath in IndexItem
... and fix fallout.

Change-Id: I45d27146806bdcb5ceb728b710eca51c7cd32ee2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-25 11:16:38 +00:00
hjk
40ba25b691 CPlusPlus: Return FilePaths from Document::includedFile
... and fix fallout.

Change-Id: Ieaad57700fa48d0c4a0dd9bf2c284315579b9473
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-25 09:23:39 +00:00