diff options
| author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2009-05-27 11:12:06 +0200 |
|---|---|---|
| committer | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2009-05-27 11:38:57 +0200 |
| commit | efc0b20859d1cfd5949191f6b2b65f9266c49625 (patch) | |
| tree | c5c747c7338124e39294b1c169fe5837fb31457f /src/plugins/cpptools/cppcodecompletion.cpp | |
| parent | 39b0da2a1ea5cb1a5a186c94cdc6da5c5580936a (diff) | |
| download | qt-creator-efc0b20859d1cfd5949191f6b2b65f9266c49625.tar.gz | |
Made typing parenthesis even faster
Only attempt to activate the completion when there is a function id on
the left of the parenthesis.
Reviewed-by: Roberto Raggi
Diffstat (limited to 'src/plugins/cpptools/cppcodecompletion.cpp')
| -rw-r--r-- | src/plugins/cpptools/cppcodecompletion.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 84994e78b6..211ec084e6 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -514,6 +514,26 @@ static int startOfOperator(TextEditor::ITextEditable *editor, start = pos; } + if (k == T_LPAREN) { + const QList<SimpleToken> &tokens = tokenUnderCursor.tokens(); + int i = 0; + for (; i < tokens.size(); ++i) { + const SimpleToken &token = tokens.at(i); + if (token.position() == tk.position()) { + if (i == 0) // no token on the left, but might be on a previous line + break; + const SimpleToken &previousToken = tokens.at(i - 1); + if (previousToken.is(T_IDENTIFIER) || previousToken.is(T_GREATER)) + break; + } + } + + if (i == tokens.size()) { + k = T_EOF_SYMBOL; + start = pos; + } + } + if (kind) *kind = k; |
