Missing settings for severities for query syntax problems

This commit is contained in:
aboyko
2024-06-13 09:00:52 -04:00
parent 5a68303f7d
commit eade64184a
9 changed files with 99 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022, 2023 VMware, Inc.
* Copyright (c) 2022, 2024 VMware, 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
@@ -38,7 +38,7 @@ public class SpringProblemCategories {
public static final ProblemCategory VERSION_VALIDATION = new ProblemCategory("version-validation", "Versions and Support Ranges",
new Toggle("Enablement", EnumSet.of(OFF, ON), ON, "boot-java.validation.java.version-validation"));
public static final ProblemCategory JPQL = new ProblemCategory("jpql-validation", "JPQL",
new Toggle("Enablement", EnumSet.of(OFF, ON), ON, "boot-java.validation.jpql"));;
public static final ProblemCategory DATA_QUERY = new ProblemCategory("data-query", "Data Query",
new Toggle("Enablement", EnumSet.of(OFF, ON), ON, "boot-java.validation.data-query"));
}

View File

@@ -63,7 +63,7 @@ public class HqlReconciler implements Reconciler {
offset = token.getStartIndex() - token.getCharPositionInLine();
length = token.getCharPositionInLine() + 1;
}
problemCollector.accept(new ReconcileProblemImpl(QueryProblemType.EXPRESSION_SYNTAX, "HQL: " + msg, startPosition + offset, length));
problemCollector.accept(new ReconcileProblemImpl(QueryProblemType.HQL_SYNTAX, "HQL: " + msg, startPosition + offset, length));
}
@Override

View File

@@ -62,7 +62,7 @@ public class JpqlReconciler implements Reconciler {
offset = token.getStartIndex() - token.getCharPositionInLine();
length = token.getCharPositionInLine() + 1;
}
problemCollector.accept(new ReconcileProblemImpl(QueryProblemType.EXPRESSION_SYNTAX, "JPQL: " + msg, startPosition + offset, length));
problemCollector.accept(new ReconcileProblemImpl(QueryProblemType.JPQL_SYNTAX, "JPQL: " + msg, startPosition + offset, length));
}
@Override

View File

@@ -154,7 +154,7 @@ public class QueryJdtAstReconciler implements JdtAstReconciler {
@Override
public ProblemType getProblemType() {
return QueryProblemType.EXPRESSION_SYNTAX;
return QueryProblemType.JPQL_SYNTAX;
}
}

View File

@@ -19,7 +19,9 @@ import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemTy
public enum QueryProblemType implements ProblemType {
EXPRESSION_SYNTAX(ERROR, "Syntax", "Query Expression Syntax");
JPQL_SYNTAX(ERROR, "Syntax", "JPQL Query Syntax"),
HQL_SYNTAX(ERROR, "Syntax", "HQL Query Syntax"),
SQL_SYNTAX(ERROR, "Syntax", "SQL Query Syntax");
private final ProblemSeverity defaultSeverity;
private String description;
@@ -64,7 +66,7 @@ public enum QueryProblemType implements ProblemType {
@Override
public ProblemCategory getCategory() {
return SpringProblemCategories.JPQL;
return SpringProblemCategories.DATA_QUERY;
}
}

View File

@@ -62,7 +62,7 @@ public class SqlReconciler implements Reconciler {
offset = token.getStartIndex() - token.getCharPositionInLine();
length = token.getCharPositionInLine() + 1;
}
problemCollector.accept(new ReconcileProblemImpl(QueryProblemType.EXPRESSION_SYNTAX, "SQL: " + msg, startPosition + offset, length));
problemCollector.accept(new ReconcileProblemImpl(QueryProblemType.SQL_SYNTAX, "SQL: " + msg, startPosition + offset, length));
}
@Override

View File

@@ -388,5 +388,39 @@
"defaultSeverity": "WARNING"
}
]
},
{
"id": "data-query",
"label": "Data Query",
"toggle": {
"label": "Enablement",
"values": [
"OFF",
"ON"
],
"preferenceKey": "boot-java.validation.data-query",
"defaultValue": "ON"
},
"order": 8,
"problemTypes": [
{
"code": "JPQL_SYNTAX",
"label": "JPQL Query Syntax",
"description": "Syntax",
"defaultSeverity": "ERROR"
},
{
"code": "HQL_SYNTAX",
"label": "HQL Query Syntax",
"description": "Syntax",
"defaultSeverity": "ERROR"
},
{
"code": "SQL_SYNTAX",
"label": "SQL Query Syntax",
"description": "Syntax",
"defaultSeverity": "ERROR"
}
]
}
]

View File

@@ -30,6 +30,7 @@ import org.springframework.ide.vscode.boot.java.Boot2JavaProblemType;
import org.springframework.ide.vscode.boot.java.Boot3JavaProblemType;
import org.springframework.ide.vscode.boot.java.SpelProblemType;
import org.springframework.ide.vscode.boot.java.SpringAotJavaProblemType;
import org.springframework.ide.vscode.boot.java.data.jpa.queries.QueryProblemType;
import org.springframework.ide.vscode.boot.properties.reconcile.ApplicationPropertiesProblemType;
import org.springframework.ide.vscode.boot.validation.generations.preferences.VersionValidationProblemType;
import org.springframework.ide.vscode.boot.yaml.reconcile.ApplicationYamlProblemType;
@@ -177,6 +178,7 @@ public class ProblemTypesToJson {
writer.collectProblemTypeData(Boot3JavaProblemType.values());
writer.collectProblemTypeData(SpringAotJavaProblemType.values());
writer.collectProblemTypeData(VersionValidationProblemType.values());
writer.collectProblemTypeData(QueryProblemType.values());
Collections.sort(writer.problemCategories);

View File

@@ -1146,6 +1146,58 @@
]
}
}
},
{
"id": "data-query",
"title": "Data Query",
"order": 408,
"properties": {
"boot-java.validation.data-query": {
"type": "string",
"default": "ON",
"description": "Enablement",
"enum": [
"OFF",
"ON"
]
},
"spring-boot.ls.problem.data-query.JPQL_SYNTAX": {
"type": "string",
"default": "ERROR",
"description": "Syntax",
"enum": [
"IGNORE",
"INFO",
"WARNING",
"HINT",
"ERROR"
]
},
"spring-boot.ls.problem.data-query.HQL_SYNTAX": {
"type": "string",
"default": "ERROR",
"description": "Syntax",
"enum": [
"IGNORE",
"INFO",
"WARNING",
"HINT",
"ERROR"
]
},
"spring-boot.ls.problem.data-query.SQL_SYNTAX": {
"type": "string",
"default": "ERROR",
"description": "Syntax",
"enum": [
"IGNORE",
"INFO",
"WARNING",
"HINT",
"ERROR"
]
}
}
}
],
"grammars": [