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>
This commit is contained in:
Nikolai Kosjar
2015-07-23 16:06:48 +02:00
parent 49b1d35778
commit 91429aa752
9 changed files with 108 additions and 50 deletions

View File

@@ -47,14 +47,14 @@ MATCHER_P3(HasResult, completionKind, offset, newPosition,
std::string(negation ? "hasn't" : "has")
+ " result of completion kind " + PrintToString(Token::name(completionKind))
+ ", offset " + PrintToString(offset)
+ " and new position in document" + PrintToString(newPosition))
+ " and new operator start position" + PrintToString(newPosition))
{
if (arg.completionKind() != completionKind
|| arg.offset() != offset
|| arg.position() != newPosition) {
|| arg.operatorStartPosition() != newPosition) {
*result_listener << "completion kind is " << PrintToString(Token::name(arg.completionKind()))
<< ", offset is " << PrintToString(arg.offset())
<< " and new position in document is " << PrintToString(arg.position());
<< " and new operator start position is " << PrintToString(arg.operatorStartPosition());
return false;
}