aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cppeditordocument.cpp
Commit message (Collapse)AuthorAgeFilesLines
* TextEditor: handle syntax highlight in batchesDavid Schulz2024-03-251-3/+2
| | | | | | | | | | | | | | | | | Use an elapsed timer in the syntax highlighter to periodically return from the highlight and push a continue highlight to the end of the event loop. This allows the user to interact with the editor in between those batches. If the user modifies the document in between highlighting batches, the area that still needs a rehighlight is increased if needed. This also reverts 62ea85ee6ad15c8e4d9cb5e35b1f10bee3c49ac7 and the related changes. Task-number: QTCREATORBUG-28727 Change-Id: I7c394dbdff658330bb72f3b68b9928980947db75 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Make check for clangd more fine-grainedChristian Kandeler2024-02-211-1/+1
| | | | | | | | | | | ... in the quickfix factories. We want to be able to offer or not offer certain quickfixes based on the current clangd version. Change-Id: I7dca69ff990ab9f1a691785cd72e633f7882ae3d Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* TextEditor: Merge Base- and ThreadedSyntaxHighlighterRunnerDavid Schulz2024-01-311-2/+2
| | | | | Change-Id: I38ad01a895eabba99b2e554f3ae9bef85f32bb3b Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
* CppEditor: Move CppHeaderSource implementation and test to same fileshjk2024-01-261-2/+0
| | | | | | | ... and remove the now-empty cppeditorplugin.h Change-Id: Ia28b180c280ba7b10ce0f2826f2ac69d128a453c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* SyntaxHighlighter: Move SyntaxHighlighter to separate threadArtem Sokolovskii2023-12-111-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change involves the relocation of SyntaxHighlighter processing to another thread. The core idea is to create a duplicate of the original TextDocument using SyntaxHighlighterRunnerPrivate::cloneDocument. A new SyntaxHighlighter is then instantiated by SyntaxHighLighterCreator for the cloned document. The entire SyntaxHighLighterCreator class is moved to a new thread, where it performs highlighting on the cloned document. Upon completion of the highlighting process, the resultsReady signal is emitted, and the updated highlighting data is applied to the original document. This shift of SyntaxHighlighter to another thread enhances the user experience by preventing UI slowdowns during the highlighting process. - Introduction of BaseSyntaxHighlighterRunner as an interface class for future *SyntaxHighlighterRunner. - Inclusion of DirectSyntaxHighlighterRunner class for performing highlighting in the main thread, suitable for syntax highlighters that cannot be moved to another thread. - Introduction of ThreadedSyntaxHighlighterRunner class for highlighting in a separate thread, preventing UI blocking during the process. - Addition of Result data to the SyntaxHighlighter class to facilitate data exchange between threads. Task-number: QTCREATORBUG-28727 Change-Id: I4b6a38d15f5ec9b8828055d38d2a0c6f21a657b4 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
* CppEditor: More direct access to CppQuickFixAssistProviderhjk2023-12-061-1/+1
| | | | | | Change-Id: I764b68ee2f328cff28b4c6482d28015b36f15bca Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* SyntaxHighlighter: Move highlighter creating to TextDocumentArtem Sokolovskii2023-11-201-1/+1
| | | | | | | | | Added setSyntaxHighlighterCreator function to TextDocument which allows the creation of highlighters inside TextDocument. Change-Id: I454f800c878c48a154dad5abd68b7a4f9ceb378a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Utils/all: Move mime constants into a central placehjk2023-11-081-2/+3
| | | | | | | | 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>
* Plugins: A bit more Keys and Storehjk2023-08-251-3/+3
| | | | | Change-Id: Iee55eeaa881dd9f2047fdbe95ad8d827f4ba34e0 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* CppEditor: Add context object into connectionsJarek Kobus2023-08-031-7/+6
| | | | | | Change-Id: I1a74f62b0a42ea4971b14fb82213f662b5fe4736 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CppEditor: Proliferate use of FilePath a bithjk2023-07-251-2/+2
| | | | | Change-Id: I7e314d73a427bf40c10f3ca6c4c5804e31482f88 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppEditor: Make a few CppModelManager functions statichjk2023-07-121-12/+7
| | | | | | | ... to simplify code using it. Change-Id: Ib2bfbb5a17a1d48088a9cf4973d4c3f006cd34e4 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppEditor: Format quickfix code only if formatting is enabledChristian Kandeler2023-07-031-1/+1
| | | | | | | | | | | | | | | ... in the ClangFormat settings (rather than the default of just indenting). As opposed to files generated by the wizard, quickfixes are often touching existing code, and since ClangFormat works on line granularity, users will experience unexpected re-formattings when ClangFormat is in indent- only mode. Therefore, do the formatting only if the user has enabled it in the ClangFormat settings. Change-Id: Icb30f166f2b6fb94113a8f25c4a5f92ff8bca9b0 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Core: add aboutToSave and saved signal to IDocumentDavid Schulz2023-06-151-3/+3
| | | | | | | | We need reliable signals that gets emitted when documents are saved to inform the language server about the document state change. Change-Id: I0a1e8a5317ae6984ff17d878952c74f69765e3f9 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppEditor: Reuse QScopeGuard instead of ExecuteOnDestructionJarek Kobus2023-06-071-33/+31
| | | | | | Change-Id: Ia60c8eab687599dbaa519daeab74e8799c33af95 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
* Move SessionManager to Core pluginEike Ziller2023-05-251-5/+4
| | | | | | | | | | | 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>
* Remove unneeded includes of utils/runextensions.hJarek Kobus2023-01-271-1/+0
| | | | | | | BTW, spotted some other unused includes marked with yellow. Change-Id: I364e4b6fae73a2be2cfd3a63c1100be4a91aa49a Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Editor: Allow to hide annotations for a group of text marksDavid Schulz2023-01-121-3/+6
| | | | | | | | | The hiding is not persistent, so on the next Qt Creator start all annotations are visible again. This is meant to quickly get rid of annotations if there are to many irrelevant of a specific kind. Change-Id: I4862e56e0f5624f30aadda26efc9dea672ab1f57 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Convert to Tr::trAlessandro Portale2023-01-121-4/+5
| | | | | | Change-Id: Ic4025e06e17c45eb6dc2162fb7f21f5b8aebe84d Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Remove GPL-3.0+ from license identifiersKai Köhne2023-01-061-1/+1
| | | | | | | | | | | | | | | 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>
* CppEditor: Convert AbstractEditorSupport interface to FilePathhjk2022-11-281-1/+1
| | | | | | | 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>
* CPlusPlus: Proliferate FilePath usehjk2022-11-221-1/+1
| | | | | | | | | | | | | | | | | | | 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>
* Use SPDX license identifiersLucie Gérard2022-08-261-24/+2
| | | | | | | | | 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>
* CppEditor: rename overview -> outlineDavid Schulz2022-08-261-1/+1
| | | | | | | | | | There is now a clean border border between outline and overview. Everything defined in CppEditor uses outline and everything in cplusplus uses overview. Change-Id: Ic6637dc53fca3401417180b1873303012a813113 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* CppEditor: move outline model to documentDavid Schulz2022-08-181-0/+20
| | | | | | | | | This way we only have one model per document instead of one per editor. Additionally we further separate the outline views (combobox and side pane) from the actual model. Change-Id: I9705716b5c9f8f19f75708ec73d7c3b3c5de586f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge remote-tracking branch 'origin/7.0' into 8.0Tim Jenssen2022-07-011-1/+1
|\ | | | | | | Change-Id: I7cd5d3808007ef739212f4347ba9b16e7b298943
| * Clang Format: Fix misplaced cursor after undoArtem Sokolovskii2022-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed behavior, when after undo function cursor, jumps to the start of a file. Join the undo block generated by auto format with the last available undo block. This will place the cursor at the last edit position instead of the document beginning when triggering undo. Fixes: QTCREATORBUG-27608 Change-Id: I1bb630af00e997ac53f178594445293ceebcfa26 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
* | cppeditor: Show hints for qmlRegister... diagnosticsMarcus Tillmanns2022-06-211-0/+51
| | | | | | | | | | | | | | | | | | | | This fixes passing the hints from FindExportedCppTypes to the actual cppeditor so they can be displayed to the user. Fixes: QTCREATORBUG-27243 Change-Id: Ibcb68296f044a9c6a96f40945d8a0e964be7f042 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CppEditor: Remove one use of mimetype via QFileInfohjk2022-06-141-22/+15
| | | | | | | | | | | | | | Plus some cosmetical changes I could not resist. Change-Id: Id2634d3876437a5dfe7ddb4aaa53db396f37e02a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CppEditor: remove unused function hint providerDavid Schulz2022-06-131-13/+0
| | | | | | | | | | | | | | | | Since we removed the libclang based backend both implementations of ModelManagerSupport::functionHintAssistProvider returned a nullptr. Change-Id: I113c5a08cf604eb1bb2a64a851f022ecd5c908d6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Move MinimizableInfoBars from CppEditorDocument to IDocumentEike Ziller2022-05-101-18/+13
| | | | | | | | | | | | | | | | | | | | | | | | Similar to the InfoBar. The only thing that an editor implementation needs to do is to set a settings group and the possible info bars in the document constructor. And later call document->minimizableInfoBars()->setInfoVisible(id, visible) to manage the state. Change-Id: I23afb3639b70b1bfccd424579da018280a7fe2cb Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | MinimizableInfoBars: Move to UtilsEike Ziller2022-05-091-1/+1
| | | | | | | | | | Change-Id: I6b42948c4bddaa396122b845c5c1e2aa70d8aaad Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | MinimizableInfoBars: Remove last hardcoded thingsEike Ziller2022-05-091-1/+7
| | | | | | | | | | | | Change-Id: I6ec1e290056d97136077c0ddbc161669c7225eba Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | MinimizableInfoBars: Remove dependency on CppToolsSettingsEike Ziller2022-05-091-0/+2
| | | | | | | | | | | | | | | | They were only used in the info bars, so move them there. Change-Id: I584c98c70d1db2a5b741842da9d629469f0de73c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Remove leftover code for header diagnostic info barEike Ziller2022-05-041-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | ClangCodeModel used to show an info bar about errors in headers in the editor, but that was removed. Remove the remaining infrastructure that was used to show them. Amends b52fac7148fcd333ce410b99017b7aec52e2fee6 Change-Id: Id89f2bcb7778245f468923d29c577bf1ca68ee75 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>
* | ClangCodeModel: Stop communicating with clangbackendChristian Kandeler2022-05-021-2/+0
| | | | | | | | | | | | | | Change-Id: I9a5f4e7f0f94d33de9816cb643e6ec88cbf9ca15 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
* | Mimetypes: Make implementation switchable between new and oldEike Ziller2022-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in utils/mimetypes2/ - added utils/mimeutils.h header for the Qt Creator specific static wrappers, that also includes the "public" headers for MimeType et al from the new or old implementation, depending on configuration - change all utils/mimetypes/ includes to utils/mimeutils.h - move the implementation for the wrappers to utils/mimetypes(2)/mimeutils.cpp - also move the MimeDatabase declaration in the "old" implementation back to utils/mimetypes/mimedatabase.h Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* | ClangCodeModel: Make clangd refactoring actions availableChristian Kandeler2022-02-011-0/+2
|/ | | | | | | | | | | | | | Introduce an assist processor that merges our built-in quickfixes with refactoring actions from clangd ("tweaks"). For now, we make it clear which ones are coming from clangd, and we do not filter duplicate functionality. In the future, we might want to disable redundant built-in actions if clangd is enabled for the respective file. Change-Id: I04842132798c8635dfddf8cfc98cc7a6313fac09 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-36/+31
| | | | | | | | | | | | | | | | 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>
* ClangCodeModel: Use clangd for completion and function hintChristian Kandeler2021-08-231-4/+18
| | | | | Change-Id: I80160f3a40da18ac178682afe6caba5e5af6e3eb Reviewed-by: David Schulz <david.schulz@qt.io>
* Core: filepathify IDocumentDavid Schulz2021-05-191-2/+2
| | | | | Change-Id: I364a80d070c5f90433309c281c4906ee101a1a1a Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* TextEditor: Introduce shortcut for forcing a function hint proposalChristian Kandeler2020-08-111-0/+6
| | | | | | | | | | ... and support it in the ClangCodeModel. This allows users to get function signature(s) displayed regardless of where exactly the cursor is on the function call. Fixes: QTCREATORBUG-19394 Change-Id: I033e8774db93680bfc3ee52610b817e0ef8ccc76 Reviewed-by: David Schulz <david.schulz@qt.io>
* Core/Utils: Migrate further to Utils::Idhjk2020-07-061-1/+1
| | | | | | | The coreplugin/id.h header is kept for downstream for now. Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Move InfoBar to UtilsEike Ziller2020-06-181-6/+6
| | | | | | | | | The only reason it was required to be in Core plugin, was its use of Id, which now is available in Utils. Change-Id: I66ce863c24924e6448d339b3422538a7fe167336 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Core: Make InfoBar::GlobalSuppressionMode an enum classAndre Hartmann2019-09-121-1/+1
| | | | | Change-Id: I859a727196a887f7699a667fbe07e1bfead4cb2b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Avoid warning on empty expressionshjk2019-07-231-1/+1
| | | | | | | | For some reason, Q_UNUSED includes already a semicolon, adding one on the user side creates an additional empty statement. Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* TextEditor: add convenience function to clear all extra highlightsDavid Schulz2019-06-191-8/+2
| | | | | Change-Id: Id3a3c45041a23ba100447d926ed6ab829abbc92b Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* TextEditor: add convenience function to clear additional highlightsDavid Schulz2019-06-191-2/+1
| | | | | Change-Id: Ie3cf6e7f9fb37f3e2270abaf5fca412e7a4a40da Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Utils: Rename FileName to FilePathhjk2019-05-281-2/+2
| | | | | | | | More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangFormat: Do not remove whitespace twiceIvan Donchevskii2019-04-021-0/+10
| | | | | | | | | | | | Previously the built-in engine was responsible for clearing the extra whitespace. When ClangFormat plugin is active and "Format edited code on file save" is selected it clears the unnecessary whitespace on it's own and we don't need to adjust the whitespace the second time. Fixes: QTCREATORBUG-22239 Change-Id: I309f51c51aca8ab85b5cfb7809923b59a912b4e0 Reviewed-by: Marco Bubke <marco.bubke@qt.io>