summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/builtineditordocumentprocessor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-356/+0
| | | | | | | | | | | | | | | | 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>
* CppTools: Do not wait for QFuture in ~BuiltinEditorDocumentProcessor()Christian Kandeler2021-01-141-1/+0
| | | | | | | | | | This seems safe, as the arguments to the async function that the future results from are values and shared pointers, so there does not appear to be a need for this object to stay around while it finishes. Fixes: QTCREATORBUG-25121 Change-Id: Ib498551856942bf7c3d05c3013e12ad6d90fd762 Reviewed-by: David Schulz <david.schulz@qt.io>
* Don't access static functions/fields via instanceAlessandro Portale2020-11-271-1/+1
| | | | | | | | | | | | Courtesy of readability-static-accessed-through-instance Amends: b2a766a79ac778febff87f0def34cf6d3f4f93e3 Round #2: This time done with Qt Creator's Analyzer, which found other occurences than run-clang-tidy.py Change-Id: I479e280c7abcf2d24baccbb0af69ae4bda05198e Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* CppTool: Avoid a use of QStringRefhjk2020-06-161-1/+1
| | | | | Change-Id: I2a82bad7d91e059915526f0cf7b89f0d8367463a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppTools: Use unshared object for CppCodeModelSettingshjk2020-02-041-1/+1
| | | | | | | | | There's nothing shared here, only ever one copy. Ideally, this should be const outside CppToolsPlugin, but some settings are modified directly. Change-Id: I775b9151a244b3cc44d28bc992a041c42d234a18 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Use isEmpty() instead of count() or size()Alessandro Portale2020-01-201-1/+1
| | | | | Change-Id: I0a89d2808c6d041da0dc41ea5aea58e6e8759bb4 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Standardize on int for line and column valueshjk2019-07-261-1/+1
| | | | | | | | | | | | | | | Recently tons of warnings show up for presumably "problematic" singned <-> unsigned and size conversions. The Qt side uses 'int', and that's the biggest 'integration surface' for us, so instead of establishing some internal boundary between signed and unsigned areas, push that boundary out of creator core code, and use 'int' everywhere. Because it reduces friction further, also do it in libcplusplus. Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: modernizeAlessandro Portale2019-01-211-6/+6
| | | | | | Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* C++: Use file size limit also for included filesNikolai Kosjar2018-11-291-1/+2
| | | | | | | | | We can't stop the clangbackend from processing huge files, but at least our built-in parser. Fixes: QTCREATORBUG-21590 Change-Id: I506024495ba0632692f2845c6c204360f4c61b33 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Utils: Fix column number for Highlighting resultIvan Donchevskii2018-11-261-1/+1
| | | | | | | | | Follow up for 8469e317c9. This column number compensation is not required anymore. Fixes: QTCREATORBUG-21384 Change-Id: I94da48533520471170200c592129781e5b4b614c Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Utils: Adjust column numbers affected by convertPosition changeIvan Donchevskii2018-11-091-1/+0
| | | | | | | | | | | | | | convertPosition change was introduced in 931ec39f64a. It changed 0-based column to 1-based which is how it naturally is in Qt Creator. This fixed some usages but broke many more. This is an attempt to fix the remaining use cases. Fixes CppEditor auto-tests. Change-Id: Ia8d14da0ebb035cd2fdd6da4ff6ec89c1c5121a8 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Remove hard-coded disabling of debug logsOrgad Shaneh2018-10-131-1/+1
| | | | | | | | | | | Instead, set the default level of all logs to QtWarningMsg. The call to setFilterRules overrides the user preferences in qtlogging.ini. Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Clang: use local renaming based on ClangCodeModelIvan Donchevskii2017-11-201-0/+18
| | | | | | | | Provide refactoring engine for ClangCodeModel and implement missing methods. Change-Id: If5c913e0c5a7941cd2ced54d0fcfa4d625eadc93 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* TextEditor: move convenience from texteditor to utilsIvan Donchevskii2017-09-221-2/+2
| | | | | | | Allows to use this header without texteditor dependency. Change-Id: I706f42799c3ea42473a716fa9ef9f3cfbef6fdd4 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Fix built-in's ExtractFunction actionNikolai Kosjar2017-08-221-1/+1
| | | | | | | | | | | | | | | | | | Since Clang: Provide highlighting for identifier under cursor commit ca72c29462d9caae5e6095f8361f843758c5972c the LocalUseMap, used for some refactoring actions, was not updated anymore. Fall back to the built-in implementation for the LocalUseMap because it contains pointers to built-in AST that clang obviously can't provide. Task-number: QTCREATORBUG-18607 Change-Id: I08762fe457835d4d83aca719febcb3497ee9696b Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* CppEditor: Generalize CppUseSelectionsUpdaterNikolai Kosjar2017-06-141-0/+7
| | | | | | | | | Let CppUseSelectionsUpdater delegate the work to *EditorDocumentProcessor so that the clang code model can also provide results. Change-Id: I6872afbfeea1a5c4a64fdf19fcb1992f134dde08 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* CppTools: Provide hints about chosen project part for editor documentNikolai Kosjar2017-01-241-0/+2
| | | | | | | | | | | | Parse issues can have multiple reasons (invalid kit, not a project file, actual parse issue) and we should be able to tell them apart. With this change, we can distinguish between the fallback project part and a ambiguous project part. Follow up changes will use this to display more accurate diagnostics. Change-Id: Icc8767607cc17dc14d6227b07f34e81ba5525a96 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Remove some duplicationNikolai Kosjar2016-12-161-9/+4
| | | | | Change-Id: I8c84660b28c3e76b2cedd08ff3b44a38583f38a0 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Prioritize project parts from active projectNikolai Kosjar2016-12-161-1/+6
| | | | | | | ...when selecting one for the editor document. Change-Id: I85066aaa0862870cb2db2fb2cb40c2b2c23b2cac Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Show info bar for parse errors in header filesNikolai Kosjar2016-10-111-1/+4
| | | | | | | | | | | | | | | ...because those errors can lead to a substantial performance/functional regression. The actual diagnostics (possibly with children) are shown as details in the info bar. The info bar can be hidden with the "Do Not Show Again" button. Re-enabling the info bar is possible with the new editor tool bar button. Change-Id: I03394ff8e3c84127946b0b791930b28a385f5a46 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Use a shared thread poolOrgad Shaneh2016-02-191-2/+4
| | | | | | | | Without this, too many threads are spawned, and loading a project takes forever. Change-Id: I3c22557ddd7bfb0c70f7b089c276432e3b003097 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* Clang: Indicate available "fix its" with a light bulbNikolai Kosjar2016-02-161-1/+2
| | | | | | | | | | | | ...at the end of the line, just like for the "Apply Function Signature Changes" refactor action. * Hovering the light bulb shows the tooltip "Inspect available fixits". * Clicking the light bulb leads to the refactoring menu, as if the user hit Alt+Return. Change-Id: Iaf7b3734c43e21fc28e6b0658f517d98858c0e0c Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
* CppTools/Editor: Use Utils::runAsyncEike Ziller2016-02-151-3/+3
| | | | | Change-Id: Ifcc2a34e3478eb84f95221b79e39f7a670e6b2e0 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Update License according to agreement with Free Qt FoundationTobias Hunger2016-01-191-17/+12
| | | | | | | * Update files in src/plugins Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* CppTools: Break TextDocument dependency of BaseEditorDocumentProcessorMarco Bubke2016-01-121-2/+2
| | | | | | | | BaseEditorDocumentProcessor was holding a TextEditor::TextDocument but only used the QTextDocument and the file path. Change-Id: I349cc95d973adeaf9f94638d84333f592c14e7f9 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* CppTools/Clang: Remove InMemoryInfoNikolai Kosjar2015-12-161-1/+1
| | | | | | | ...nowadays we only need the working copy. Change-Id: I30924b3c5dc68b428d6c10f6ba015b0640b476d2 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* CppTools: Move function to BuiltinEditorDocumentProcessorNikolai Kosjar2015-12-161-0/+43
| | | | | | | It's only needed there. Change-Id: Id12aa9d0fdf50b3292316426587677f79a09a9e9 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* CppTools/Clang: Clean-up of includesNikolai Kosjar2015-12-161-1/+0
| | | | | Change-Id: I0ba340dcf0ee23e61588f17262d07e7088751836 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* CppTools: Apply font settings for diagnostics immediatelyNikolai Kosjar2015-12-091-0/+5
| | | | | | | ...and not on document reload. Change-Id: Idb6a9ba640a573c153aeab304dd280b6f6cf8ea0 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* C++: Fix crash after triggering completion and closing editorNikolai Kosjar2015-09-021-7/+7
| | | | | | | | | | | | | | | | | | | | | Fix use-after-free for the following case: 1. Open an editor 2. Trigger a long processing completion (e.g. simulate with QThread::msleep in CppCompletionAssistInterface::getCppSpecifics) 3. ...and immediately close the editor (e.g. with Ctrl+W) 4. Wait until it crashes. The completion thread relied on the BuiltinEditorDocumentParser object, which is deleted once the editor is closed. Fixed by sharing the ownership of that object between the *EditorDocumentProcessor and the completion assist interface. This case came up when doing tests for the bug report below. Task-number: QTCREATORBUG-14991 Change-Id: I0b009229e68fc6b7838740858cdc41a32403fe6f Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* Clang: Do not call DocumentManager::modifiedDocuments() from worker threadNikolai Kosjar2015-07-101-2/+4
| | | | | | | This is unsafe. Change-Id: I8ac075a7289afa0d84785e37b1325d186a153000 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* CppTools: Avoid unnecessary blocking of main threadNikolai Kosjar2015-07-101-1/+4
| | | | | | | | | | | | | | | | Among others, BaseEditorDocumentParser::projectPart() was a blocking operation in case the parser was running. This led to noticeable GUI freezes for the ClangCodeModel since the function was called from the main thread. Rework *EditorDocumentParser to clearly separate the configuration data (input) from the actual object state. Querying/setting configuration or (last) state does not block anymore. update() is supposed to get the necessary configuration and the last state at the beginning and to set the new state at end. Change-Id: Ib4b534fa6ff373c3059826726b3f10ece95acc21 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* CppEditor: Fix semantic highlighting when zoomingNikolai Kosjar2015-06-231-0/+8
| | | | | | | | | | | | ...for the not visible documents. First reset the extra additional formats, then set the new ones, not the other way around. Task-number: QTCREATORBUG-14579 Change-Id: Iae465bd9a7bb0a397fd4917df45955713aaf87c5 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* C++: Rename semanticRehighlight to recalculateSemanticInfoDetachedNikolai Kosjar2015-06-221-1/+1
| | | | | | | | semanticRehighlight() does a bit more than only rehighlighting and we want to trigger (only) rehighlighting in a follow-up change. Change-Id: Ic8da9ec8643f0f82f7c99ef9a8180b2868194254 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CppTools: Use correct language features in createHighlighterOrgad Shaneh2015-02-261-7/+4
| | | | | Change-Id: Ia8971dbc9be18575a1b22d46dac5bb8c18c63c7a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Merge commit '3c85058694ee2e41658d17f524fb48f0b187d2fe'Eike Ziller2015-02-121-6/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/libs/utils/tooltip/tipcontents.cpp src/libs/utils/tooltip/tipcontents.h src/plugins/android/androiddeployqtstep.cpp src/plugins/baremetal/baremetalconstants.h src/plugins/baremetal/baremetaldevice.cpp src/plugins/baremetal/baremetaldevice.h src/plugins/baremetal/baremetaldeviceconfigurationwidget.cpp src/plugins/baremetal/baremetaldeviceconfigurationwidget.h src/plugins/baremetal/baremetaldeviceconfigurationwizard.cpp src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.cpp src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.h src/plugins/baremetal/baremetalplugin.cpp src/plugins/baremetal/baremetalplugin.h src/plugins/baremetal/baremetalruncontrolfactory.cpp src/plugins/baremetal/baremetalruncontrolfactory.h src/plugins/cppeditor/cppcodemodelinspectordialog.cpp src/plugins/cppeditor/cppdoxygen_test.cpp src/plugins/cppeditor/cppdoxygen_test.h src/plugins/debugger/breakpointmarker.cpp src/plugins/debugger/debuggeritemmodel.cpp src/plugins/debugger/debuggeritemmodel.h src/plugins/debugger/loadcoredialog.cpp src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp src/plugins/projectexplorer/addnewmodel.cpp src/plugins/projectexplorer/addnewmodel.h src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp src/plugins/qmlprofiler/abstracttimelinemodel.cpp src/plugins/qmlprofiler/abstracttimelinemodel.h src/plugins/qmlprofiler/notesmodel.cpp src/plugins/qmlprofiler/qml/CategoryLabel.qml src/plugins/qmlprofiler/qml/MainView.qml src/plugins/qmlprofiler/qml/Overview.js src/plugins/qmlprofiler/qml/Overview.qml src/plugins/qmlprofiler/qml/TimeDisplay.qml src/plugins/qmlprofiler/qml/TimeMarks.qml src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp src/plugins/qmlprofiler/sortedtimelinemodel.cpp src/plugins/qmlprofiler/sortedtimelinemodel.h src/plugins/qmlprofiler/timelinemodelaggregator.cpp src/plugins/qmlprofiler/timelinemodelaggregator.h src/plugins/qmlprofiler/timelinerenderer.cpp src/plugins/qmlprofiler/timelinerenderer.h src/plugins/qmlprojectmanager/QmlProjectManager.json.in src/plugins/texteditor/findinfiles.cpp src/plugins/vcsbase/vcsconfigurationpage.cpp src/shared/qbs src/shared/scriptwrapper/interface_wrap_helpers.h src/shared/scriptwrapper/wrap_helpers.h tests/auto/qmlprofiler/abstracttimelinemodel/tst_abstracttimelinemodel.cpp tests/system/suite_debugger/tst_debug_empty_main/test.py tests/system/suite_debugger/tst_qml_js_console/test.py tests/system/suite_debugger/tst_qml_locals/test.py Change-Id: I67540b648f8b162496f4aa606b04d50c7c9125c6
| * Update LicenseEike Ziller2015-01-161-6/+6
| | | | | | | | | | Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* | Core: Use FileName for file path in IDocumentOrgad Shaneh2015-01-121-1/+1
|/ | | | | Change-Id: I85f7398aee59d0d36f0e5c3bf88ff3c96002e394 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* CppTools: Fix include hierarchy for clang code modelNikolai Kosjar2014-11-281-0/+5
| | | | | | | | | | This makes the editor document snapshot accessible through BaseEditorDocumentProcessor since we need it for the include hierarchy if the the clang code model is activated. Task-number: QTCREATORBUG-13553 Change-Id: I7214cc578d05fe5cad6e12b4d29fe6f840a88e8d Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* CPlusPlus: Use QVector<Token> instead of QListhjk2014-11-061-1/+1
| | | | | | | Better suited to avoid the indirection (sizeof(Token) > sizeof(void *)) Change-Id: Ia5f42781e720ef6aa8161f8f81ae8ddd8e58c837 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* CppTools: Make use of QLoggingCategoryNikolai Kosjar2014-11-031-11/+8
| | | | | | | ...for document processing and highlighting. Change-Id: I31d42a5a5010260643ec76688080fd14a486f7e3 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* CppTools: restore C++ diagnostics messages.Francois Ferrand2014-10-231-14/+39
| | | | | | | The messages were computed, but not added to the document. Change-Id: Ibeea802cf9f291ad14b2fe2e9d2a285c927a4449 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* License update.Eike Ziller2014-10-151-7/+8
| | | | | Change-Id: I0acde2c3b995693de682679471f03af85bdd0a61 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* TextEditor: More BaseText* -> Text* renamingshjk2014-09-261-1/+1
| | | | | | | *Document* and *Layout* classes, all basetext* files Change-Id: I1c6e376733a434fcb5c7f19c6210dfa031eeafde Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* Rename {Core,TextEditor},{Base,}TextDocument classeshjk2014-09-251-1/+1
| | | | | | | | | First step of some more 'Base' removal in TextEditor. s/Core::TextDocument/Core::BaseTextDocument/ s/TextEditor::BaseTextDocument/TextEditor::TextDocument/ Change-Id: I71ba325a2f0ad72ec9dae0d96846cbae72d326f7 Reviewed-by: hjk <hjk121@nokiamail.com>
* CppTools: Change CppModelManager implementation patternhjk2014-09-191-7/+2
| | | | | | | | | Replace the CppModelManagerInterface/derived CppModelManager combo by a more common CppModelManager/CppModelManagerPrivate pimpl pattern. Change-Id: Ia4582845ed94d5ef60b8571bab9b2260c6290287 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* CppTools/Clang: Remove QScopedPointers in *EditorDocumentParsersNikolai Kosjar2014-08-291-11/+4
| | | | | | | ...since they are pointless. Change-Id: I1c7925d3b1ad33ac0f1dc372797e3ab9a4bdc4b3 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Provide the editor snapshot for SemanticInfoUpdaterNikolai Kosjar2014-08-291-4/+7
| | | | | | | | | ...so that SemanticInfoUpdater does not depend anymore on the EditorDocumentParser. Accessing the snapshot was a blocking operation that delayed the semantic info update longer than actually needed. Change-Id: I348d22ef83ab310d4319b2e8b9678fe90ee24d6a Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Mini refactoring in BuiltinEditorDocumentProcessorNikolai Kosjar2014-08-291-5/+5
| | | | | Change-Id: I9239430f809bb9270fd9f1a99aad1136f10124d7 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: Base parsing on editor document instead of widgetNikolai Kosjar2014-08-251-0/+253
This mainly takes CppEditorSupport apart. * Parsing is now invoked by CPPEditorDocument itself by listening to QTextDocument::contentsChanged(). * Upon construction and destruction CPPEditorDocument creates and deletes an EditorDocumentHandle for (un)registration in the model manager. This handle provides everything to generate the working copy and to access the editor document processor. * A CPPEditorDocument owns a BaseEditorDocumentProcessor instance that controls parsing, semantic info recalculation and the semantic highlighting for the document. This is more or less what is left from CppEditorSupport and can be considered as the backend of a CPPEditorDocument. CPPEditorDocument itself is quite small. * BuiltinEditorDocumentProcessor and ClangEditorDocumentProcessor derive from BaseEditorDocumentProcessor and implement the gaps. * Since the semantic info calculation was bound to the widget, it also calculated the local uses, which depend on the cursor position. This calculation got moved into the extracted class UseSeletionsUpdater in the cppeditor plugin, which is run once the cursor position changes or the semantic info document is updated. * Some more logic got extracted: - SemanticInfoUpdater (logic was in CppEditorSupport) - SemanticHighlighter (logic was in CppEditorSupport) * The *Parser and *Processor classes can be easily accessed by the static function get(). * CppHighlightingSupport is gone since it turned out to be useless. * The editor dependency in CompletionAssistProviders is gone since we actually only need the file path now. Change-Id: I49d3a7bd138c5ed9620123e34480772535156508 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>