Browse Source

HUE-7626 [editor] Fix issue where incorrect keywords were no longer marked by the syntax checker

Johan Ahlen 8 years ago
parent
commit
2f1d0b8b00

+ 10 - 12
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -3702,17 +3702,15 @@
           if (hueDebug.showSyntaxParseResult) {
           if (hueDebug.showSyntaxParseResult) {
             console.log(e.data.syntaxError);
             console.log(e.data.syntaxError);
           }
           }
-          if (!e.data.syntaxError.incompleteStatement) {
-            var token = self.editor.getSession().getTokenAt(e.data.syntaxError.loc.first_line - 1, e.data.syntaxError.loc.first_column + 1);
-            // If no token is found it likely means that the parserresponse came back after the text was changed,
-            // at which point it will trigger another parse so we can ignore this.
-            if (token) {
-              token.syntaxError = e.data.syntaxError;
-              var AceRange = ace.require('ace/range').Range;
-              var range = new AceRange(e.data.syntaxError.loc.first_line - 1, e.data.syntaxError.loc.first_column, e.data.syntaxError.loc.last_line - 1, e.data.syntaxError.loc.first_column + e.data.syntaxError.text.length);
-              var markerId = self.editor.getSession().addMarker(range, 'hue-ace-syntax-error');
-              self.editor.getSession().$backMarkers[markerId].token = token;
-            }
+          var token = self.editor.getSession().getTokenAt(e.data.syntaxError.loc.first_line - 1, e.data.syntaxError.loc.first_column + 1);
+          // If no token is found it likely means that the parser response came back after the text was changed,
+          // at which point it will trigger another parse so we can ignore this.
+          if (token) {
+            token.syntaxError = e.data.syntaxError;
+            var AceRange = ace.require('ace/range').Range;
+            var range = new AceRange(e.data.syntaxError.loc.first_line - 1, e.data.syntaxError.loc.first_column, e.data.syntaxError.loc.last_line - 1, e.data.syntaxError.loc.first_column + e.data.syntaxError.text.length);
+            var markerId = self.editor.getSession().addMarker(range, 'hue-ace-syntax-error');
+            self.editor.getSession().$backMarkers[markerId].token = token;
           }
           }
         }
         }
       });
       });
@@ -4485,7 +4483,7 @@
                     contextTooltip.show(tooltipText, endCoordinates.pageX, endCoordinates.pageY + editor.renderer.lineHeight + 3);
                     contextTooltip.show(tooltipText, endCoordinates.pageX, endCoordinates.pageY + editor.renderer.lineHeight + 3);
                   }
                   }
                 }, 500);
                 }, 500);
-              } else if (token !== null && token.syntaxError && !token.syntaxError.incompleteStatement) {
+              } else if (token !== null && token.syntaxError) {
                 tooltipTimeout = window.setTimeout(function () {
                 tooltipTimeout = window.setTimeout(function () {
                   // TODO: i18n
                   // TODO: i18n
                   if (token.syntaxError) {
                   if (token.syntaxError) {

+ 1 - 1
desktop/core/src/desktop/static/desktop/spec/autocomplete/solrQueryParserSpec.js

@@ -61,7 +61,7 @@
       });
       });
     });
     });
 
 
-    fit('should suggest values for "field:"a|"', function () {
+    it('should suggest values for "field:"a|"', function () {
       testAutocomplete('field:"a', '', {
       testAutocomplete('field:"a', '', {
         suggestValues: { field: 'field', quotePresent: true }
         suggestValues: { field: 'field', quotePresent: true }
       });
       });