Changeset View
Changeset View
Standalone View
Standalone View
completion/helpers.cpp
Show All 38 Lines | |||||
39 | namespace java { | 39 | namespace java { | ||
40 | 40 | | |||
41 | QString createArgumentList(const NormalDeclarationCompletionItem& item, QList<QVariant>* highlighting, bool includeDefaultParams, bool noShortening ) | 41 | QString createArgumentList(const NormalDeclarationCompletionItem& item, QList<QVariant>* highlighting, bool includeDefaultParams, bool noShortening ) | ||
42 | { | 42 | { | ||
43 | QString ret; | 43 | QString ret; | ||
44 | 44 | | |||
45 | Declaration* dec(item.declaration().data()); | 45 | Declaration* dec(item.declaration().data()); | ||
46 | if (!dec) { | 46 | if (!dec) { | ||
47 | kDebug() << "No declaration for item"; | 47 | qDebug() << "No declaration for item"; | ||
48 | return ret; | 48 | return ret; | ||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | TopDUContext* top = 0; | 51 | TopDUContext* top = 0; | ||
52 | if(item.completionContext() && item.completionContext()->duContext()) | 52 | if(item.completionContext() && item.completionContext()->duContext()) | ||
53 | top = item.completionContext()->duContext()->topContext(); | 53 | top = item.completionContext()->duContext()->topContext(); | ||
54 | 54 | | |||
55 | //if( item.completionContext() && item.completionContext()->memberAccessOperation() == CodeCompletionContext::FunctionCallAccess && item.completionContext()->functions().count() > item.listOffset ) | 55 | //if( item.completionContext() && item.completionContext()->memberAccessOperation() == CodeCompletionContext::FunctionCallAccess && item.completionContext()->functions().count() > item.listOffset ) | ||
56 | //f = item.completionContext()->functions()[item.listOffset]; | 56 | //f = item.completionContext()->functions()[item.listOffset]; | ||
57 | 57 | | |||
58 | QTextFormat normalFormat(QTextFormat::CharFormat); | 58 | QTextFormat normalFormat(QTextFormat::CharFormat); | ||
59 | QTextFormat highlightFormat; //highlightFormat is invalid, so kate uses the match-quality dependent color. | 59 | QTextFormat highlightFormat; //highlightFormat is invalid, so kate uses the match-quality dependent color. | ||
60 | QTextCharFormat boldFormat; | 60 | QTextCharFormat boldFormat; | ||
61 | boldFormat.setFontWeight(QFont::Bold); | 61 | boldFormat.setFontWeight(QFont::Bold); | ||
62 | 62 | | |||
63 | AbstractFunctionDeclaration* decl = dynamic_cast<AbstractFunctionDeclaration*>(dec); | 63 | AbstractFunctionDeclaration* decl = dynamic_cast<AbstractFunctionDeclaration*>(dec); | ||
64 | if (!decl) { | 64 | if (!decl) { | ||
65 | kDebug() << "Declaration is not a subclass of AbstractFunctionDeclaration" << dec->toString(); | 65 | qDebug() << "Declaration is not a subclass of AbstractFunctionDeclaration" << dec->toString(); | ||
66 | } | 66 | } | ||
67 | 67 | | |||
68 | FunctionType::Ptr functionType = dec->type<FunctionType>(); | 68 | FunctionType::Ptr functionType = dec->type<FunctionType>(); | ||
69 | if (!functionType) { | 69 | if (!functionType) { | ||
70 | kDebug() << "Type is not a function type" << dec->abstractType()->toString(); | 70 | qDebug() << "Type is not a function type" << dec->abstractType()->toString(); | ||
71 | } | 71 | } | ||
72 | 72 | | |||
73 | if (functionType && decl) { | 73 | if (functionType && decl) { | ||
74 | 74 | | |||
75 | QVector<Declaration*> parameters; | 75 | QVector<Declaration*> parameters; | ||
76 | if( DUChainUtils::getArgumentContext(dec) ) | 76 | if( DUChainUtils::argumentContext(dec) ) | ||
77 | parameters = DUChainUtils::getArgumentContext(dec)->localDeclarations(top); | 77 | parameters = DUChainUtils::argumentContext(dec)->localDeclarations(top); | ||
78 | 78 | | |||
79 | // QStringList defaultParams = decl->defaultParameters(); | 79 | // QStringList defaultParams = decl->defaultParameters(); | ||
80 | 80 | | |||
81 | QVector<Declaration*>::const_iterator paramNameIt = parameters.begin(); | 81 | QVector<Declaration*>::const_iterator paramNameIt = parameters.begin(); | ||
82 | uint defaultParamNum = 0; | 82 | uint defaultParamNum = 0; | ||
83 | 83 | | |||
84 | int firstDefaultParam = functionType->arguments().count() - decl->defaultParametersSize(); | 84 | int firstDefaultParam = functionType->arguments().count() - decl->defaultParametersSize(); | ||
85 | 85 | | |||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |