mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
remove string constant and use ids provided in lezer-promql library (#53180)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { parser } from 'lezer-promql';
|
||||
import { parser, VectorSelector } from 'lezer-promql';
|
||||
|
||||
import { PromQueryModeller } from './querybuilder/PromQueryModeller';
|
||||
import { buildVisualQueryFromString } from './querybuilder/parsing';
|
||||
@@ -45,7 +45,7 @@ function getVectorSelectorPositions(query: string): VectorSelectorPosition[] {
|
||||
const positions: VectorSelectorPosition[] = [];
|
||||
tree.iterate({
|
||||
enter: (type, from, to, get): false | void => {
|
||||
if (type.name === 'VectorSelector') {
|
||||
if (type.id === VectorSelector) {
|
||||
const visQuery = buildVisualQueryFromString(query.substring(from, to));
|
||||
positions.push({ query: visQuery.query, from, to });
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user