Search in sources :

Example 1 with ReconcileProblemImpl

use of org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblemImpl in project sts4 by spring-projects.

the class SchemaBasedYamlASTReconciler method valueParseError.

private void valueParseError(YType type, DocumentRegion region, String parseErrorMsg, ProblemType problemType, ReplacementQuickfix fix) {
    if (!StringUtil.hasText(parseErrorMsg)) {
        parseErrorMsg = "Couldn't parse as '" + describe(type) + "'";
    }
    ReconcileProblemImpl problem = YamlSchemaProblems.problem(problemType, parseErrorMsg, region);
    if (fix != null && StringUtil.hasText(fix.replacement)) {
        try {
            problem.addQuickfix(new QuickfixData<>(quickfixes.SIMPLE_TEXT_EDIT, new ReplaceStringData(region, fix.replacement), fix.msg));
        } catch (Exception e) {
            Log.log(e);
        }
    }
    problems.accept(problem);
}
Also used : ReconcileProblemImpl(org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblemImpl) ReconcileException(org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileException) ValueParseException(org.springframework.ide.vscode.commons.util.ValueParseException)

Aggregations

ReconcileException (org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileException)1 ReconcileProblemImpl (org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblemImpl)1 ValueParseException (org.springframework.ide.vscode.commons.util.ValueParseException)1