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

Function didOpen

src/common/lsp/protocol/protocol.cpp:677–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675}
676
677QJsonObject didOpen(const QString &filePath)
678{
679 QFile file(filePath);
680 QString text;
681 if (!file.open(QFile::ReadOnly)) {
682 qCritical() << "Failed, open file: "
683 << filePath << file.errorString();
684 }
685 text = file.readAll();
686 file.close();
687
688 QJsonObject textDocument {
689 { K_URI, QUrl::fromLocalFile(filePath).toString() },
690 { K_LANGUAGEID, "cpp" },
691 { K_VERSION, 1 },
692 { K_TEXT, text }
693 };
694
695 QJsonObject params {
696 { K_TEXTDOCUMENT, textDocument }
697 };
698
699 return params;
700}
701
702// full mode
703QJsonObject didChange(const QString &filePath, const QByteArray &text, int version)

Callers 1

openRequestMethod · 0.85

Calls 5

readAllMethod · 0.80
openMethod · 0.45
errorStringMethod · 0.45
closeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected