From 41375d7099c9118998619a31563b743221087517 Mon Sep 17 00:00:00 2001 From: Marco Liberati Date: Thu, 21 Dec 2023 15:56:05 +0100 Subject: [PATCH] [ES|QL] Fix highlight for multiline #2 (#173827) ## Summary ![esql_syntax_fix](https://github.com/elastic/kibana/assets/924948/263e8cfd-3325-4a28-903f-d55dbb3dfeae) --- .../kbn-monaco/src/esql/lib/monaco/esql_tokens_provider.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/kbn-monaco/src/esql/lib/monaco/esql_tokens_provider.ts b/packages/kbn-monaco/src/esql/lib/monaco/esql_tokens_provider.ts index aa0234c155c33..ce521d1c9dfac 100644 --- a/packages/kbn-monaco/src/esql/lib/monaco/esql_tokens_provider.ts +++ b/packages/kbn-monaco/src/esql/lib/monaco/esql_tokens_provider.ts @@ -57,7 +57,12 @@ export class ESQLTokensProvider implements monaco.languages.TokensProvider { const tokenTypeName = lexer.vocabulary.getSymbolicName(token.type); if (tokenTypeName) { - const myToken = new ESQLToken(tokenTypeName, token.startIndex, token.stopIndex); + const indexOffset = cleanedLine === line ? 0 : line.length - cleanedLine.length; + const myToken = new ESQLToken( + tokenTypeName, + token.startIndex + indexOffset, + token.stopIndex + indexOffset + ); myTokens.push(myToken); } }