Commit Graph

30 Commits

Author SHA1 Message Date
Nikolai Kosjar
20d2d76824 Clang: Do not flash issues pane when switching editor
Previously, when swichting to a file with errors, the Issues pane button
would flash.

Stop this for the clang code model issues as it is rather annoying since
the issues pane is updated for the current document.

Change-Id: I403a8b8cd0deef586c53769d0b646855a7fc9278
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-05-14 09:32:28 +00:00
Nikolai Kosjar
f46fb39f3c Clang: Reduce diagnostic visualization for non-project files further
We already avoided showing inline annotations for diagnostics in
non-project files. But given many diagnostics the visualization is still
quite noisy. E.g. consider opening not self-contained header files or
files for which we do not have any project open, as it can happen if the
debugger jumps to such a file.

So leave only the text mark icon on the left and avoid all the rest:
underlines and refactoring icons in the editor, marks in the scrollbar
and task hub issues.

Change-Id: I05245981b21b38be650489a006593922dcb6896d
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-05-14 09:04:42 +00:00
Nikolai Kosjar
6b70c27e3b Clang: Do not show diagnostic category in inline annotations and issues pane
For build system diagnostics they are not displayed either.

Also, the error/warning is already encoded in the icon and the color.

However, the category is still shown in the tooltip.

Change-Id: I190ab17691c32786cefc20d058010c65cda5ace9
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-05-14 07:01:46 +00:00
Eike Ziller
45f8d221bf Use FileName in TextMark
Change-Id: I3666d95dc8ef3b7da099d6d30f5cb4678a349493
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-05-03 06:51:47 +00:00
Nikolai Kosjar
7be7d26814 Clang: Show current editor diagnostics in issues pane
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>
2018-04-16 09:37:06 +00:00
Orgad Shaneh
070b5fdbbb Clang: Fix minor style issues
Change-Id: I040e3f6fcd717b4ffae2f0ded8bfebada67888fb
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-04-12 07:21:29 +00:00
hjk
cf4dbb4bb6 ClangSupport: Use simpler structures in some cases
The patch is mostly mechanical, but contains also a few spurious changes
from values references for some local variables, foreach -> ranged for
etc that I coulnd't resist.

Change-Id: I58f0bd972546895eb318607cbfbd7ac35caf3f23
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-06 12:55:23 +00:00
Ivan Donchevskii
fbbdfd2444 Clang: Add commentary about column convertion
... to/from utf8 byte offset used by Clang.

Change-Id: I294d6cd61b416e5f2d64206ee2f3f1b4a91fb1d3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-02-01 12:22:45 +00:00
Ivan Donchevskii
09310bcdc6 Clang: fix utf8 related column numbers
Use new clang_getFileContents to efficiently convert
utf8 byte offsets from line start to column numbers.
Also provide simplier backwards convertion to pass
resulting utf8 offset to clang.

Task-number: QTCREATORBUG-16941
Change-Id: If0e58fe01ad3e281b7e952e972b9e86f6e75aadb
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-01-26 15:39:31 +00:00
Ivan Donchevskii
80a472740d TextEditor: move convenience from texteditor to utils
Allows to use this header without texteditor dependency.

Change-Id: I706f42799c3ea42473a716fa9ef9f3cfbef6fdd4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-22 12:59:35 +00:00
David Schulz
635750aa11 Clang: delay text mark update
Reducing display of unwanted line annotations while typing in small
files.

Change-Id: I51864bbc3056ad792d5ee4b96f63e954dfba79dd
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-07-17 07:14:06 +00:00
Nikolai Kosjar
e1de989e16 Clang: Show inline diagnostics only for project files
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>
2017-07-10 12:32:07 +00:00
Nikolai Kosjar
2747985358 Clang: Gray out diagnostics on document change
When reparses take a while, this is helpful.

Change-Id: Ie2003a3d65b30d944d20fa19dd4161412182851c
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-07-05 08:47:34 +00:00
Ivan Donchevskii
707170ca04 Clang: make workaround for multibyte utf8
Correct columns in clang diagnostics and completion

Task-number: QTCREATORBUG-16775
Change-Id: I7260a0e52007fe261e83492dca5d457c34476497
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-05-22 13:28:36 +00:00
Ivan Donchevskii
5e84af54a0 Clang: fix incomplete include text underlining
Fix invalid include text selection.

Task-number: QTCREATORBUG-15471
Change-Id: Ifbe00a7215f2307648e815cb283691496d02c4d0
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-05-19 07:47:16 +00:00
Nikolai Kosjar
4a08f14cf6 Clang: Fix removing text marks on line deletion
Task-number: QTCREATORBUG-17270
Change-Id: I582015597a65141e420622dcdb50e82f9791b189
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-11-23 11:52:31 +00:00
Nikolai Kosjar
9d55d8485c Clang: Show info bar for parse errors in header files
...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>
2016-10-11 14:01:14 +00:00
hjk
728b914727 CppEditor: Use full tooltip in ClangTextMark
Change-Id: I39cc64acbdbcd5e5156e1514acaf9674a91e81a4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-07-25 13:25:16 +00:00
hjk
6edfb66908 TextEditor: Enable tooltips for textmarks
Adjust bookmark code, add tooltips for clang diagnostics.

Change-Id: I489d499f5431fcb29f27611d4350298acb30baac
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-07-19 10:45:23 +00:00
Nikolai Kosjar
46840046df Clang: Honor fixits own locations
...when showing the refactoring marker and generating the quick fix
operations.

Opening main.cpp

  main.cpp:
   #include "file.h"
   void f(char *s) { foo(s); }

  file.h:
    // significant line 1
    // significant line 2
    // significant line 3
    bool foo(int fd);

led to

    SOFT ASSERT: "textBlock.isValid()" in file
    clangdiagnosticmanager.cpp, line 205

and a misbehavior when applying the fixit from the tooltip.

We take the line of a diagnostic to display the fixit marker if it has
any fixits. But the (child) diagnostic might be issued for an other file
(that's what happening here), so better take the line of the location
where the fixit is meant to be applied.

Same applies for generation of the quick fix entries.

Change-Id: I48d38420b285d2d2f86e3faa2319513aa8b47848
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-28 11:08:08 +00:00
Takumi ASAKI
5f45ed1c7b Clang: tr()-Fixes
Do not use QObject::tr().

Change-Id: I369eb9a57cc0d37a16fe0c11d766f22405a9eef7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-05-20 10:21:14 +00:00
Nikolai Kosjar
89199b519b Clang: Indicate available "fix its" with a light bulb
...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>
2016-02-16 18:12:12 +00:00
Nikolai Kosjar
9a4284d666 Clang: Use CppHoverHandler for diagnostic tooltips
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>
2016-02-12 11:20:27 +00:00
Tobias Hunger
397e7f4843 Update License according to agreement with Free Qt Foundation
* Update files in src/plugins

Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:57:01 +00:00
Marco Bubke
19d9dc0ce3 Clang: Use line and column instead of offset for diagnostics
Offsets can be get wrong because of the utf8 <-> utf16 differences. Line
and columns are not that sensitive to it.

Change-Id: I2e3e8c000621b6d694a4ada6df176f29427794f5
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-07 11:10:05 +00:00
Marco Bubke
f482ad6069 Clang: Use fontsettings in diagnostics
Change-Id: I8438293a37a53532927520106d4ee5346237ebfe
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-02 13:46:18 +00:00
Marco Bubke
bd10e9b020 Clang: Only apply fixits to the corresponding revision
Change-Id: I4f4136369e1b261338d444670c212565e0c6b824
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-25 14:15:39 +00:00
Nikolai Kosjar
ebce521ef9 Clang: Polish tool tip text for diagnostic
* Set the category apart.
* Show only the disable option and only in debug mode.

Change-Id: If5f65f9bd04c8e37e376a9862035005f4456394a
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-10-19 09:21:13 +00:00
Nikolai Kosjar
a7928b4b0b Clang: Integrate clang's fixits as refactoring actions
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>
2015-09-29 11:39:21 +00:00
Nikolai Kosjar
de6d7f0617 Clang: Refactor handling of diagnostics
...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>
2015-09-29 11:38:53 +00:00