It's just confusing to the user otherwise.
Fixes: QTCREATORBUG-27114
Change-Id: I127d97ca165af0eb751cd6479d0ec0ffec480c17
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... when trying to find out whether an include statement needs to be
inserted for a given symbol.
The previous code used to ignore e.g. function declarations, so an
unneeded refactoring operation would be triggered.
Fixes: QTCREATORBUG-26591
Change-Id: I5ce0bb064b6ba76e5977de73ea2697342cf74d7e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... in the "Create implementations for all member functions" quickfix.
Fixes: QTCREATORBUG-26468
Change-Id: I0965290c38cc66cffaf5dd3871eb96b6ff24b4d2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
There can be an unexpected null pointer if the built-in code model fails
to parse the code properly.
Fixes: QTCREATORBUG-26316
Change-Id: I5751be505b1182df17f58e1a174d645cef1e95cf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
We must treat return and parameters types of the function differently
from the function itself with regards to template parameters. This was
already done for parameters, but not for the return type.
Fixes: QTCREATORBUG-26248
Change-Id: I44cf6f0bda7b5e3c38f9f73e13f51f2c12ab7dc4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
These classes are strongly related, so no need to spread them around.
Change-Id: I4258b0c4198b3c650454ac734d7e52e09f46a4eb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This redirection did nothing except to horribly obfuscate the code.
Note that most callers already accessed the model manager directly, and
some bridge functions were not called at all.
Change-Id: Ic1c728afe79bf98544da23a1955ee82d0dbde94f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
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>
All members were already const, but this makes it clear at all points of
use that these data structures are immutable.
Change-Id: Iea615c090bde462c445d15223caccc561b0c713d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
In particular, the same namespace can be declared in lots of different
places.
Fixes: QTCREATORBUG-25776
Change-Id: I7e255cee560043ed4beb47b8047f99c3a9c21198
Reviewed-by: Christian Stenger <christian.stenger@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>
If the user has enabled clangd (default is off), we start up one instance
per project when it is opened/changed (including build config switches),
and trigger background indexing.
So far, the index is used to provide results for locators and "Find
Usages".
Per-document functionality such as semantic highlighting and completion
is still provided by libclang.
Change-Id: I12532fca1b9c6278baab560e7238cba6189cde9f
Reviewed-by: David Schulz <david.schulz@qt.io>
Some wrong tr calls / missing tr functions.
Some places where we need to bring lupdate to the right track with
regard to namespace resolution.
Change-Id: Idf552054a34e24d9671db68c816bf37f4d403dbc
Reviewed-by: hjk <hjk@qt.io>
We have quick fix factories that do not require an ast path at the
cursor position nowadays, for example the quick fix factories that
provide fixes from the clang tools. Move the check to those factories
that rely on a valid ast.
Change-Id: Iab4b30d5935fbd32f101fb5fda60e994f14dc94c
Reviewed-by: Christian Kandeler <christian.kandeler@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>
... 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>
... in the ExtractLiteralAsParameter quickfix. It's unlikely that the
user wants to keep the generic default name.
Fixes: QTCREATORBUG-25104
Change-Id: Ic354f20c27da43664bcb3c2839e981c176aaf821
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Use the start of the variable name, not the end. It's more natural, and
it prevents problems with the clang code model, as isCursorOnIdentifier()
returns false if the cursor is after the last character of the name.
Change-Id: I368ccf5cef9c3fb04c0902e49f8a189c102c481f
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>