Exemple #1
0
CompletionItem::CompletionItem(KDevelop::DeclarationPointer decl, QExplicitlySharedDataPointer< KDevelop::CodeCompletionContext > context, int inheritanceDepth):
    NormalDeclarationCompletionItem(decl, QExplicitlySharedDataPointer<KDevelop::CodeCompletionContext>(), 0),
    m_prefix("")
{
    DUChainReadLocker lock;
    if(!decl)
        return;
    //NormalDeclarationCompletionItem fails to get a meaningful prefix in these cases
    if(decl->abstractType() && decl->abstractType()->whichType() == KDevelop::AbstractType::TypeFunction)
        m_prefix = decl->abstractType()->toString();
    if(decl->kind() == KDevelop::Declaration::Import || decl->kind() == KDevelop::Declaration::NamespaceAlias)
        m_prefix = "namespace";
}
Exemple #2
0
NavigationWidget::NavigationWidget(KDevelop::DeclarationPointer declaration, KDevelop::TopDUContextPointer topContext,
                                   const QString& /* htmlPrefix */, const QString& /* htmlSuffix */, KDevelop::AbstractNavigationWidget::DisplayHints hints)
    : KDevelop::AbstractNavigationWidget()
{
    m_topContext = topContext;
    setDisplayHints(hints);

    initBrowser(400);
    auto realDeclaration = DeclarationPointer(Helper::resolveAliasDeclaration(declaration.data()));
    m_startContext = new DeclarationNavigationContext(realDeclaration, m_topContext);
    setContext(m_startContext);
}
QString NormalDeclarationCompletionItem::shortenedTypeString(KDevelop::DeclarationPointer decl, int desiredTypeLength) const
{
  Q_UNUSED(desiredTypeLength);
  return decl->abstractType()->toString();
}