williaster commented on a change in pull request #4736: [Explore] Adding custom 
expressions to adhoc metrics
URL: 
https://github.com/apache/incubator-superset/pull/4736#discussion_r180897757
 
 

 ##########
 File path: 
superset/assets/javascripts/explore/components/AdhocMetricEditPopover.jsx
 ##########
 @@ -40,6 +59,22 @@ export default class AdhocMetricEditPopover extends 
React.Component {
       clearable: true,
       selectWrap: VirtualizedSelect,
     };
+    if (langTools) {
+      const words = sqlWords.concat(this.props.columns.map(column => (
+        { name: column.column_name, value: column.column_name, score: 50, 
meta: 'column' }
+      )));
+      const completer = {
+        getCompletions: (aceEditor, session, pos, prefix, callback) => {
+          callback(null, words);
+        },
+      };
+      langTools.setCompleters([completer]);
+    }
+    document.addEventListener('mouseup', this.onMouseUp);
+  }
+
+  componentWillUnmount() {
+    document.removeEventListener('mouseup', this.onMouseUp);
 
 Review comment:
   unlikely sitch, but could also call 
`document.removeEventListener('mousemove', this.onMouseMove);` to be safe

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to