Commit Graph

18 Commits

Author SHA1 Message Date
Christian Kandeler
949bb0e67b ClangCodeModel: Show value in tool tips, if possible
When hovering over a constant expression, it's probably helpful
to show that value to the user.
Requires clang 11 to fully work. For now, it only shows the value for
variable initializations.

Fixes: QTCREATORBUG-23967
Change-Id: I6b844231bac50993c2fa2fa82c552ad9cef590df
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-26 08:50:58 +00:00
Alessandro Portale
9904464074 Make various Q_LOGGING_CATEGORY's static
Change-Id: I43d3a198b0863d85a7fb305c7cb768f68acbd139
Reviewed-by: hjk <hjk@qt.io>
2020-01-15 14:54:10 +00:00
Eike Ziller
9c492ce962 Move function to get fallback help IDs to CppTools
To be shared between Clang and Built-in model

Change-Id: Iebe132c93033c252c58da13b858a0dce61483eaf
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-02-12 06:17:58 +00:00
Nikolai Kosjar
c5e43d86d1 Clang: Make diagnostic tooltips consistent
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>
2019-02-05 11:22:27 +00:00
Eike Ziller
443931c1da Help: Move resolution of help from multiple candidate IDs to HelpItem
No need for code duplication.

Change-Id: I3d2c795d072b8de5818e1844b8126e526339c0da
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-02-01 11:28:02 +00:00
Eike Ziller
32429e11c9 Help: Avoid double lookup for help tooltips
Save the HelpItem directly in the tooltip instead of the help ID which
would need to be looked up again.

Change-Id: I107e82e89d9ea26cad9d6532ad4c687d1ac8f1ec
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-02-01 11:00:55 +00:00
Eike Ziller
dabeb0aa1e Move Help item from text editor to core
The functionality is not text editor specific.

Change-Id: Iee531572f14673e75129f4bfbb64a1437899d31e
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-01-25 09:46:21 +00:00
Eike Ziller
6c10d36f87 Try harder to get context help in presence of diagnostics
- even if there are diagnostics still try to retrieve symbol info
  and help
- fall back to text based keyword extraction in case code model
  info fails
- if both a code model tool tip (e.g. function signature or type)
  and help are available, show both

Task-number: QTCREATORBUG-15959
Change-Id: Id85a223c24849ead1b25d63776d64a7da1cc73ef
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-21 10:30:03 +00:00
Nikolai Kosjar
c5b874dcf3 Clang: Show help with F1 even if there is a diagnostic
...at that particular location.

For example, the code

     new QSignalMapper;

produced a deprecated warning with Qt 5.12 and F1 led to "No
documentation available" as the diagnostic was always prioritized.

Task-number: QTCREATORBUG-21686
Change-Id: Icf03000fb6b9de04e467e758da6167018d154a21
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-01-10 08:09:20 +00:00
Alessandro Portale
62abfd7b50 ClangCodeModel: Modernize
modernize-use-nullptr
modernize-use-auto
modernize-use-override
modernize-use-equals-default
modernize-use-using

Change-Id: I386f885860c01574035c69226240fe3b8e38392c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-14 08:09:15 +00:00
Orgad Shaneh
bdc2b4b59f Remove hard-coded disabling of debug logs
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>
2018-10-13 16:36:58 +00:00
Nikolai Kosjar
d8768c0c6d Clang: Remove explicit ClangHoverHandler::ClangHoverHandler
Change-Id: I131504e8f31210a928a802ad7c5dc069ac11b2f3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-11 07:43:56 +00:00
Robert Loehning
43947fb868 Clang: Compile fix
Partially reverting 7282e05554

Change-Id: I114cd7d5da9905cd6ce7e1044f848aeac369be37
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-02-09 17:13:10 +00:00
Robert Loehning
7282e05554 Improve translated strings
Change-Id: I7a45c6f8dcbb0e1b3c17a60823664fe1943c5654
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2018-02-09 16:36:54 +00:00
Nikolai Kosjar
fa501caa76 Clang: Handle cancelled future in ClangHoverHandler
This completes

  Clang: Cancel tooltip future on backend restart
  commit 56157f739d

Task-number: QTCREATORBUG-19644
Change-Id: I4a27681368df912003a415cec809c578f7c409cd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-26 11:18:17 +00:00
Nikolai Kosjar
56157f739d Clang: Cancel tooltip future on backend restart
Change-Id: Icbc461aa765c47ae0dd708a731b4d132bfa0f7d8
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-19 14:19:55 +00:00
Nikolai Kosjar
0a4073ef90 TextEditor: Return hover handler priority by callback
...to get rid of the asynchronous code path.

Change-Id: I56377510440631b0be712333b2a4018717c86389
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-01-19 13:57:57 +00:00
Nikolai Kosjar
76c25bcd6a Clang: Provide tooltips
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>
2018-01-16 15:32:15 +00:00