MCPcopy Create free account
hub / github.com/KDE/kate / defsForFileExtensions

Function defsForFileExtensions

apps/lib/diff/diffwidget.cpp:773–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

771}
772
773static std::vector<KSyntaxHighlighting::Definition> defsForFileExtensions(const QSet<QString> &fileExtensions)
774{
775 const auto &repo = KTextEditor::Editor::instance()->repository();
776 if (fileExtensions.size() == 1) {
777 const QString name = QStringLiteral("a.") + *fileExtensions.begin();
778 return {repo.definitionForFileName(name)};
779 }
780
781 std::vector<KSyntaxHighlighting::Definition> defs;
782 for (const auto &ext : fileExtensions) {
783 const QString name = QStringLiteral("a.") + ext;
784 defs.push_back(repo.definitionForFileName(name));
785 }
786 QSet<QString> seenDefs;
787 std::vector<KSyntaxHighlighting::Definition> uniqueDefs;
788 for (const auto &def : defs) {
789 if (!seenDefs.contains(def.name())) {
790 uniqueDefs.push_back(def);
791 seenDefs.insert(def.name());
792 }
793 }
794 if (uniqueDefs.size() == 1) {
795 return uniqueDefs;
796 } else {
797 return {repo.definitionForName(QStringLiteral("None"))};
798 }
799}
800
801void DiffWidget::parseAndShowDiff(const QByteArray &raw)
802{

Callers 2

parseAndShowDiffMethod · 0.85

Calls 4

sizeMethod · 0.80
insertMethod · 0.80
beginMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected