mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tempo: Support comments in TraceQL (#77646)
This commit is contained in:
@@ -76,6 +76,10 @@ describe('Check for syntax errors in query', () => {
|
||||
['{true} << {true}'],
|
||||
['{true} !>> {true}'],
|
||||
['{true} !<< {true}'],
|
||||
[
|
||||
`{ true } /* && { false } && */ && { true } // && { false }
|
||||
&& { true }`,
|
||||
],
|
||||
])('valid query - %s', (query: string) => {
|
||||
expect(getErrorNodes(query)).toStrictEqual([]);
|
||||
});
|
||||
|
||||
@@ -63,6 +63,10 @@ export const language: languages.IMonarchLanguage = {
|
||||
|
||||
tokenizer: {
|
||||
root: [
|
||||
// comments
|
||||
[/\/\/.*/, 'comment'], // line comment
|
||||
[/\/\*.*\*\//, 'comment'], // block comment
|
||||
|
||||
// durations
|
||||
[/[0-9]+(.[0-9]+)?(us|µs|ns|ms|s|m|h)/, 'number'],
|
||||
|
||||
@@ -138,7 +142,7 @@ export const languageDefinition = {
|
||||
|
||||
export const traceqlGrammar: Grammar = {
|
||||
comment: {
|
||||
pattern: /#.*/,
|
||||
pattern: /\/\/.*/,
|
||||
},
|
||||
'span-set': {
|
||||
pattern: /\{[^}]*}/,
|
||||
|
||||
Reference in New Issue
Block a user