It's not needed, and conflicts with the namespace of the same name in
some contexts.
Change-Id: I281025abbfad0feb602f006e3b997a8b9c308b48
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
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>
It was not helpful that we had four different classes with the same name.
Note that they look suspiciously similar and could possibly be merged
into a single class at some point.
Change-Id: I7d4c10a09408226037bc0d276940bca39dc5f576
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... for the case where the value is retrieved via a call to a template
function whose scope does not include the template type.
Fixes: QTCREATORBUG-25998
Change-Id: Ie33817f445fb53595b783f716093637926297549
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... so we can re-use the "follow symbol" test cases with clangd.
Call Creator like this (clangd needs to be version 12 or later):
$ QTC_CLANGD=<path to clangd> qtcreator -test
'CppEditor,*Follow*,*Switch*' -test 'ClangCodeModel,*dummy*'
During testing, some invalid code in the test cases was uncovered and
fixed.
Change-Id: I9dc650fdba2a27600e6a550420ee873f6fb31d23
Reviewed-by: David Schulz <david.schulz@qt.io>
Since the implementation has been moved to the cpp file, then
the inline keyword has to be removed otherwise it will cause a
build error.
Change-Id: I145bbaeb02674bd68501f1a41787bd4aa2a75f53
Fixes: QTCREATORBUG-20703
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
... whose type is a template.
Fixes: QTCREATORBUG-25560
Change-Id: I1d626f9376e8802a87ca1a28099932ccbf744d47
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... for function parameters. These are located in the scope of the
surrounding class or namespace.
This uncovered a bug in the "Insert Virtual Functions of Base Classes"
quickfix, which we also fix here.
Fixes: QTCREATORBUG-8030
Change-Id: I7f11659dc8e252e3819df8178734e8958fa1b496
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Until Qt Creator 4.14, the QuickFix for setter/getter creation for
simple members added the implementation in the .cpp file.
The new QuickFix settings in Qt Creator 4.15 in theory keep the default
like before, but the threshold of 2 lines is usually not reached, which
causes the getter/setter implementations to now land in the header file.
This change sets the default threshold to 1 to restore the previous
default behavior.
Fixes: QTCREATORBUG-25331
Change-Id: I570deaa8b81686dc31254e8261b59ddcf8731f91
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
... when creating the constructor implementation for a derived class.
We would erroneously strip off the class name.
Amends aae3ce15aa.
Change-Id: I62c800d490626e8cb9416829633f9ef7b0c666cd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... when inserting a member function declaration for a definition.
Fixes: QTCREATORBUG-5591
Change-Id: Ie85b435a1595832d0085abdcc0a4187d939820e0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Do not require the cursor to be on the "switch" keyword, but allow it to
be anywhere within the switch construct.
Fixes: QTCREATORBUG-5379
Change-Id: Ic25504237b3ef12958f339d7176dfeeac6bd3466
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... when using declarations are involved.
Second attempt.
I have a suspicion that this is not the "correct" approach, however:
a) It appears to fix the problem.
b) It does not break any tests.
c) It's rather high in the call tree, so there's a low likelihood
of breaking something else.
d) Considering the hacky-looking pre-existing code dealing with
using declarations (e.g. LookupContext::lookupByUsing()),
it seems quite possible that there is no "correct" way with
the current infrastructure.
Fixes: QTCREATORBUG-14524
Change-Id: I28c6e53137c21ce158bbd03b92b3db39146116d5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This effetively reverts 87ec0f349f, which had unwanted side effects.
Change-Id: I03438c18f43b07a6560416af746132bc4471fbb7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... when using declarations are involved.
Fixes: QTCREATORBUG-14524
Change-Id: I0c391b88628f40973b6f601e60c64263f62a88a0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... for the edge case of the insertion location being preceded by a
function whose body is a try-catch clause.
Fixes: QTCREATORBUG-14661
Change-Id: Icc7d5283ead81d644231479317214a8cc177493d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Previously only using directives in the global scope that followed the
quickfixed using directive were removed
Change-Id: I330acfe3236a6845fd1667f9fa699ab6c8fb560d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
- Make sure the template parameters are included in the definition.
- Find the correct insertion location when using an already-defined
template member function as an anchor.
Fixes: QTCREATORBUG-24848
Change-Id: I1272ba36403904e7aed81bcef48745793c5e2217
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
There are a lot more problems in this area (e.g. with nested classes),
but let's tackle them one by one.
Fixes: QTCREATORBUG-24801
Change-Id: I4b3805ea6f8b28373925693650150bbd89508096
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
That is, allow the cursor to on some "neutral" place in the body of the
declaration, not only strictly on the class name.
Fixes: QTCREATORBUG-15699
Change-Id: I74ad6048c16c19d418446c990178535d878fc630
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
The check whether there are unimplemented member functions takes quite
long, so Creator would freeze for several seconds when right-clicking on
the name of even a medium-sized class.
Therefore, we offer the operation for all classes with member functions
and move the expensive check into the perform() method.
Change-Id: Ie19958ba8c53493be859f9982d7d5697e6e9d88b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Introduces a QuickFix settings page where the generation of getters and
setters can be customized. The settings can be saved into a file that can
go into a VCS. All QuickFixes that generate getter/setter/signals/
Q_PROPERTIES now use the same backend. QuickFixes that generate getters/
setters are now extended to also generate signals and Q_PROPERTIES.
Fixes: QTCREATORBUG-1532
Fixes: QTCREATORBUG-17941
Fixes: QTCREATORBUG-12678
Fixes: QTCREATORBUG-15779
Fixes: QTCREATORBUG-11620
Fixes: QTCREATORBUG-22707
Fixes: QTCREATORBUG-20157
Fixes: QTCREATORBUG-21804
Fixes: QTCREATORBUG-19814
Fixes: QTCREATORBUG-14622
Fixes: QTCREATORBUG-19803
Change-Id: I50ed2dad9b4a637fbd87b3e1f2856060ad0ad920
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Previously, typedefs were ignored and the new code became invalid after
applying the quickfix.
Change-Id: I0d4295e90d02dfacc3edac5ac3f96d9edbeaf662
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
If you mention "Q_OBJECT" in a raw string literal, the cmake build
fails...
Change-Id: I9004184b48dea9a77b9303c3fd871cef747ade4c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
That is, if a class member being initialized is not yet declared, offer
to add the declaration.
Fixes: QTCREATORBUG-11842
Change-Id: I1d2a56ab99543e996e220aa26b7923023dd163f7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... from a block of code.
We must not insert an empty line into the newly created function,
because it gets indented in the first indent operation, resulting in
trailing characters after the actual code has been inserted later.
Fixes: QTCREATORBUG-12118
Change-Id: If438d4de379cae90baa846c112866f2777b44fce
Reviewed-by: Christian Stenger <christian.stenger@qt.io>