瀏覽代碼

HUE-5085 [editor] Fix context popover for backticked identifiers

Johan Ahlen 9 年之前
父節點
當前提交
ca28774
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

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

@@ -2942,6 +2942,10 @@
           huePubSub.publish('editor.active.locations', e.data.locations);
           e.data.locations.forEach(function (location) {
             var token = editor.session.getTokenAt(location.location.first_line - 1, location.location.first_column);
+            if (/`$/.test(token.value)) {
+              // Ace getTokenAt() thinks the first ` is a token, column +1 will include the first and last.
+              token = editor.session.getTokenAt(location.location.first_line - 1, location.location.first_column + 1);
+            }
             if (token !== null) {
               if (location.type === 'column' && typeof location.tables !== 'undefined' && location.identifierChain.length === 1) {