PT 168776173 - Integrate progress service live hovers v2

Initial integration of progress service into live hovers v2. Added new
API to make it cleared when progress for the  same taskId can be done,
and added progress reporting to SpringProcessConnectorService which can
potentially be a long running progress if several retries on refresh are
required.
This commit is contained in:
nsingh@pivotal.io
2019-11-14 13:56:02 -08:00
parent bf5b9f5a31
commit 9969c59e95
6 changed files with 58 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016-2017 Pivotal, Inc.
* Copyright (c) 2016-2019 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,9 +11,21 @@
package org.springframework.ide.vscode.commons.languageserver;
@FunctionalInterface
public interface ProgressService {
public static ProgressService NO_PROGRESS = new ProgressService() {
@Override
public void progressEvent(String taskId, String statusMsg) {
}
@Override
public void progressDone(String taskId) {
}
};
/**
* Sends a progress event to the LSP client. A taskId is an arbirary id
* that can be chosen by the caller. The purpose of the id is to be a 'unique'
@@ -31,5 +43,7 @@ public interface ProgressService {
* @param statusMsg
*/
void progressEvent(String taskId, String statusMsg);
void progressDone(String taskId);
}

View File

@@ -32,7 +32,6 @@ import org.eclipse.lsp4j.ApplyWorkspaceEditParams;
import org.eclipse.lsp4j.ApplyWorkspaceEditResponse;
import org.eclipse.lsp4j.ClientCapabilities;
import org.eclipse.lsp4j.CodeLensOptions;
import org.eclipse.lsp4j.CompletionOptions;
import org.eclipse.lsp4j.Diagnostic;
import org.eclipse.lsp4j.DiagnosticSeverity;
import org.eclipse.lsp4j.ExecuteCommandOptions;
@@ -84,7 +83,6 @@ import org.springframework.ide.vscode.commons.util.CollectionUtil;
import org.springframework.ide.vscode.commons.util.text.TextDocument;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -118,10 +116,19 @@ public final class SimpleLanguageServer implements Sts4LanguageServer, LanguageC
private STS4LanguageClient client;
private final LanguageServerProperties props;
private ProgressService progressService = (String taskId, String statusMsg) -> {
STS4LanguageClient client = SimpleLanguageServer.this.client;
if (client!=null) {
client.progress(new ProgressParams(taskId, statusMsg));
private ProgressService progressService = new ProgressService() {
@Override
public void progressEvent(String taskId, String statusMsg) {
STS4LanguageClient client = SimpleLanguageServer.this.client;
if (client!=null) {
client.progress(new ProgressParams(taskId, statusMsg));
}
}
@Override
public void progressDone(String taskId) {
progressEvent(taskId, null);
}
};