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

Function lineInDocument

plugins/clang/clangsupport.cpp:66–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64namespace {
65
66QPair<QString, KTextEditor::Range> lineInDocument(const QUrl &url, const KTextEditor::Cursor& position)
67{
68 KDevelop::IDocument* doc = ICore::self()->documentController()->documentForUrl(url);
69 if (!doc || !doc->textDocument() || !ICore::self()->documentController()->activeTextDocumentView()) {
70 return {};
71 }
72
73 const int lineNumber = position.line();
74 const int lineLength = doc->textDocument()->lineLength(lineNumber);
75 KTextEditor::Range range(lineNumber, 0, lineNumber, lineLength);
76 QString line = doc->textDocument()->text(range);
77 return {line, range};
78}
79
80QPair<TopDUContextPointer, KTextEditor::Range> importedContextForPosition(const QUrl &url, const KTextEditor::Cursor& position)
81{

Callers 1

Calls 6

documentForUrlMethod · 0.80
documentControllerMethod · 0.80
textDocumentMethod · 0.45
lineMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected