MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / completion

Function completion

src/common/util/environment.cpp:24–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace language {
23
24Version completion(Category category, Kit kit, const Version &version)
25{
26 qInfo() << __FUNCTION__ << version.major.value();
27 Version ret = version;
28 if (category == User) {
29 if (kit == Python) {
30 QString program = "python";
31 if (version.major) {
32 program += QString::number(version.major.value());
33 }
34 ProcessUtil::execute(program, {"-V"}, [&](const QByteArray &data){
35 QRegularExpression regExp {"Python\\s(?<" + RK_Major +">[0-9]+)"
36 + "\\.(?<"+ RK_Minor +">[0-9]+)"
37 + "\\.(?<"+ RK_Revision +">[0-9]+)"
38 + "(\\.(?<"+ RK_Build + ">[0-9]+))?"};
39 auto matchs = regExp.match(data);
40 if (matchs.hasMatch()) {
41 auto major = matchs.captured(RK_Major);
42 auto minor = matchs.captured(RK_Minor);
43 auto revsion = matchs.captured(RK_Revision);
44 auto build = matchs.captured(RK_Build);
45 if (!major.isNull()) {
46 ret.major = major.toInt();
47 }
48 if (!minor.isNull()) {
49 ret.minor = minor.toInt();
50 }
51 if (!revsion.isNull()) {
52 ret.revision = revsion.toInt();
53 }
54 if (!build.isNull()) {
55 ret.revision = build.toInt();
56 }
57 }
58 });
59 }
60 }
61 return ret;
62}
63
64Program search(Category category, Kit kit, const Version &version)
65{

Callers 1

searchFunction · 0.70

Calls 4

numberClass · 0.85
valueMethod · 0.45
matchMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected