@lark-apaas/miaoda-cli 0.1.19-beta.6a5cefe → 0.1.20-alpha.504be27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -411,6 +411,19 @@ const ISO_TIMESTAMP_RE = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?
|
|
|
411
411
|
const SYNTAX_RE = /syntax error at or near "([^"]+)"/i;
|
|
412
412
|
const RELATION_RE = /relation "([^"]+)" does not exist/i;
|
|
413
413
|
const COLUMN_RE = /column "([^"]+)"(?: of relation "([^"]+)")? does not exist/i;
|
|
414
|
+
const KEYWORD_TYPO_IGNORE_WORDS = new Set([
|
|
415
|
+
// Legal PostgreSQL terms that are not useful keyword typo candidates.
|
|
416
|
+
'ROW',
|
|
417
|
+
'LEVEL',
|
|
418
|
+
'SECURITY',
|
|
419
|
+
// Common index access methods used after `USING`.
|
|
420
|
+
'BTREE',
|
|
421
|
+
'HASH',
|
|
422
|
+
'GIST',
|
|
423
|
+
'SPGIST',
|
|
424
|
+
'GIN',
|
|
425
|
+
'BRIN',
|
|
426
|
+
]);
|
|
414
427
|
/**
|
|
415
428
|
* 在错误抛出前富化 next_actions(最多 1 条 hint),按 PG 报错形态分发:
|
|
416
429
|
*
|
|
@@ -540,6 +553,8 @@ function findKeywordTypo(sql) {
|
|
|
540
553
|
const upper = tok.toUpperCase();
|
|
541
554
|
if (sql_keywords_1.SQL_KEYWORDS.includes(upper))
|
|
542
555
|
continue; // 写对的关键字
|
|
556
|
+
if (KEYWORD_TYPO_IGNORE_WORDS.has(upper))
|
|
557
|
+
continue;
|
|
543
558
|
const guess = (0, fuzzy_match_1.suggest)(upper, sql_keywords_1.SQL_KEYWORDS);
|
|
544
559
|
if (guess && guess !== upper) {
|
|
545
560
|
return { input: tok, suggest: guess };
|