Adding docs and some code cleanup

This commit is contained in:
nsingh
2017-08-02 10:51:00 -07:00
parent 0a530d9e32
commit ef3981b162
3 changed files with 20 additions and 5 deletions

View File

@@ -15,7 +15,21 @@ public interface IProblemCollector {
void beginCollecting();
void endCollecting();
void accept(ReconcileProblem problem);
void checkPointCollecting();
/**
* Allows the problem collector to process problems that has been collected so
* far, BEFORE the end collecting. It is to handle cases where a subset of
* problems need to be processed or published in an "intermediate" phase during
* a collecting session, but prior to the final end collecting. For example, if
* a collection session in a reconcile engine wants to publish fast problems
* first before handling slow problems , this method allows the reconcile engine
* to notify the problem collector to process the fast problems first before
* starting with the slow ones. The reconcile engine, or whoever is calling the
* collector, is responsible for deciding when to call this checkpoint.
*/
default void checkPointCollecting() {
}
/**
* Problem collector that simply ignores/discards anything passed to it.
@@ -27,7 +41,5 @@ public interface IProblemCollector {
}
public void accept(ReconcileProblem problem) {
}
public void checkPointCollecting() {
}
};
}

View File

@@ -23,6 +23,10 @@ public interface ValueParser {
* that the String is not the format this parser expects.
*/
Object parse(String str) throws Exception;
default boolean longRunning() {
return false;
}
static ValueParser of(ValueParser x) {
return x;

View File

@@ -31,7 +31,6 @@ import org.springframework.ide.vscode.commons.languageserver.reconcile.Reconcile
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblemImpl;
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReplacementQuickfix;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion;
import org.springframework.ide.vscode.commons.util.EnumValueParser;
import org.springframework.ide.vscode.commons.util.ExceptionUtil;
import org.springframework.ide.vscode.commons.util.IntegerRange;
import org.springframework.ide.vscode.commons.util.Log;
@@ -198,7 +197,7 @@ public class SchemaBasedYamlASTReconciler implements YamlASTReconciler {
SchemaContextAware<ValueParser> parserProvider = typeUtil.getValueParser(type);
if (parserProvider!=null) {
parserProvider.safeWithContext(schemaContext).ifPresent(parser -> {
if (parser instanceof EnumValueParser && ((EnumValueParser) parser).longRunning()) {
if (parser.longRunning()) {
slowDelayedConstraints.add(() -> {
parse(ast, node, type, parser);
});