Commit Graph

1581 Commits

Author SHA1 Message Date
Christian Kandeler
73f8854263 ClangCodeModel: Fix following virtual functions
Don't indirectly trigger the regular callback once the proposal widget
was shown.
Amends 09e495f01a.

Change-Id: I9d2411f88c69488d63462318f48cef4a0eeeaed1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-12-01 13:43:33 +00:00
Christian Kandeler
c20129a973 ClangCodeModel: Make VirtualFunctionAssistProcessor more safe
Let's not access the object state after emitting
ClangdFollowSymbol::done(), in case the receiver deletes us.
Can happen in test code.

Change-Id: Ia6c691c0f88b16476da1a6be1cedd106d9da2d53
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-29 09:48:30 +00:00
Christian Kandeler
6ed456ed9e ClangCodeModel: Fix check for strings that look like file paths
Backslashes in the markup string are escaped with another backslash, so
we need to check for two consecutive ones on Windows.
Otherwise, qdoc/doxygen commands such as "\note" are interpreted as files
and trigger expensive I/O operations.

Fixes: QTCREATORBUG-29975
Change-Id: I822f57a8612274ff4112063928cab21b9d7ca792
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-29 09:47:46 +00:00
Christian Kandeler
e0a06cda28 CppEditor: Allow tests to run with ClangCodeModel enabled
So that in the CI we can simply run:
  $ qtcreator -test CppEditor -load ClangCodeModel
There are some failures left, which we will tackle one by one in follow-
up patches.

Change-Id: Ic4ebcb82f6439b344ae055889a6a16d56b2e3206
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-11-29 09:46:24 +00:00
Christian Kandeler
711b976294 CppEditor: Also rename function comments for declarations
... that are not definitions.
Amends 0a058bb657.

Change-Id: I4ba19f915d653d05570f8cd244ea50ab40d4b9dd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-29 09:42:18 +00:00
Christian Kandeler
240748c106 TextEditor: Get rid of extra indent ranges in RefactoringFile
Having extra indent regions complicates the interface, the
implementation and the calling code.
Instead, derive the indent regions from the change set and let callers
opt out for the relatively few cases where indentation is not desired.

Change-Id: I49d2854830a51778534ef260fb5c9f2c7685554a
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-22 13:47:16 +00:00
Christian Kandeler
cf74409bac TextEditor: Introduce PlainRefactoringFileFactory
This makes it immediately clear that there are more specialized variants
available, which helps users make a conscious decision.

Change-Id: I35feb4bed2d91fb4f83ede6e731d9ce89fd4af3f
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-20 14:37:37 +00:00
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
Eike Ziller
1c4de485da Merge remote-tracking branch 'origin/12.0'
Change-Id: Ib09af70f157a6c7d6cbda4e3de678fd2bbceb229
2023-11-20 09:48:43 +01:00
Jarek Kobus
ce80a6dad5 TaskTree: Rename TreeStorage<> -> Storage<>
This addresses the 20th point in the master task below.

Task-number: QTCREATORBUG-28741
Change-Id: I696beda87430fbe637abba8054012fb77516e220
Reviewed-by: hjk <hjk@qt.io>
2023-11-20 08:25:50 +00:00
Jarek Kobus
ced3052e7f TaskTree: Get rid of Storage subclass of GroupItem
Make the c'tor of the GroupItem taking the TreeStorageBase
public instead.

This addresses the 20th point in the master task below.

Task-number: QTCREATORBUG-28741
Change-Id: I78320ec24b4e4b915ab549135fb93b45c658b9f2
Reviewed-by: hjk <hjk@qt.io>
2023-11-20 07:47:54 +00:00
Christian Kandeler
6f3bc431fc TextEditor: Move more code into RefactoringFile
We want to get rid of RefactoringChangesData.

Change-Id: Ia428563a0ff70ec9660761beac3eb7168b8e9eca
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-17 09:43:02 +00:00
David Schulz
cff26d813a Clangd: Avoid client restart after modifying open documents
Change-Id: I116eed1b047159e3d1ce64f18f44da6a0ad7b231
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-11-17 05:38:13 +00:00
hjk
43e4c7913f ClangCodeModel: Use ActionBuilder
Change-Id: I40cd7fc9eb346b0b70ea24f980846d175cfde3d4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-11-16 17:04:45 +00:00
Tim Jenssen
9f1d23df00 Merge remote-tracking branch 'origin/qds/dev'
Change-Id: Ic852bc9977d0292fb6cd93a319f4bfdebb22a1b0
2023-11-16 17:17:46 +01:00
David Schulz
b960fb4481 Editor: centrally emit filesChangedInternally after refactorings
...instead of relying on the surrounding code of the refactoring to emit the signal.
This also ensures that the signal is only emitted for files that are not opened inside
a TextEditor.

Change-Id: I6223362864014c691962d895b864f9f44c36e035
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-11-16 12:05:13 +00:00
Eike Ziller
e3856289fe ClangCodeModel: Fix capitalization of menu item
Amends d0203a39fa

Change-Id: Ie7d63927907027dfddc579f66e6e9b1c51a10bd9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-11-14 10:35:36 +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
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
Jarek Kobus
6e6aa7102c TaskTree: Introduce CallDoneIf enum
Get rid of CustomTask c'tor taking 3 handlers.
If the done handler needs to be called only on
success or an error, add explicit 3rd arg of CallDoneIf type.

Task-number: QTCREATORBUG-29834
Change-Id: I10e55415587e6cac46620dd5177ad8269584583c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-11-07 11:51:25 +00:00
Volodymyr Zibarov
d0203a39fa ClangCodeModel: Add menu action to re-index files
... that depend on changed headers.
When changing a header file the clangd code model is not updated for
files that including it if they are not opened in editor.
This is not to be done automatically, as it would be a performance
hazard to rescan many files, for example when changing a widely used
header.
Add a menu action to trigger such re-indexing manually to solve the
issue.

Task-number: QTCREATORBUG-27387
Change-Id: Ia8033401f847627cee041b102f9ac6f3af3dd709
Reviewed-by: Volodymyr Zibarov <gogan419@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-11-03 15:36:16 +00:00
Eike Ziller
f9d4697371 Merge remote-tracking branch 'origin/12.0'
Change-Id: Ice9c78147917fc13b6cf81ba781a37bdcd870e17
2023-11-03 14:58:00 +01:00
Christian Kandeler
a1b78d4234 ClangCodeModel: Fix shadow document handling
Our approach was not fully thought through: When we got informed of a
file getting created by an ExtraCompiler, we would make it known to the
first client that came along and then forget about it. This means that
e.g. a source file including a UI header would parse fine with the first
client that opened it, but after switching the build configuration or
possibly even just touching the project file, the UI header would not be
found anymore.
Fix this by keeping the information about generated files around and
attaching them to every newly initialized client.
Note that this state should probably be kept somewhere more central.

Change-Id: Ib1d8cca9258d1962513d8d463f5d16f9ff91a048
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-03 12:22:23 +00:00
Eike Ziller
cb14613c73 Merge remote-tracking branch 'origin/12.0'
Change-Id: I6309a8ffb18e40a581301bd275390395e250543c
2023-10-26 14:28:02 +02: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
Eike Ziller
df80454d26 Merge remote-tracking branch 'origin/12.0'
Change-Id: I04104ef638b28d99da11b9b7a22f31f8d0ddf460
2023-10-24 13:05:55 +02:00
Jarek Kobus
5cb40870b1 Tr: Fix some source texts
Change-Id: I06458b177af2691a362368faed2b6bea3883a2f5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-10-19 11:10:23 +00:00
Eike Ziller
ad7d559028 Tr: More small fixes
Change-Id: I5d9324d3f64eaa522fa1d435efa39fa43d84798a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-10-18 12:10:45 +00:00
Christian Kandeler
d16d1718f3 ClangCodeModel: Forward to the built-in code model
... if the user tries to complete inside a comment or string.

Fixes: QTCREATORBUG-20828
Change-Id: I245e1bd16acaf696601cabe33f27210da21cc12a
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-17 12:03:17 +00:00
Christian Kandeler
0bfa8fd718 ClangCodeModel: Allow users to choose between completion ranking models
... in clangd.

Task-number: QTCREATORBUG-29013
Change-Id: Idd80a195709e9813f1713a048f6229a7dd6493ba
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-10-13 13:03:21 +00:00
Christian Stenger
43cfe48fed ClangCodeModel: Respect settings
If the user disables usage of clangd and opens a cpp file
without a project we still tried to set up the fallback clangd.
Silences a soft assert.

Change-Id: I753ce2eddb00b344b109ba4ff3da61a849767a79
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-10-13 12:34:19 +00:00
David Schulz
80633a59aa LanguageClient: support additional goto targets in symbol support
Allow to follow to the symbol definition as well as to the type
definition for the symbol under the cursor position.

Change-Id: I8ff50b33a1e739f81b0832b1b28ffc525e1f7177
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-09-29 09:10:14 +00:00
Christian Kandeler
1723af0206 ClangCodeModel: Enable clangd hidden features when server logging is on
Potentially useful for debugging.

Change-Id: Iada7f2809d0f42bd5445ac6f9a8161a03ffd9bb5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-09-28 09:53:39 +00:00
Christian Kandeler
25c7390d0a ClangCodeModel: Start fallback clangd on demand
E.g. when a non-project source file is opened.

Fixes: QTCREATORBUG-29576
Change-Id: Ia99346a7a1016c4c7dcdb41ad6c8dbbc85ed95ff
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>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-26 08:52:28 +00:00
Eike Ziller
13c12f33e5 Merge remote-tracking branch 'origin/11.0'
Change-Id: I397dde2f95f62eb4843c39dd861522ae63d7f2c9
2023-09-20 10:43:54 +02:00
Christian Kandeler
a217fa0c22 qbs build: Clean up testing infrastructure
- Rename ambiguously named "testsEnabled" property to "withPluginTests"
  and fix the wrong uses.
- Move AutotestRunner out of main project file and into tests.qbs.
- Move "withAutotests" property into qtc module. We cannot remove it
  from the main project file just yet, because some manual tests do not
  make use of QtcManualTest at the moment.
- Do not remove the autotests from the project tree if autotests are
  disabled. Instead, just disable the products.

Change-Id: I74a4cc717d9adbe53d37536b2565111e1617115b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-09-19 13:16:28 +00:00
David Schulz
85cba79cd2 ClangCodeModel: fix setting refactoring markers for clangd
LanguageClient::updateCodeActionRefactoringMarker overwrites previously
set refactoring markers.

Fixes: QTCREATORBUG-29493
Change-Id: I156b4e2ff65aed5928251bfea184e093df686818
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-09-15 13:09:09 +00:00
hjk
67212a31ee Utils: Cache theme icon access
These trigger over 120k file exist check on my machine on startup,
just for a handful icons.

Change-Id: Ic73f0783142ed329c2f8c8b852f622e69fc306da
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-01 14:03:33 +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
hjk
dc6b40a5c0 Use Utils::Storage instead of QVariantMap in a few places
Change-Id: I02833cf2bc3caaadc22ff93ae530e4aebe4c3868
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-23 14:30:50 +00:00
Christian Kandeler
b33b99e2d9 ClangCodeModel: Take changes from header files into account immediately
... in the dependent sources. That's also how the built-in code model
behaves, but clangd itself only does this when a document is saved.

Change-Id: I52d6badb0b7f063e5924c05dbf83a6e9849c9f6f
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-08-22 13:59:04 +00:00
hjk
aa25fdcc69 QtSupport: Rename qtkitinformation.{h,cpp} -> qtkitaspect.{h,cpp}
Change-Id: I12229e5e98b468101d32edd35be74bbda0921d89
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-08-15 08:59:52 +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
hjk
e2a370f280 LSP: Use 8-bit keys in Json wrapper
Sufficient, smaller, faster.

Change-Id: I0d740785109538e04fc674c11d578ded8d2815fb
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-15 07:11:31 +00:00
Eike Ziller
a419670ff5 Build: Change plugin json.in files to CMake style
They were still using variables in qmake style.
Directly use CMake variables in the json.in files and remove the no
longer needed escaping of quotes.

Adds a fatal message if it detects the old style in a .json.in file for
easier porting.

Change-Id: I8de88d8db2da55781f0e9d72eda03f943723188e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-07-25 13:21:16 +00:00
Eike Ziller
77c7e26779 Tasks: Show tool tips with information about the categories
When hovering an entry in the filter menu in the Issues view.
Also remove some categories that shouldn't be there.

Change-Id: Ifb367d69b9396c2fdc45b83ec5ffd88ac2f0eda7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-13 06:09:27 +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
1d59a37acb ClangCodeModel: Fix outdated message
... after applying a clangd warning suppression.

Change-Id: I6b6605edd80080dcfd070b4a2f4219463674421b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-12 12:57:06 +00:00
Eike Ziller
cd1b6a669b Tasks: Create a container class for category data
Reduce the number of arguments that need to be passed around.

Change-Id: I9fbfdcdf7b20f8f26e35f435bf8d65ba483e4114
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-12 06:34:25 +00:00
Eike Ziller
3d3c78dfc6 Merge remote-tracking branch 'origin/11.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs

Change-Id: If3ada34dcc764fa1d0cce04fd343fb5a02c2fbaa
2023-07-10 09:29:51 +02:00