diff --git a/language/codecompletion/codecompletionitemgrouper.cpp b/language/codecompletion/codecompletionitemgrouper.cpp --- a/language/codecompletion/codecompletionitemgrouper.cpp +++ b/language/codecompletion/codecompletionitemgrouper.cpp @@ -25,5 +25,15 @@ using namespace KDevelop; ///@todo make configurable. These are the attributes that can be respected for grouping. -const int SimplifiedAttributesExtractor::groupingProperties = CodeCompletionModel::Public | CodeCompletionModel::Protected | CodeCompletionModel::Private | CodeCompletionModel::Static | CodeCompletionModel::TypeAlias | CodeCompletionModel::Variable | CodeCompletionModel::Class | CodeCompletionModel::GlobalScope | CodeCompletionModel::LocalScope | CodeCompletionModel::GlobalScope | CodeCompletionModel::NamespaceScope; +const int SimplifiedAttributesExtractor::groupingProperties = + CodeCompletionModel::Public +| CodeCompletionModel::Protected +| CodeCompletionModel::Private +| CodeCompletionModel::Static +| CodeCompletionModel::TypeAlias +| CodeCompletionModel::Variable +| CodeCompletionModel::Class +| CodeCompletionModel::GlobalScope +| CodeCompletionModel::LocalScope +| CodeCompletionModel::NamespaceScope; diff --git a/language/codecompletion/codecompletionmodel.cpp b/language/codecompletion/codecompletionmodel.cpp --- a/language/codecompletion/codecompletionmodel.cpp +++ b/language/codecompletion/codecompletionmodel.cpp @@ -173,51 +173,47 @@ TopDUContext* top = DUChainUtils::standardContextForUrl( url ); if(!top) { + qCDebug(LANGUAGE) << "================== NO CONTEXT FOUND ======================="; + beginResetModel(); + m_completionItems.clear(); + m_navigationWidgets.clear(); + endResetModel(); + + qCDebug(LANGUAGE) << "Completion invoked for unknown context. Document:" << url << ", Known documents:" << DUChain::self()->documents(); + return; } + setCurrentTopContext(TopDUContextPointer(top)); RangeInRevision rangeInRevision = top->transformToLocalRevision(KTextEditor::Range(range)); - if (top) { - qCDebug(LANGUAGE) << "completion invoked for context" << (DUContext*)top; + qCDebug(LANGUAGE) << "completion invoked for context" << (DUContext*)top; - if( top->parsingEnvironmentFile() && top->parsingEnvironmentFile()->modificationRevision() != ModificationRevision::revisionForFile(IndexedString(url.toString())) ) { - qCDebug(LANGUAGE) << "Found context is not current. Its revision is " /*<< top->parsingEnvironmentFile()->modificationRevision() << " while the document-revision is " << ModificationRevision::revisionForFile(IndexedString(url.toString()))*/; - } + if( top->parsingEnvironmentFile() && top->parsingEnvironmentFile()->modificationRevision() != ModificationRevision::revisionForFile(IndexedString(url.toString())) ) { + qCDebug(LANGUAGE) << "Found context is not current. Its revision is " /*<< top->parsingEnvironmentFile()->modificationRevision() << " while the document-revision is " << ModificationRevision::revisionForFile(IndexedString(url.toString()))*/; + } - DUContextPointer thisContext; - { - qCDebug(LANGUAGE) << "apply specialization:" << range.start(); - thisContext = SpecializationStore::self().applySpecialization(top->findContextAt(rangeInRevision.start), top); + DUContextPointer thisContext; + { + qCDebug(LANGUAGE) << "apply specialization:" << range.start(); + thisContext = SpecializationStore::self().applySpecialization(top->findContextAt(rangeInRevision.start), top); - if ( thisContext ) { - qCDebug(LANGUAGE) << "after specialization:" << thisContext->localScopeIdentifier().toString() << thisContext->rangeInCurrentRevision(); - } - - if(!thisContext) - thisContext = top; - - qCDebug(LANGUAGE) << "context is set to" << thisContext.data(); - if( !thisContext ) { - qCDebug(LANGUAGE) << "================== NO CONTEXT FOUND ======================="; - beginResetModel(); - m_completionItems.clear(); - m_navigationWidgets.clear(); - endResetModel(); - return; - } + if ( thisContext ) { + qCDebug(LANGUAGE) << "after specialization:" << thisContext->localScopeIdentifier().toString() << thisContext->rangeInCurrentRevision(); + } else { + thisContext = top; } - lock.unlock(); + qCDebug(LANGUAGE) << "context is set to" << thisContext.data(); + } - if(m_forceWaitForModel) - emit waitForReset(); + lock.unlock(); - emit completionsNeeded(thisContext, range.start(), view); - } else { - qCDebug(LANGUAGE) << "Completion invoked for unknown context. Document:" << url << ", Known documents:" << DUChain::self()->documents(); - } + if(m_forceWaitForModel) + emit waitForReset(); + + emit completionsNeeded(thisContext, range.start(), view); } diff --git a/language/codegen/applychangeswidget.cpp b/language/codegen/applychangeswidget.cpp --- a/language/codegen/applychangeswidget.cpp +++ b/language/codegen/applychangeswidget.cpp @@ -205,9 +205,7 @@ void ApplyChangesWidget::updateDiffView(int index) { - int prevIndex = d->m_index; d->m_index = index == -1 ? d->m_index : index; - d->m_index = prevIndex; } } diff --git a/language/duchain/declarationid.cpp b/language/duchain/declarationid.cpp --- a/language/duchain/declarationid.cpp +++ b/language/duchain/declarationid.cpp @@ -128,12 +128,10 @@ if((!DUChain::self()->isInMemory(iDecl.topContextIndex()))) continue; - if(!top) { - Declaration* decl = iDecl.data(); - if(decl && m_indirectData.additionalIdentity == decl->additionalIdentity()) { - //Hit - ret.append(decl); - } + Declaration* decl = iDecl.data(); + if(decl && m_indirectData.additionalIdentity == decl->additionalIdentity()) { + //Hit + ret.append(decl); } } } @@ -188,14 +186,12 @@ if((!DUChain::self()->isInMemory(iDecl.topContextIndex()))) continue; - if(!top) { - Declaration* decl = iDecl.data(); - if(decl && m_indirectData.additionalIdentity == decl->additionalIdentity()) { - //Hit - ret = decl; - if(!ret->isForwardDeclaration()) - break; - } + Declaration* decl = iDecl.data(); + if(decl && m_indirectData.additionalIdentity == decl->additionalIdentity()) { + //Hit + ret = decl; + if(!ret->isForwardDeclaration()) + break; } } } diff --git a/plugins/contextbrowser/contextbrowserview.cpp b/plugins/contextbrowser/contextbrowserview.cpp --- a/plugins/contextbrowser/contextbrowserview.cpp +++ b/plugins/contextbrowser/contextbrowserview.cpp @@ -190,12 +190,11 @@ } TopDUContext* top = m_lastUsedTopContext.data(); - if(top && m_navigationWidgetDeclaration.isValid() && m_navigationWidgetDeclaration.getDeclaration(top)) { - if(top) { - //Update the navigation-widget - Declaration* decl = m_navigationWidgetDeclaration.getDeclaration(top); + if(top && m_navigationWidgetDeclaration.isValid()) { + //Update the navigation-widget + Declaration* decl = m_navigationWidgetDeclaration.getDeclaration(top); + if(decl) setDeclaration(decl, top, true); - } } QWidget::showEvent(event); } diff --git a/shell/documentcontroller.cpp b/shell/documentcontroller.cpp --- a/shell/documentcontroller.cpp +++ b/shell/documentcontroller.cpp @@ -1178,7 +1178,6 @@ // Check if the second child-set contains an unterminated separator, which means that the active views should end up there for(int pos = pickSeparator+1; pos < urlsWithSeparators.size(); ++pos) if( separators.contains(urlsWithSeparators[pos]) && (pos == urlsWithSeparators.size()-1 || - separatorsAndParens.contains(urlsWithSeparators[pos-1]) || separatorsAndParens.contains(urlsWithSeparators[pos-1])) ) activeViewToSecondChild = true; } @@ -1220,8 +1219,7 @@ QUrl url = doc->url(); IProject* project = KDevelop::ICore::self()->projectController()->findProjectForUrl(url); if(project && project->versionControlPlugin()) { - IBasicVersionControl* iface = nullptr; - iface = project->versionControlPlugin()->extension(); + IBasicVersionControl* iface = project->versionControlPlugin()->extension(); auto helper = new VcsPluginHelper(project->versionControlPlugin(), iface); connect(doc->textDocument(), &KTextEditor::Document::aboutToClose, helper, static_cast(&VcsPluginHelper::disposeEventually)); diff --git a/shell/mainwindow_p.cpp b/shell/mainwindow_p.cpp --- a/shell/mainwindow_p.cpp +++ b/shell/mainwindow_p.cpp @@ -301,8 +301,8 @@ action->setWhatsThis( i18nc( "@info:whatsthis", "Switches to the previous split view." ) ); action->setIcon(QIcon::fromTheme(QStringLiteral("go-previous"))); - action = KStandardAction::fullScreen( this, SLOT(toggleFullScreen(bool)), m_mainWindow, actionCollection() ); - + KStandardAction::fullScreen( this, SLOT(toggleFullScreen(bool)), m_mainWindow, actionCollection() ); + action = actionCollection()->addAction( QStringLiteral("file_new") ); action->setIcon(QIcon::fromTheme(QStringLiteral("document-new"))); actionCollection()->setDefaultShortcut(action, Qt::CTRL + Qt::Key_N ); diff --git a/shell/project.cpp b/shell/project.cpp --- a/shell/project.cpp +++ b/shell/project.cpp @@ -323,8 +323,7 @@ { if (manager) { - IProjectFileManager* iface = nullptr; - iface = manager->extension(); + IProjectFileManager* iface = manager->extension(); Q_ASSERT(iface); return iface; } diff --git a/sublime/idealcontroller.cpp b/sublime/idealcontroller.cpp --- a/sublime/idealcontroller.cpp +++ b/sublime/idealcontroller.cpp @@ -186,9 +186,9 @@ } if (area == Qt::BottomDockWidgetArea || area == Qt::TopDockWidgetArea) - dock->setFeatures( QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | IdealDockWidget::DockWidgetVerticalTitleBar | QDockWidget::DockWidgetMovable); + dock->setFeatures( QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | IdealDockWidget::DockWidgetVerticalTitleBar ); else - dock->setFeatures( QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetMovable ); + dock->setFeatures( QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable ); } IdealButtonBarWidget* IdealController::barForDockArea(Qt::DockWidgetArea area) const diff --git a/util/tests/test_path.cpp b/util/tests/test_path.cpp --- a/util/tests/test_path.cpp +++ b/util/tests/test_path.cpp @@ -371,7 +371,8 @@ bool greater = !equal && !less; QVERIFY(left == left); - QVERIFY(right == right); +// QVERIFY(right == right); + QCOMPARE(left == right, equal); QCOMPARE(right == left, equal); diff --git a/vcs/vcspluginhelper.cpp b/vcs/vcspluginhelper.cpp --- a/vcs/vcspluginhelper.cpp +++ b/vcs/vcspluginhelper.cpp @@ -423,13 +423,14 @@ menu->addSeparator(); menu->addAction(d->diffForRevAction); menu->addAction(d->diffForRevGlobalAction); - QAction* action = nullptr; - action = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-copy")), i18n("Copy Revision")); - connect(action, &QAction::triggered, this, [this, rev]() { + + QAction* copyAction = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-copy")), i18n("Copy Revision")); + connect(copyAction, &QAction::triggered, this, [this, rev]() { QApplication::clipboard()->setText(rev.revisionValue().toString()); }); - action = menu->addAction(QIcon::fromTheme(QStringLiteral("view-history")), i18n("History...")); - connect(action, &QAction::triggered, this, [this, rev]() { + + QAction* historyAction = menu->addAction(QIcon::fromTheme(QStringLiteral("view-history")), i18n("History...")); + connect(historyAction, &QAction::triggered, this, [this, rev]() { history(rev); }); }