浏览代码

HUE-7643 [editor] Only mark syntax errors for which there are suggestions

Johan Ahlen 8 年之前
父节点
当前提交
c847e5a

+ 1 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/sqlParseSupport.js

@@ -1888,6 +1888,7 @@ var SqlParseSupport = (function () {
 
     var IGNORED_EXPECTED = {
       ';': true,
+      '.': true,
       'EOF': true,
       'UNSIGNED_INTEGER': true,
       'UNSIGNED_INTEGER_E': true,

+ 6 - 0
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -3713,6 +3713,12 @@
           return;
         }
         self.clearMarkedErrors('error');
+
+        if (!e.data.syntaxError || !e.data.syntaxError.expected || e.data.syntaxError.expected.length === 0) {
+          // Only show errors that we have suggestions for
+          return;
+        }
+
         var suppressedRules = ApiHelper.getInstance().getFromTotalStorage('hue.syntax.checker', 'suppressedRules', {});
         if (e.data.syntaxError && e.data.syntaxError.ruleId && !suppressedRules[e.data.syntaxError.ruleId.toString() + e.data.syntaxError.text.toLowerCase()]) {
           if (self.snippet.positionStatement() && SqlUtils.locationEquals(e.data.statementLocation, self.snippet.positionStatement().location)) {