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

Function textForDocument

plugins/clang/tests/test_codecompletion.cpp:111–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109};
110
111QString textForDocument(const QUrl& url, const KTextEditor::Cursor& position)
112{
113 bool close = false;
114
115 auto* doc = ICore::self()->documentController()->documentForUrl(url);
116 if (!doc) {
117 doc = ICore::self()->documentController()->openDocument(url);
118 close = true;
119 }
120
121 auto text = doc->textDocument()->text({{0, 0}, position});
122
123 if (close) {
124 doc->close(IDocument::Discard);
125 }
126
127 return text;
128}
129
130QExplicitlySharedDataPointer<ClangCodeCompletionContext> createContext(const ReferencedTopDUContext& top,
131 const ParseSessionData::Ptr& sessionData,

Callers 1

createContextFunction · 0.85

Calls 6

documentForUrlMethod · 0.80
documentControllerMethod · 0.80
openDocumentMethod · 0.45
textMethod · 0.45
textDocumentMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected