fix - Gradle server will terminate if generatePipepath error (#1557)
This commit is contained in:
Родитель
e692c0c7bd
Коммит
2d816ba345
|
@ -23,6 +23,10 @@ export async function startLanguageClientAndWaitForConnection(
|
|||
rootProjectsStore: RootProjectsStore,
|
||||
languageServerPipePath: string
|
||||
): Promise<void> {
|
||||
if (languageServerPipePath === "") {
|
||||
isLanguageServerStarted = false;
|
||||
return;
|
||||
}
|
||||
void vscode.window.withProgress({ location: vscode.ProgressLocation.Window }, (progress) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
return new Promise<void>(async (resolve) => {
|
||||
|
|
|
@ -41,7 +41,7 @@ export class GradleServer {
|
|||
private setLanguageServerPipePath(): void {
|
||||
this.languageServerPipePath = getRandomPipeName();
|
||||
if (this.languageServerPipePath === "") {
|
||||
this.logger.error("Failed to generate language server pipe path, language server will not start");
|
||||
this.logger.error("Gradle language server will not start due to pipe path generation failure");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ export class GradleServer {
|
|||
if (isPrepared) {
|
||||
startBuildServer = true;
|
||||
} else {
|
||||
this.logger.error("Failed to generate build server pipe path, build server will not start");
|
||||
this.logger.error("Gradle build server will not start due to pipe path generation failure");
|
||||
}
|
||||
}
|
||||
this.bspProxy.setBuildServerStarted(startBuildServer);
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.lsp4j.CompletionOptions;
|
||||
import org.eclipse.lsp4j.DocumentFilter;
|
||||
import org.eclipse.lsp4j.ExecuteCommandOptions;
|
||||
|
@ -43,9 +42,6 @@ public class GradleLanguageServer implements LanguageServer, LanguageClientAware
|
|||
|
||||
public static void main(String[] args) {
|
||||
GradleLanguageServer server = new GradleLanguageServer();
|
||||
if (StringUtils.isBlank(args[0])) {
|
||||
server.exit();
|
||||
}
|
||||
try {
|
||||
NamedPipeStream pipeStream = new NamedPipeStream(args[0]);
|
||||
|
||||
|
@ -55,7 +51,7 @@ public class GradleLanguageServer implements LanguageServer, LanguageClientAware
|
|||
server.connect(launcher.getRemoteProxy());
|
||||
launcher.startListening();
|
||||
} catch (IOException e) {
|
||||
server.exit();
|
||||
throw new RuntimeException("Gradle language server start failed", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.github.badsyntax.gradle;
|
||||
|
||||
import com.github.badsyntax.gradle.utils.Utils;
|
||||
import com.google.common.base.Strings;
|
||||
import com.microsoft.gradle.GradleLanguageServer;
|
||||
import io.grpc.Server;
|
||||
import io.grpc.ServerBuilder;
|
||||
|
@ -62,8 +63,10 @@ public class GradleServer {
|
|||
int taskServerPort = Integer.parseInt(Utils.validateRequiredParam(params, "port"));
|
||||
startTaskServerThread(taskServerPort);
|
||||
|
||||
String languageServerPipePath = Utils.validateRequiredParam(params, "languageServerPipePath");
|
||||
startLanguageServerThread(languageServerPipePath);
|
||||
String languageServerPipePath = params.get("languageServerPipePath");
|
||||
if (!Strings.isNullOrEmpty(languageServerPipePath)) {
|
||||
startLanguageServerThread(languageServerPipePath);
|
||||
}
|
||||
|
||||
boolean startBuildServer = Boolean.parseBoolean(Utils.validateRequiredParam(params, "startBuildServer"));
|
||||
if (startBuildServer) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче