MCPcopy Create free account
hub / github.com/baldurk/renderdoc / startAutocomplete

Method startAutocomplete

qrenderdoc/Windows/PythonShell.cpp:1529–1557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1527}
1528
1529void PythonShell::startAutocomplete()
1530{
1531 sptr_t pos = scriptEditor->currentPos();
1532 sptr_t line = scriptEditor->lineFromPosition(pos);
1533 sptr_t lineStart = scriptEditor->positionFromLine(line);
1534 QByteArray lineText = scriptEditor->getLine(line);
1535
1536 sptr_t end = pos - lineStart - 1;
1537 sptr_t start;
1538 for(start = end; start >= 0; start--)
1539 {
1540 char c = lineText[(int)start];
1541 if(QChar::fromLatin1(c).isLetterOrNumber() || c == '.' || c == '_')
1542 continue;
1543
1544 start++;
1545 break;
1546 }
1547
1548 QString comp = QString::fromUtf8(lineText.mid(start, end - start + 1));
1549
1550 PythonContext *context = newImportedDummyContext();
1551
1552 QStringList completions = context->completionOptions(comp);
1553
1554 context->Finish();
1555
1556 scriptEditor->autoCShow(comp.count(), completions.join(QLatin1Char(' ')).toUtf8().data());
1557}
1558
1559PythonContext *PythonShell::newImportedDummyContext()
1560{

Callers

nothing calls this directly

Calls 15

fromLatin1Function · 0.85
QLatin1CharClass · 0.85
currentPosMethod · 0.80
lineFromPositionMethod · 0.80
positionFromLineMethod · 0.80
getLineMethod · 0.80
completionOptionsMethod · 0.80
autoCShowMethod · 0.80
toUtf8Method · 0.80
joinMethod · 0.80
fromUtf8Function · 0.50
midMethod · 0.45

Tested by

no test coverage detected