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

Method doCheckJdtls

src/tools/languageadapter/remotechecker.cpp:93–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void RemoteChecker::doCheckJdtls(const QString &language)
94{
95 if (checkJdtlsFlag)
96 return;
97
98 checkJdtlsFlag = true;
99
100 QUrl remoteJdtlsUrl("https://download.eclipse.org/jdtls/snapshots/jdt-language-server-1.11.0-202205051421.tar.gz");
101 QString localJdtlsPath = CustomPaths::lspRuntimePath(language) + QDir::separator() + "jdt-language-server.tar.gz";
102 QUrl remoteJdtlsShasum256Url("https://download.eclipse.org/jdtls/snapshots/jdt-language-server-1.11.0-202205051421.tar.gz.sha256");
103 QString localJdtlsShasum256Path = CustomPaths::lspRuntimePath(language) + QDir::separator() + "jdt-language-server.tar.gz.sha256";
104
105 // local lsp shasum256 file
106 if (!FO::exists(localJdtlsShasum256Path)) { // not local shasum256 file
107 // save remote shasum256
108 saveRemoteFile(remoteJdtlsShasum256Url, localJdtlsShasum256Path);
109 } else { // exist shasum256 file
110 QString remoteClangdShasum256Data = getRemoteFile(remoteJdtlsShasum256Url);
111 if (!remoteClangdShasum256Data.isEmpty()) {
112 if (FO::readAll(localJdtlsShasum256Path) != remoteClangdShasum256Data) {
113 // save remote shasum256
114 saveRemoteFile(remoteJdtlsShasum256Url, localJdtlsShasum256Path);
115 }
116 }
117 }
118
119 // local lsp cxx backend program
120 bool localKeep = true;
121 if (FO::exists(localJdtlsPath)) {
122 if (FO::exists(localJdtlsShasum256Path)) {
123 localKeep = checkShasum(localJdtlsPath, FO::readAll(localJdtlsShasum256Path), "256");
124 } else { // not exists clangd program
125 localKeep = false;
126 }
127 } else {
128 localKeep = false;
129 }
130
131 if (!localKeep) {
132 FO::doRemove(localJdtlsPath);
133
134 QStringList args = { remoteJdtlsUrl.toEncoded(), "-O", localJdtlsPath };
135 WGetDialog dialog;
136 dialog.setWorkingDirectory(CustomPaths::lspRuntimePath(language));
137 dialog.setWgetArguments(args);
138 dialog.exec();
139
140 ProcessDialog processDialog;
141 processDialog.setWorkingDirectory(CustomPaths::lspRuntimePath(language));
142 processDialog.setProgram("tar");
143 processDialog.setArguments({"zxvf", localJdtlsPath, "-C", "."});
144 processDialog.exec();
145 }
146}
147
148void RemoteChecker::doCheckPyls(const QString &language)
149{

Callers

nothing calls this directly

Calls 6

setWgetArgumentsMethod · 0.80
isEmptyMethod · 0.45
setWorkingDirectoryMethod · 0.45
execMethod · 0.45
setProgramMethod · 0.45
setArgumentsMethod · 0.45

Tested by

no test coverage detected