MCPcopy Create free account
hub / github.com/KDE/kdevelop / findProjectFileItem

Function findProjectFileItem

plugins/qmljs/qmljsparsejob.cpp:40–66  ·  view source on GitHub ↗

* This function has been copied from kdev-clang * * SPDX-FileCopyrightText: 2013 Olivier de Gaalon and Milian Wolff * Licensed under the GPL v2+ */

Source from the content-addressed store, hash-verified

38 * Licensed under the GPL v2+
39 */
40ProjectFileItem* findProjectFileItem(const IndexedString& url)
41{
42 ProjectFileItem* file = nullptr;
43
44 const auto& projects = ICore::self()->projectController()->projects();
45 for (auto project: projects) {
46 const auto files = project->filesForPath(url);
47 if (files.isEmpty()) {
48 continue;
49 }
50
51 file = files.last();
52
53 // A file might be defined in different targets.
54 // Prefer file items defined inside a target with non-empty includes.
55 for (auto f: files) {
56 if (!dynamic_cast<ProjectTargetItem*>(f->parent())) {
57 continue;
58 }
59 file = f;
60 if (!IDefinesAndIncludesManager::manager()->includes(f, IDefinesAndIncludesManager::ProjectSpecific).isEmpty()) {
61 break;
62 }
63 }
64 }
65 return file;
66}
67
68QmlJsParseJob::QmlJsParseJob(const IndexedString& url, ILanguageSupport* languageSupport)
69: ParseJob(url, languageSupport)

Callers 1

QmlJsParseJobMethod · 0.70

Calls 8

managerFunction · 0.85
projectsMethod · 0.80
projectControllerMethod · 0.80
filesForPathMethod · 0.45
isEmptyMethod · 0.45
lastMethod · 0.45
parentMethod · 0.45
includesMethod · 0.45

Tested by

no test coverage detected