Make sure the progress report is not empty (#1400)

Signed-off-by: Sheng Chen <sheche@microsoft.com>
This commit is contained in:
Sheng Chen 2023-08-31 15:00:39 +08:00 коммит произвёл GitHub
Родитель be9db8f0f7
Коммит a129d2cb50
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
import org.eclipse.lsp4j.ExecuteCommandParams; import org.eclipse.lsp4j.ExecuteCommandParams;
import org.eclipse.lsp4j.ProgressParams; import org.eclipse.lsp4j.ProgressParams;
@ -105,7 +106,8 @@ public class GradleBuildClient implements BuildClient {
} else { } else {
Either<String, Integer> id = Either.forLeft(params.getTaskId().getId()); Either<String, Integer> id = Either.forLeft(params.getTaskId().getId());
WorkDoneProgressReport workDoneProgressReport = new WorkDoneProgressReport(); WorkDoneProgressReport workDoneProgressReport = new WorkDoneProgressReport();
workDoneProgressReport.setMessage(BUILD_SERVER_TASK + " - " + params.getMessage()); workDoneProgressReport.setMessage(StringUtils.isBlank(params.getMessage()) ? BUILD_SERVER_TASK :
BUILD_SERVER_TASK + " - " + params.getMessage());
lsClient.notifyProgress(new ProgressParams(id, Either.forLeft(workDoneProgressReport))); lsClient.notifyProgress(new ProgressParams(id, Either.forLeft(workDoneProgressReport)));
} }
} }
@ -118,7 +120,8 @@ public class GradleBuildClient implements BuildClient {
} else { } else {
Either<String, Integer> id = Either.forLeft(params.getTaskId().getId()); Either<String, Integer> id = Either.forLeft(params.getTaskId().getId());
WorkDoneProgressEnd workDoneProgressEnd = new WorkDoneProgressEnd(); WorkDoneProgressEnd workDoneProgressEnd = new WorkDoneProgressEnd();
workDoneProgressEnd.setMessage(params.getMessage()); workDoneProgressEnd.setMessage(StringUtils.isBlank(params.getMessage()) ? BUILD_SERVER_TASK :
BUILD_SERVER_TASK + " - " + params.getMessage());
lsClient.notifyProgress(new ProgressParams(id, Either.forLeft(workDoneProgressEnd))); lsClient.notifyProgress(new ProgressParams(id, Either.forLeft(workDoneProgressEnd)));
} }
} }