Review Request: Proper auto-completion in switch statements

Ivan Shapovalov intelfx100 at gmail.com
Fri Jul 6 16:35:01 UTC 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/105410/
-----------------------------------------------------------

(Updated July 6, 2012, 4:35 p.m.)


Review request for KDevelop.


Changes
-------

Most importantly, the threading is fixed.
Also, fix of point 2 (do not mark non-constants as best matches for "case" completion) has been removed.


Description (updated)
-------

Improve code completion within switch statements.

1) Resolve type of the switch'd expression correctly
 - in switchExpressionType(), replaced evaluateType() with evaluateExpression()

2) Add completion items for enumerations declared in different scopes
 - this required adding another condition branch in the end of CodeCompletionContext::standardAccessCompletionItems(),
which in turn required proper setting of m_expressionResult in CaseAccess contexts,
which required moving switchExpressionType() to CodeCompletionContext::caseAccessCompletionItems() and re-ordering some code.


Diffs (updated)
-----

  languages/cpp/codecompletion/context.cpp 33dcad1 
  languages/cpp/codecompletion/item.h 4735f2a 
  languages/cpp/codecompletion/item.cpp affd4e6 
  languages/cpp/tests/test_cppcodecompletion.h 20a70cb 
  languages/cpp/tests/test_cppcodecompletion.cpp ec82d2d 

Diff: http://git.reviewboard.kde.org/r/105410/diff/


Testing (updated)
-------

There are unit-tests, but they do not work since DUChainBase::createRangeMoving(), which is used to parse switch'd expression type, does not work without an editor.


Thanks,

Ivan Shapovalov

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20120706/90465503/attachment.html>


More information about the KDevelop-devel mailing list