@elastic/monaco-esql
Version:
Monaco editor Monarch language syntax definitions for ES|QL
37 lines (36 loc) • 1.84 kB
TypeScript
import type { languages } from "monaco-editor";
/**
* In order to handle the PROMQL command we need to solve two problems:
* 1. Detect when the params section ends and the query starts, so we can apply the promql query embedding.
* For this we tokenize the params section with dedicated states, before delegating to the promql query embedding.
*
* 2. We need to correctly tokenize ES|QL comments syntax within a promql query.
* For this we use the promQLQuery state, which is applied while tokenizing the query content.
* It will tell the embedded language when the query ends (when a pipe is found).
* And will switch to dedicated states for handling comments.
*/
/** Main state for PROMQL command. */
export declare const promQLCommand: languages.IMonarchLanguageRule[];
/**
* State to tokenize param name, then switch to value
*/
export declare const promqlParam: languages.IMonarchLanguageRule[];
/**
* State to parse param values.
* The way of detecting a param value ended is by detecting whitespaces that are not followed by a comma.
* Example of a value that contains a list of indexes: index-*, `index`, index::selector, ?param, "index"
*/
export declare const promqlParamValue: languages.IMonarchLanguageRule[];
/**
* These rules are applied while tokenizing the query content (inside the embedding language).
* They run "in parallel" with the rules from the embedded language.
* We use them the tell the embedded language when the query ends (when a pipe is found).
* And to be able to tokenize ES|QL comments within the PROMQL query.
*/
export declare const promQLQuery: languages.IMonarchLanguageRule[];
/**
* All PromQL tokenizer states needed to tokenize a PROMQL command bundled in one object.
*/
export declare const promQLStates: {
[name: string]: languages.IMonarchLanguageRule[];
};