Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: support statement.syntax errors (#4461)

Liu Jid9ffe66df491
diff --git a/frontend/src/components/Issue/logic/useSQLAdviceMarkers.ts b/frontend/src/components/Issue/logic/useSQLAdviceMarkers.ts
index d8a94b1876..505f95ecb9 100644
--- a/frontend/src/components/Issue/logic/useSQLAdviceMarkers.ts
+++ b/frontend/src/components/Issue/logic/useSQLAdviceMarkers.ts
@@ -1,7 +1,7 @@
import { computed } from "vue";
import { maxBy } from "lodash-es";
-import type { Task } from "@/types";
+import type { Task, TaskCheckRun, TaskCheckType } from "@/types";
import type { AdviceOption } from "@/components/MonacoEditor";
import { useIssueLogic } from ".";
@@ -11,31 +11,39 @@ export const useSQLAdviceMarkers = () => {
if (create.value) return [];
const task = selectedTask.value as Task;
- const advices = task.taskCheckRunList.filter(
- (check) => check.type === "bb.task-check.database.statement.advise"
+ const types: TaskCheckType[] = [
+ "bb.task-check.database.statement.advise",
+ "bb.task-check.database.statement.syntax",
+ ];
+ return types.flatMap((type) =>
+ getLatestAdviceOptions(
+ task.taskCheckRunList.filter((check) => check.type === type)
+ )
);
- const latest = maxBy(advices, (advice) => advice.id);
- if (!latest) {
- return [];
- }
-
- const { resultList = [] } = latest.result;
- return resultList
- .filter((result) => result.status === "ERROR" || result.status === "WARN")
- .filter((result) => result.line !== undefined)
- .map<AdviceOption>((result) => {
- return {
- severity: result.status === "ERROR" ? "ERROR" : "WARNING",
- message: result.content,
- source: `${result.title} (${result.code})`,
- startLineNumber: result.line! + 1,
- // We don't know the actual column yet, so we show the marker at then end of the line
- startColumn: Number.MAX_SAFE_INTEGER,
- endLineNumber: result.line! + 1,
- // We don't know the actual column yet, so we show the marker at then end of the line
- endColumn: Number.MAX_SAFE_INTEGER,
- };
- });
});
return { markers };
};
+
+const getLatestAdviceOptions = (taskCheckRunList: TaskCheckRun[]) => {
+ const latest = maxBy(taskCheckRunList, (advice) => advice.id);
+ if (!latest) {
+ return [];
+ }
+ const { resultList = [] } = latest.result;
+ return resultList
+ .filter((result) => result.status === "ERROR" || result.status === "WARN")
+ .filter((result) => result.line !== undefined)
+ .map<AdviceOption>((result) => {
+ return {
+ severity: result.status === "ERROR" ? "ERROR" : "WARNING",
+ message: result.content,
+ source: `${result.title} (${result.code})`,
+ startLineNumber: result.line!,
+ // We don't know the actual column yet, so we show the marker at then end of the line
+ startColumn: Number.MAX_SAFE_INTEGER,
+ endLineNumber: result.line!,
+ // We don't know the actual column yet, so we show the marker at then end of the line
+ endColumn: Number.MAX_SAFE_INTEGER,
+ };
+ });
+};