소스 검색

Explore: do not show default suggestions after expressions

- an expression ends on closing braces
- exclude expressions from the default/empty suggestions
David Kaltschmidt 7 년 전
부모
커밋
6260a6d2f3
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      public/app/features/explore/PromQueryField.tsx

+ 4 - 4
public/app/features/explore/PromQueryField.tsx

@@ -308,10 +308,10 @@ class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryF
     } else if (_.includes(wrapperClasses, 'context-aggregation')) {
       return this.getAggregationTypeahead.apply(this, arguments);
     } else if (
-      // Non-empty but not inside known token
-      (prefix && !tokenRecognized) ||
-      (prefix === '' && !text.match(/^[)\s]+$/)) || // Empty context or after ')'
-      text.match(/[+\-*/^%]/) // After binary operator
+      // Show default suggestions in a couple of scenarios
+      (prefix && !tokenRecognized) || // Non-empty prefix, but not inside known token
+      (prefix === '' && !text.match(/^[\]})\s]+$/)) || // Empty prefix, but not following a closing brace
+      text.match(/[+\-*/^%]/) // Anything after binary operator
     ) {
       return this.getEmptyTypeahead();
     }