aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clangcodemodel/clangeditordocumentprocessor.h
Commit message (Collapse)AuthorAgeFilesLines
* Core/Utils: Migrate further to Utils::Idhjk2020-07-061-3/+4
| | | | | | | | The coreplugin/id.h header is kept for downstream for now. Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66 (cherry picked from commit 430a33dcd9ac80ddb848e41f8f059102857c88aa) Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Clang: Make diagnostic tooltips consistentNikolai Kosjar2019-02-051-2/+2
| | | | | | | | | | | | | Fix that triggering a diagnostic tooltip from the diagnostic location/range itself (underlined text) did not show the icon on the left and the actions/toolbuttons on the right in the tooltip. Instead of showing the tooltip content itself, request the tooltip for the corresponding text mark to get the extra decoration and actions. Change-Id: I5e94aca117a761f7a798d4f4b33db6e386e54d84 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* CppTools: modernizeAlessandro Portale2019-01-211-1/+1
| | | | | | Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Clang: Fix unresolved #includes for ui_*.h headersNikolai Kosjar2018-10-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...with an extra parse. Previously, the creation of an e.g. "Qt Widgets Application" from the wizard could show code model errors in mainwindow.cpp. Depending on timing issues, the first error is either 1. 'ui_mainwindow.h' file not found (QTCREATORBUG-15187) The parse happened before the in-memory ui_mainwindow.h was generated by uic. The file system watcher can't help here as the #include was not resolved successfully. And libclang's reparse does not handle this case (it would need to remember all failed #include stats...). ==> Detect this case with the help of the include paths and trigger a full parse. 2. or: allocation of incomplete type... (QTCREATORBUG-15187) The parse happened after the generation of the in-memory ui_mainwindow.h, but before the clangbackend received the unsaved file. ==> Fix this by also writing the content of the unsaved file to our behind-the-scenes-created ui_mainwindow.h. Fixes: QTCREATORBUG-15187 Fixes: QTCREATORBUG-17002 Change-Id: I4f3a81adaa3d604746977a402c29f83fbc5b0e44 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Remove project tracking on clangbackend sideNikolai Kosjar2018-09-261-3/+3
| | | | | | | | | | | | ...as it is not needed. Just provide the compilation arguments as part of the Document. As a side effect, re-initializing the backend after a crash is cheaper and will not freeze the UI anymore (referenced bug). Task-number: QTCREATORBUG-21097 Change-Id: I866e25ef1fd5e4d318df16612a7564469e6baa11 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Minor renamingNikolai Kosjar2018-06-081-1/+1
| | | | | | | | | | This completes commit f01fbcb789d86116fac5b9d6ef2ed42862e2c944 Clang: Clean up some IPC names Change-Id: Ic747ca4a01e5c693bd59626eef516ae4a42bf9fc Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Clean up some IPC namesNikolai Kosjar2018-06-041-5/+7
| | | | | | | | | | | | | | | | | This is long overdue since some names were simply wrong and/or misleading. Also, some of the old names were long enough to almost get crazy. The renaming starts from ClangCodeModelServerInterface and ClangCodeModelClientInterface and affects usages and related functions. For the ClangCodeModelServerInterface, categorize the messages in - messages that require a response (request*) - notification messages (the remaining ones) Change-Id: I5342ed8e0d87404ee72f3c3766fd8ef7505defb1 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Fix wrong QTC_ASSERTSNikolai Kosjar2018-04-241-1/+1
| | | | | | | | If the last editor is closed, "editor" becomes a nullptr, which is valid value in this case. Change-Id: Id5f92cb4367199d782e33acc37077103e9986644 Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Show current editor diagnostics in issues paneNikolai Kosjar2018-04-161-0/+3
| | | | | | | | | | | | | | | | | This helps to deal with many diagnostics. Error diagnostics precede warning diagnostis to have them on top. If no CppEditor is active, no diagnostics are displayed. Previously one had to scroll the document up and down to locate the diagnostics. Now they are in a list and can be easily navigated with F6/Shift-F6. Also, at least for some diagnostics "Get Help Online" from the context menu seems to provide useful results. For example, triggering the action on clang tidy issues will open the web browser with some good hits explaining the issues. Change-Id: Idabe30b0961d893bee39ccee431e92aeeda1cc26 Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Rebuild overview model tree when token data is updatedIvan Donchevskii2018-03-231-0/+3
| | | | | | | | In release builds overview model tree is built earlier then the job with token information is completed. Change-Id: I1a563551e813996001fb97924ac441e2b7d599b9 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Clang: extra clangbackend job to collect full token infoIvan Donchevskii2018-02-021-0/+2
| | | | | | | | | Limit document annotations job to only highlighting data collection and move more expensive calls into separate job that runs after it. Change-Id: Ie792a3f741ac45c81033dd5b3a20ed061604f927 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Auto reparse if diagnostic config changesNikolai Kosjar2018-01-291-0/+4
| | | | | | | | | | | On diagnostic config change, affected documents are closed behind the scenes. Visible ones are parsed immediately, invisible ones are tagged for parse once they become visible. Task-number: QTCREATORBUG-16263 Change-Id: Id4dcc69f1a4bfccc597e798d6821f8718f86e352 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Centralize gathering file argument into one classNikolai Kosjar2018-01-241-2/+2
| | | | | | | Similar to CompilerOptionsBuilder. Change-Id: Ifac0efe37608562912af20a1c22f85e5e9308094 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Use reference instead of pointer in editor processorNikolai Kosjar2018-01-241-2/+2
| | | | | | | ...because the pointer can't be null. Change-Id: I318f5d7ff2d2ac7de188718ec6281b083965dfd4 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Send less data on unregisterTranslationUnitNikolai Kosjar2018-01-191-2/+1
| | | | | | | | For unregisterTranslationUnit only the file path and the project part id is needed. Change-Id: I882d2fe07af094c07ea42413d6874539535a48ea Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Add 'override' to related destructorsNikolai Kosjar2018-01-191-1/+1
| | | | | Change-Id: I763ec2d3462f9a3d1a1afc4270c5f1015bee758f Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Provide tooltipsNikolai Kosjar2018-01-161-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This includes also the query data for the help system (F1) for an identifier under cursor. Regressions (libclang changes necessary): - Function signatures do not contain default values. - Aliases are not resolved for/at: - template types - qualified name of a type Fixes/Improvements: - Resolve "auto" - On a template type, show also the template parameter. - For a typedef like typedef long long superlong; the tooltip was "long long superlong", which was confusing. Now, "long long" is shown. New: - Show first or \brief paragraph of a documentation comment. - Show size of a class at definition. - Show size of a field member in class definition. Task-number: QTCREATORBUG-11259 Change-Id: Ie1a07930d0e882015d07dc43e35bb81a685cdeb8 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: Rename HighlightingMark to TokenInfoIvan Donchevskii2017-12-111-4/+4
| | | | | | | | | | | Before adding additional members into that class it makes sense to rename it to better represent its content. Other classes serving the same purpose are also renamed to keep the names consistent. Change-Id: I3c8517e42aae29779d71ec9c85b713cff581a473 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: use local renaming based on ClangCodeModelIvan Donchevskii2017-11-201-0/+1
| | | | | | | | Provide refactoring engine for ClangCodeModel and implement missing methods. Change-Id: If5c913e0c5a7941cd2ced54d0fcfa4d625eadc93 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Extract and rename backend classesNikolai Kosjar2017-09-281-3/+3
| | | | | | | | | IpcCommunicator -> BackendCommunicator IpcSender -> BackendSender IpcReceiver -> BackendReceiver Change-Id: I110ebe8d185db7ff47d2d5de9b786262520926d0 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Clang: use HighlightingMarks for hover with Ctrl highlightingIvan Donchevskii2017-09-221-3/+4
| | | | | | | | | | Make this highlighting work without builtin code model but based on the HighlightingMarks that we already have from ClangCodeModel. Redundant parameters are removed by this change. Change-Id: I73b5dab46ba59d2f813236831818f0a9bc94c5bc Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: implement requestFollowSymbol plug-in sideIvan Donchevskii2017-08-151-0/+3
| | | | | | | | | Invoke follow symbol in clang backend if env variable QTC_CLANG_FOLLOW_SYMBOL is 1. Does not include backend implementation. Change-Id: Ia20a677830ebdd7f24800af5c5d6e8b1bf579205 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Show inline diagnostics only for project filesNikolai Kosjar2017-07-101-0/+1
| | | | | | | | | | | | When navigating to headers that are not part of the project, avoid showing the inline diagnostics. In most cases, these files can't be changed. This helps also for the session-load case where files are opened/parsed when no project information is available yet. Change-Id: I7fce24af78b3b1efbf64dd27d8ca2a053e02d4ec Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Gray out diagnostics on document changeNikolai Kosjar2017-07-051-0/+1
| | | | | | | When reparses take a while, this is helpful. Change-Id: Ie2003a3d65b30d944d20fa19dd4161412182851c Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Provide highlighting for identifier under cursorNikolai Kosjar2017-06-141-0/+2
| | | | | Change-Id: I80ffe23cbcc84ab7323124581d9dd6afbe974fd0 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* CppEditor: Generalize CppUseSelectionsUpdaterNikolai Kosjar2017-06-141-0/+2
| | | | | | | | | 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>
* ClangCodeModel: De-slotOrgad Shaneh2017-03-201-3/+1
| | | | | Change-Id: I9e4520a1a1baec9a900a659931686fbc99123d3c Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppEditor: Rework showing/switching parse configurationsNikolai Kosjar2017-02-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | * Move the combox box for switching the parse configurations out of the "Additional Preprocessor Directives" dialog ('#'-button) to make it better visible/accessible. Also, decouple the extra preprocessor directives from the concrete parse context since this is not anymore in same dialog. * The combo box appears only if multiple parse configurations are available for a file. * The first time multiple parse configurations are detected, an info bar is shown that points the user to the combox box. A "Do Not Show Again" button is provided. * Upon selecting an entry, the preferred parse configuration is saved as part of the session. The setting can be cleared with the context menu entry on the combo box. Follow-up changes need to ensure that the display name and/or tooltip is unambiguous, e.g. for qbs and cmake projects. Change-Id: I9e9773704187291524ad7b605bfdddd83ef5b19d Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Remove some duplicationNikolai Kosjar2016-12-161-1/+1
| | | | | Change-Id: I8c84660b28c3e76b2cedd08ff3b44a38583f38a0 Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Fix initial document parse with modified contentNikolai Kosjar2016-11-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Reproduce with: 1. Create a new class named Foo with the wizard. 2. Close foo.h 3. In foo.cpp, add some class member function. 4. In foo.cpp, trigger the refactoring action "Add public Declaration" for the just defined member function. As a result, foo.h will be opened. ==> While the declaration was added, the header file is not yet reparsed with the new content - this can be verified by setting a custom color for "Function". In this use case, the refactoring action opens the editor and immediately modifies the document (RefactoringFile::apply). Fix by sending the document content along for the very first RegisterTranslationUnitForEditorMessage if the document was already modified. Change-Id: If20615a45b72dd0bef87e1870e403d0b277bc5d6 Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Show info bar for parse errors in header filesNikolai Kosjar2016-10-111-0/+3
| | | | | | | | | | | | | | | ...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>
* Clang: Hook up supportive translation unit on first editNikolai Kosjar2016-10-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | Parsing happens rotationally on the translation units. The recently parsed translation unit is used for completion jobs while the older version is used for parse jobs. Advantages: A1. A completion job cannot be blocked anymore by currently running parse job. A2. Faster triggering of parse jobs. A reparse was triggered about 1650ms after the last keystroke. This is down to 500ms now since we do not have a blocking translation unit for the completion anymore. Disadvantages: D1. Memory consumption is doubled for an edited document. This could be addressed by suspending the second translation unit after some time of inactivity. D2. Setup of the supportive translation unit takes some time. Change-Id: I958c883c01f274530f5482c788c15cd38d6f4c3e Reviewed-by: David Schulz <david.schulz@qt.io>
* CppEditor: Use full tooltip in ClangTextMarkhjk2016-07-251-4/+1
| | | | | Change-Id: I39cc64acbdbcd5e5156e1514acaf9674a91e81a4 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Wholesale conversion to #pragma oncehjk2016-03-301-4/+1
| | | | | | | Kudos to cgmb and https://github.com/cgmb/guardonce Change-Id: Ifa8970734b8d43fd08c9260c645bdb0228633791 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* Clang: Use CppHoverHandler for diagnostic tooltipsNikolai Kosjar2016-02-121-0/+6
| | | | | | | | | | We used to call QTextCharFormat::setToolTip from the ExtraSelection to install the diagnostic tooltip. Since this allows to set only text tooltips and we would like to introduce a custom tooltip widget for diagnostics, make use of CppHoverHandler, which is more flexible. Change-Id: Ia1b2c3c50810596ce4a3a025002e6e4efd8789db Reviewed-by: Alessandro Portale <alessandro.portale@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>
* Clang: Pass IpcCommunicator directly to ClangEditorDocumentProcessorNikolai Kosjar2015-12-161-5/+3
| | | | | Change-Id: I666c56f304522a3edc2a21055df4ef70aecb0e0e Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* Clang: Request diagnostics/highlighting only if neededNikolai Kosjar2015-11-301-6/+6
| | | | | | | | | | | Most of the time, the updated diagnostics/highlightings will be send by the backend on translation unit update. The other use case is changing the font settings (e.g. color), here we need to request the highlightings explicitly. Change-Id: I17a574eaf972c8bef12900241e7b33fe6ffd9dbd Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* Clang: Integrate highlighting results from backendMarco Bubke2015-11-261-4/+8
| | | | | Change-Id: I2c3fb69aabfe075bde76d63eafc2ca370f17493c Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* Clang: Only apply fixits to the corresponding revisionMarco Bubke2015-11-251-0/+2
| | | | | Change-Id: I4f4136369e1b261338d444670c212565e0c6b824 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Clang: Speed up requesting diagnosticsNikolai Kosjar2015-11-061-1/+2
| | | | | | | | | Register the translation unit and request diagnostics from the clangbackend as soon as the project part is determined. There is no reason to wait until the parser is finished for the highlighter. Change-Id: Iebccbf59ebd205389462dcee97363746fb651bb2 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Clang: Add fileContainer getterMarco Bubke2015-10-051-2/+6
| | | | | | | | File containers were generates in many places. To reduce the noise this getters are introduced. Change-Id: I059745c27ac2dd0515bc23b3438d6d264ba071d7 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Clang: Unregister file with project immediately on project closeNikolai Kosjar2015-10-011-1/+1
| | | | | | | | | | | | | | | | Ensure that first the editors unregister with the removed project part, then unregister the project part. This makes testing and following the message logs easier. It also fixes the following race condition: * Unload project of opened file * Immediately close the editor before a new project part is calculated ==> The editor is closed, but the translation unit is not properly unregistered. Change-Id: I618930d221323435ba60ac6c051380bccc9fdaf1 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* Clang: Add ClangEditorDocumentProcessor::hasProjectPartMarco Bubke2015-09-301-0/+1
| | | | | Change-Id: Ie08c44315c9d03434384a1fa0b276e22f45a2107 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Clang: Integrate clang's fixits as refactoring actionsNikolai Kosjar2015-09-291-0/+3
| | | | | | | | | | | | | | | | | They are invokable by the usual means (Alt+Enter, editor's context menu > Refactor) plus by the context menu of the editor's left margin for the related line. The fixit text comes directly from libclang and is thus not translated. We modify the text slighty by stripping the diagnostic category prefix ("note:", "error:", ...) and capitalizing the first letter. A follow-up change should properly indicate available refactorings with a refactoring icon in the editor's left margin. Task-number: QTCREATORBUG-14868 Change-Id: I86157c9f824d2a9dedf19087476d02ad1e6cc854 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* Clang: Refactor handling of diagnosticsNikolai Kosjar2015-09-291-7/+2
| | | | | | | | | | ...by introducing ClangDiagnosticManager and the helper class ClangDiagnosticFilter. ClangDiagnosticManager will get more state in a follow-up change. Change-Id: Id2c312bc897ea41ed67292b56b24dcfb7975ff4a Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* Merge remote-tracking branch 'origin/3.5'Eike Ziller2015-09-041-2/+2
|\ | | | | | | Change-Id: Ife5fdcd71b0adc99d4297a28a64515e9e93d7864
| * C++: Fix crash after triggering completion and closing editorNikolai Kosjar2015-09-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Rename ForCodeCompletion in ForEditorMarco Bubke2015-08-311-2/+2
| | | | | | | | | | | | | | | | It reflects that the translation units and projects have a tied relationship with an editor. Change-Id: I3c01d5776980fe079af1fdef82feded83fdf5463 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* | Clang: Add diagnosticsMarco Bubke2015-08-311-1/+17
|/ | | | | | | | Diagnostics are now moved to the clang backend process. Fixits are supported too. Change-Id: I20faacf466bbf78dec479220c3d7b336a47bc453 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>