diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2016-03-29 12:26:25 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2016-03-31 06:51:34 +0000 |
commit | 4de62a7349a55776d81d21a73a567c731fc5cf9b (patch) | |
tree | 11e1bf488064f7b76e37304f758cfe16aa8fad03 /src/plugins/clangcodemodel | |
parent | 9905eb6f7537e81784758171d61501d0496a33d7 (diff) | |
download | qt-creator-4de62a7349a55776d81d21a73a567c731fc5cf9b.tar.gz |
C++: Fix completion for doxygen tags I
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>
Diffstat (limited to 'src/plugins/clangcodemodel')
-rw-r--r-- | src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp index a535656c73..9fa20e4fab 100644 --- a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp +++ b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp @@ -322,6 +322,8 @@ int ClangCompletionAssistProcessor::startOfOperator(int positionInDocument, const Tokens &tokens = tokenize(tc.block().text(), BackwardsScanner::previousBlockState(tc.block())); const int tokenIdx = SimpleLexer::tokenBefore(tokens, qMax(0, tc.positionInBlock() - 1)); // get the token at the left of the cursor const Token tk = (tokenIdx == -1) ? Token() : tokens.at(tokenIdx); + const QChar characterBeforePositionInDocument + = m_interface->characterAt(positionInDocument - 1); if (*kind == T_DOXY_COMMENT && !(tk.is(T_DOXY_COMMENT) || tk.is(T_CPP_DOXY_COMMENT))) { *kind = T_EOF_SYMBOL; @@ -329,7 +331,8 @@ int ClangCompletionAssistProcessor::startOfOperator(int positionInDocument, } // Don't complete in comments or strings, but still check for include completion else if (tk.is(T_COMMENT) || tk.is(T_CPP_COMMENT) - || tk.is(T_CPP_DOXY_COMMENT) || tk.is(T_DOXY_COMMENT) + || ((tk.is(T_CPP_DOXY_COMMENT) || tk.is(T_DOXY_COMMENT)) + && !isDoxygenTagCompletionCharacter(characterBeforePositionInDocument)) || (tk.isLiteral() && (*kind != T_STRING_LITERAL && *kind != T_ANGLE_STRING_LITERAL && *kind != T_SLASH))) { |