forked from qt-creator/qt-creator
TextEditor: Introduce shortcut for forcing a function hint proposal
... and support it in the ClangCodeModel. This allows users to get function signature(s) displayed regardless of where exactly the cursor is on the function call. Fixes: QTCREATORBUG-19394 Change-Id: I033e8774db93680bfc3ee52610b817e0ef8ccc76 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -84,7 +84,8 @@ void ClangCompletionContextAnalyzer::analyze()
|
||||
m_positionEndOfExpression = activationSequenceContextProcessor.operatorStartPosition();
|
||||
m_positionForProposal = activationSequenceContextProcessor.startOfNamePosition();
|
||||
|
||||
const bool actionIsSet = handleNonFunctionCall(afterOperatorPosition);
|
||||
const bool actionIsSet = m_interface->type() != CompletionType::FunctionHint
|
||||
&& handleNonFunctionCall(afterOperatorPosition);
|
||||
if (!actionIsSet) {
|
||||
handleCommaInFunctionCall();
|
||||
handleFunctionCall(afterOperatorPosition);
|
||||
@@ -150,6 +151,19 @@ void ClangCompletionContextAnalyzer::handleCommaInFunctionCall()
|
||||
|
||||
void ClangCompletionContextAnalyzer::handleFunctionCall(int afterOperatorPosition)
|
||||
{
|
||||
if (m_interface->type() == CompletionType::FunctionHint) {
|
||||
const int functionNameStart = startOfFunctionCall(afterOperatorPosition);
|
||||
if (functionNameStart >= 0) {
|
||||
m_addSnippets = functionNameStart == afterOperatorPosition;
|
||||
setActionAndClangPosition(PassThroughToLibClangAfterLeftParen,
|
||||
m_positionForProposal,
|
||||
functionNameStart);
|
||||
} else {
|
||||
m_completionAction = CompleteNone;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_completionOperator == T_LPAREN || m_completionOperator == T_LBRACE) {
|
||||
ExpressionUnderCursor expressionUnderCursor(m_languageFeatures);
|
||||
QTextCursor textCursor(m_interface->textDocument());
|
||||
|
||||
Reference in New Issue
Block a user