@ -123,7 +123,7 @@ function getStreamSelectorPositions(query: string): Position[] {
const tree = parser . parse ( query ) ;
const positions : Position [ ] = [ ] ;
tree . iterate ( {
enter : ( type , from , to , get ) : false | void = > {
enter : ( { type , from , to } ) : false | void = > {
if ( type . name === 'Selector' ) {
positions . push ( { from , to } ) ;
return false ;
@ -141,7 +141,7 @@ export function getParserPositions(query: string): Position[] {
const tree = parser . parse ( query ) ;
const positions : Position [ ] = [ ] ;
tree . iterate ( {
enter : ( type , from , to , get ) : false | void = > {
enter : ( { type , from , to } ) : false | void = > {
if ( type . name === 'LabelParser' || type . name === 'JsonExpressionParser' ) {
positions . push ( { from , to } ) ;
return false ;
@ -159,8 +159,8 @@ export function getLabelFilterPositions(query: string): Position[] {
const tree = parser . parse ( query ) ;
const positions : Position [ ] = [ ] ;
tree . iterate ( {
enter : ( typ e, from , to , get ) : false | void = > {
if ( type . name === 'LabelFilter' ) {
enter : ( { nam e, from , to } ) : false | void = > {
if ( name === 'LabelFilter' ) {
positions . push ( { from , to } ) ;
return false ;
}
@ -177,9 +177,9 @@ function getLineFiltersPositions(query: string): Position[] {
const tree = parser . parse ( query ) ;
const positions : Position [ ] = [ ] ;
tree . iterate ( {
enter : ( type , from , to , get ) : false | void = > {
if ( typ e. name === 'LineFilters' ) {
positions . push ( { from , to } ) ;
enter : ( { node } ) : false | void = > {
if ( nod e. name === 'LineFilters' ) {
positions . push ( { from : node . from , to : node. to } ) ;
return false ;
}
} ,
@ -195,28 +195,28 @@ function getLogQueryPositions(query: string): Position[] {
const tree = parser . parse ( query ) ;
const positions : Position [ ] = [ ] ;
tree . iterate ( {
enter : ( typ e, from , to , get ) : false | void = > {
if ( type . name === 'LogExpr' ) {
enter : ( { nam e, from , to , node } ) : false | void = > {
if ( name === 'LogExpr' ) {
positions . push ( { from , to } ) ;
return false ;
}
// This is a case in metrics query
if ( type . name === 'LogRangeExpr' ) {
if ( name === 'LogRangeExpr' ) {
// Unfortunately, LogRangeExpr includes both log and non-log (e.g. Duration/Range/...) parts of query.
// We get position of all log-parts within LogRangeExpr: Selector, PipelineExpr and UnwrapExpr.
const logPartsPositions : Position [ ] = [ ] ;
const selector = get ( ) . getChild ( 'Selector' ) ;
const selector = node . getChild ( 'Selector' ) ;
if ( selector ) {
logPartsPositions . push ( { from : selector . from , to : selector.to } ) ;
}
const pipeline = get ( ) . getChild ( 'PipelineExpr' ) ;
const pipeline = node . getChild ( 'PipelineExpr' ) ;
if ( pipeline ) {
logPartsPositions . push ( { from : pipeline . from , to : pipeline.to } ) ;
}
const unwrap = get ( ) . getChild ( 'UnwrapExpr' ) ;
const unwrap = node . getChild ( 'UnwrapExpr' ) ;
if ( unwrap ) {
logPartsPositions . push ( { from : unwrap . from , to : unwrap.to } ) ;
}
@ -359,7 +359,7 @@ function getLineCommentPositions(query: string): Position[] {
const tree = parser . parse ( query ) ;
const positions : Position [ ] = [ ] ;
tree . iterate ( {
enter : ( type , from , to , get ) : false | void = > {
enter : ( { type , from , to } ) : false | void = > {
if ( type . id === LineComment ) {
positions . push ( { from , to } ) ;
return false ;