There are two versions of startOfOperator:
* InternalCppCompletionAssistProcessor::startOfOperator
* ClangCompletionAssistProcessor::startOfOperator
The latter started as a copy of the former, but the former got some bug
fixes in the meantime. Adjust both versions to each other, so it's easy
to diff them and to extract the duplication in a follow-up change.
Change-Id: Icf48386bf1ad0fa473bec476c5412be9b1890139
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
There are three cases that must be handled:
1. Completion in C++ style comment
2. Completion in first line of a C style comment
3. Completion in non-first line of a C style comment
This change fixes case 1 + 2. Case 3 will be addressed in a follow-up
change, same goes for the duplication.
Task-number: QTCREATORBUG-15143
Change-Id: I449711f965ddcbbe6158870a8a5ae33218e0d238
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
For unit test we need to break every dependency to the TextEditor
Widget etc.. With an abstract interface we can implement it in clang
without relying on unwanted dependencies. It makes it also easier to
compute the values deferred.
Change-Id: I1b313a1625f4e80bd324ab4bf1a7c4f6b690abe9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
E.g. "dynamic_cast<>()" showed up as item.
Let CompletionChunksToTextConverter default to plain text format and
explicitly request HTML where needed.
Change-Id: Iebce85cb888a5bd697ffdce364118b6dc65a435d
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
1 struct Foo { int member; };
2 void f(Foo *foo)
3 {
4 foo.<REQUEST COMPLETION> // correct '.' to '->' and provide results
5 }
The preferred approach would be to check if "foo" in line 4 is of
pointer type, but there is no suitable cursor (only CompoundStmt) at
that position since the code is usually not yet parsed and thus invalid.
Thus, just run the completion as is. If there are not any results for a
dot completion, re-run the completion with "." exchanged by "->". This
approach is inherently slower than the preferred approach implemented in
the built-in code model.
The following rare cases are not handled:
1) Requesting completion after white space:
Works: foo.<COMPLETE HERE>
Fails: foo. <COMPLETE HERE>
2) Opening a file and requesting completion (ctrl+space) without prior
editing. No editing before triggering completion means that no
unsaved file is generated on the backend side, which is a
requirement for the correction.
Task-number: QTCREATORBUG-11581
Change-Id: I6bc8e8594778774ab342755fdb01a8a3e5c52ba0
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Also extracting inline HeaderPath class and change projects list in vector
because the size is larger than a pointer.
Change-Id: I885fdff3fe9bccc877634d1615249755f5b674fd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
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>
...for consistency and to avoid future file name clashes.
Change-Id: If595c8debfa1ceb01a1bb0ed34649fa513660503
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
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>
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>
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>
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>
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>
Diagnostics are now moved to the clang backend process. Fixits are
supported too.
Change-Id: I20faacf466bbf78dec479220c3d7b336a47bc453
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
...and others in the generic completion widget.
Task-number: QTCREATORBUG-14874
Change-Id: I75122eaf364d740b0a64ca514b31a26c5c8ea673
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
...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>
* 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>
using CodeCompletions = QVector<CodeCompletion>;
using CodeCompletionChunks = QVector<CodeCompletionChunk>;
Change-Id: Id729a43566c23dc000e44d79ccf4a49e4f235f51
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
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>
The renames will improve the readability of the follo-up change.
Change-Id: If1f5ae2a2798c13ce7268e436dae1b3963f01d5e
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Casting from a Qvariant is expensive and it happens here very often.
Change-Id: If524412f314bb8ac9e9e5e4335c7e32ff7a9ce40
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
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>
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>