Don't block CA completely when there's a 'slow' provider in the mix.

This commit is contained in:
Kris De Volder
2017-01-31 11:45:29 -08:00
parent 5a2bcaa5fc
commit 4a075f2433
3 changed files with 17 additions and 3 deletions

View File

@@ -204,7 +204,7 @@ public abstract class LaunguageServerApp {
}
}
protected static final Logger LOG = Logger.getLogger("main");
public static final Logger LOG = Logger.getLogger("main");
/**
* Listen for requests from the parent node process.

View File

@@ -48,7 +48,6 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
private SimpleLanguageServer server;
private ICompletionEngine engine;
public VscodeCompletionEngineAdapter(SimpleLanguageServer server, ICompletionEngine engine) {
this.server = server;
this.engine = engine;
@@ -64,6 +63,7 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
}
private Mono<CompletionList> getCompletionsMono(TextDocumentPositionParams params) {
logger.info("getCompletions(" + params +")");
SimpleTextDocumentService documents = server.getTextDocumentService();
TextDocument doc = documents.get(params).copy();
if (doc!=null) {
@@ -95,7 +95,7 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
list.setItems(items);
return list;
})
.subscribeOn(Schedulers.single()); //!!! without this the mono will just be computed on the same thread that calls it.
.subscribeOn(Schedulers.elastic()); //!!! without this the mono will just be computed on the same thread that calls it.
}
return Mono.just(SimpleTextDocumentService.NO_COMPLETIONS);
}

View File

@@ -14,6 +14,7 @@ import java.util.Collection;
import java.util.Set;
import java.util.concurrent.Callable;
import org.springframework.ide.vscode.commons.languageserver.LaunguageServerApp;
import org.springframework.ide.vscode.commons.util.IntegerRange;
import org.springframework.ide.vscode.commons.util.Renderable;
import org.springframework.ide.vscode.commons.util.Renderables;
@@ -27,6 +28,7 @@ import org.springframework.ide.vscode.commons.yaml.schema.YTypeUtil;
import org.springframework.ide.vscode.commons.yaml.schema.YValueHint;
import org.springframework.ide.vscode.commons.yaml.schema.YamlSchema;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
/**
@@ -96,7 +98,19 @@ public class ManifestYmlSchema implements YamlSchema {
TOPLEVEL_TYPE.addProperty(f.yprop("applications", f.yseq(application)));
TOPLEVEL_TYPE.addProperty("inherit", t_string, descriptionFor("inherit"));
// YAtomicType t_test_hanging = f.yatomic("Hanging");
// t_test_hanging.addHintProvider(() -> {
// try {
// Thread.sleep(60_000);
// } catch (InterruptedException e) {
// LaunguageServerApp.LOG.info("test_hanging hint provider interrupted!");
// throw e;
// }
// return YTypeFactory.hints(ImmutableList.of("very", "slow", "hints"));
// });
YTypedPropertyImpl[] props = {
// f.yprop("test_hanging", t_test_hanging),
f.yprop("buildpack", t_buildpack),
f.yprop("command", t_string),
f.yprop("disk_quota", t_memory),