Commit Graph

26 Commits

Author SHA1 Message Date
Nikolai Kosjar
ca63359386 CppTools/Clang: Clean-up of includes
Change-Id: I0ba340dcf0ee23e61588f17262d07e7088751836
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-12-16 13:15:38 +00:00
Nikolai Kosjar
0af0bd8e36 Clang: Show type icon for usings/typedefs
...in the completion widget.

Task-number: QTCREATORBUG-15078
Change-Id: I1309b628e1f060fa68bdcf13838037728207b035
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-12-08 13:05:02 +00:00
Marco Bubke
a08336fcc2 Clang: Don't send multiple completions for the same position
If we send already a completion we should test if there is already one
sent for the same position.

Change-Id: Ie88f89bff0e1da1c5e747827a45154c7ccaecabc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-12-02 16:01:54 +00:00
Nikolai Kosjar
1410bf3faf Clang: Use "clang" prefix plugin files
...for consistency and to avoid future file name clashes.

Change-Id: If595c8debfa1ceb01a1bb0ed34649fa513660503
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-30 11:04:07 +00:00
Marco Bubke
250c8d662b Clang: Add UpdateTranslationUnitsForEditorMessage
If an editor is changing all translation units independent of their project
part they must be updated too. So we introduce a new message to update all
translation units with the same file path.

Change-Id: I70d0ea2bbca9fa880111ff7219573e54f3277026
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-13 14:03:11 +00:00
Marco Bubke
b412eb81ea Clang: Add revision and completion management
Reparsing a document is expensive so we should avoid it by all means. In
this patch we prevent that the same document is send again. It isn't send
too in advance of a code completion if there was no changes before the
the completion position.

Change-Id: I0bb786ba1d4e7ce08611a518cb32f8cf8f4d0037
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-28 15:46:15 +00:00
Marco Bubke
7eee8061f6 Clang: Add unsaved files messages
We have auto generated buffers from ui files which are not open but have no
file representation. So we need to provide them as unsaved files only.

Change-Id: I48a426c18e06eeda2fa707864f32f293e17ac651
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:02:19 +00:00
Marco Bubke
6e14eb6940 Clang: Rename ForCodeCompletion in ForEditor
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>
2015-08-31 15:02:02 +00:00
Marco Bubke
1a5e7b778d Clang: Send document revision with the completion request
The sent text should always accompanied by the document revision to avoid
useless the reparsing of the translation unit.

Change-Id: I4af50f277f9352f4af0cdda8a32ad76c44c1935f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:00:24 +00:00
Marco Bubke
aa6aaee510 Clang: Add brief comment support
Change-Id: I5af23b6694d3d0bf45ed0a30b4d91b350f0515df
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 14:59:50 +00:00
Marco Bubke
b278dc87ca Clang: Add diagnostics
Diagnostics are now moved to the clang backend process. Fixits are
supported too.

Change-Id: I20faacf466bbf78dec479220c3d7b336a47bc453
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 14:59:16 +00:00
Nikolai Kosjar
64d8ac4880 Clang: Fix showing signature tooltips for functions
...and others in the generic completion widget.

Task-number: QTCREATORBUG-14874
Change-Id: I75122eaf364d740b0a64ca514b31a26c5c8ea673
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-08-10 09:35:01 +00:00
Nikolai Kosjar
a1da7182f9 Clang: Fix memory leak on completion II
...for the following case:

  void fun1();
  void fun2();

  void g()
  {
      fu // Type 'n', wait for the widget, hit return to choose the item
  }

Once e.g. "fun1" is chosen, the completion is triggered again but the
processor (and as result the assist interface) is not freed.

The assumption was that for the AsynchronousWithThread case
IAssistProcessor::perform() would either return 0 (async completion was
started) or != 0 for an immediate proposal. It turns out there is a
third case: no proposal if the completion is not applicable, e.g.
choosing an item in the example above will retrigger completion, however
no completion makes sense for "fun1()<CURSOR>" for an idle editor.

Workaround the case with a getter/setter in IAssistProcessor. Proper
solution should (slightly?) rework the IAssistProcessor API.

Change-Id: I44dde8287998d54ded1ea07e7c39a5157cf62029
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-29 12:18:39 +00:00
Nikolai Kosjar
91429aa752 Clang: Fix completion position for clang and proposal
* Rename some members/functions to clarify their meaning.

* Ensure that the position for the proposal widget is at start of the
  identifer, so that the filter prefix will be found correctly in the
  GenericProposalWidget. For certain cases the completion were
  calculated but the widget was never shown:

  Case 1:

    void f()
    {
        <COMPLETION_CURSOR>
    }

  Case 2:

    void f()
    {
        st<COMPLETION_CURSOR>
    }

  Case 3:

    if (true)
      <COMPLETION_CURSOR>

  Case 4:

    foo. mem<COMPLETION_CURSOR>

Change-Id: Ie79e01e8a22f8ec306136ec4ccbfffd544edd573
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-27 13:19:02 +00:00
Nikolai Kosjar
e4748fe801 Clang: Typedef some often used types
using CodeCompletions = QVector<CodeCompletion>;
using CodeCompletionChunks = QVector<CodeCompletionChunk>;

Change-Id: Id729a43566c23dc000e44d79ccf4a49e4f235f51
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-23 11:48:26 +00:00
Nikolai Kosjar
5643a45a83 Clang: Fallback to global completion if function call completion fails
We can not offer proper constructor completion with libclang <= 3.6, so
fall back to normal/global completion.

Change-Id: I90bb8d981ae20ed4c228f829ad4267221b92f8a1
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-23 11:18:55 +00:00
Nikolai Kosjar
889237f962 Clang: Mini refactorings in ClangCompletionAssistProcessor
The renames will improve the readability of the follo-up change.

Change-Id: If1f5ae2a2798c13ce7268e436dae1b3963f01d5e
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-23 11:18:50 +00:00
Marco Bubke
c267a34b09 Clang: Use the CodeCompletion getter directly
Casting from a Qvariant is expensive and it happens here very often.

Change-Id: If524412f314bb8ac9e9e5e4335c7e32ff7a9ce40
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-20 14:50:24 +00:00
Nikolai Kosjar
91ee695c71 Clang: Extract a function
Change-Id: I3041e019c2c65d9d988d31c47823e29955cd1c51
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-20 13:19:58 +00:00
Marco Bubke
7b8f5d9815 Clang: Improve conversion of QHash to QList
Change-Id: I5bea89d9a432240a131311b5fed537a46b3be967
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-20 13:19:38 +00:00
Nikolai Kosjar
7e7e79dedc Clang: Send modified file content only once
This introduces some

  SOFT ASSERT: "!"Got TranslationUnitDoesNotExistCommand"" in file
    clangbackendipcintegration.cpp, line 154

e.g. for include path completion. This will be addressed by a follow-up
change.

Change-Id: I97a50f5b8a44744e1379d77fc042d5e65cb191c9
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-20 12:55:22 +00:00
Nikolai Kosjar
420bc69739 CppTools: Use project part ids instead of file paths
File paths are not unique since e.g. each qbs group in a file is mapped
to a project part.

Change-Id: I7df3f224dd23046b869f2588b8a34eb26cfc0b1a
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-20 09:49:14 +00:00
Marco Bubke
336501943e Clang: Add tooltip for clang snippets
Change-Id: Ifccfd72c52910c6e1086d6c782552c60fbb89f5f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-16 12:54:48 +00:00
Marco Bubke
945c0fbc71 Clang: Add code completion for keyword snippets from clang
Change-Id: I91f7af74d811769424928bce1c586a30b5794d6f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-14 16:24:30 +00:00
Marco Bubke
dd89d731cf Clang: Extract and test action sequence
Change-Id: I66f8f29d7b17be67a55560bdcc0b0a3aeb1ce480
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-08 12:29:20 +00:00
Marco Bubke
ed27414f48 Clang: Split clangcompletion.[h|cpp]
First step for refactor them.

Change-Id: If9de084e39ddf31317035ccbbc1fd57d7797d193
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-06 12:41:01 +00:00