[Expressions] Add support of comments (#122457)

* Add comments support to the expressions grammar
* Add typings to the interpreter parser
* Add expressions comments highlighting
* Update canvas to preserve original expression formatting
* Update documentation to cover comments
This commit is contained in:
Michael Dokolin 2022-01-20 20:46:52 +01:00 committed by GitHub
parent 022a9efa5e
commit 6ae646722b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 644 additions and 272 deletions

View file

@ -6,7 +6,7 @@
*/
import { cloneDeep, mergeWith } from 'lodash';
import { fromExpression, toExpression, Ast, ExpressionFunctionAST } from '@kbn/interpreter';
import { fromExpression, toExpression, Ast, AstFunction } from '@kbn/interpreter';
import {
SavedObjectMigrationMap,
SavedObjectMigrationFn,
@ -141,7 +141,7 @@ const removeLensAutoDate: SavedObjectMigrationFn<LensDocShapePre710, LensDocShap
}
try {
const ast = fromExpression(expression);
const newChain: ExpressionFunctionAST[] = ast.chain.map((topNode) => {
const newChain: AstFunction[] = ast.chain.map((topNode) => {
if (topNode.function !== 'lens_merge_tables') {
return topNode;
}
@ -202,7 +202,7 @@ const addTimeFieldToEsaggs: SavedObjectMigrationFn<LensDocShapePre710, LensDocSh
try {
const ast = fromExpression(expression);
const newChain: ExpressionFunctionAST[] = ast.chain.map((topNode) => {
const newChain: AstFunction[] = ast.chain.map((topNode) => {
if (topNode.function !== 'lens_merge_tables') {
return topNode;
}