Open ninoslavmiskovic opened 1 month ago
Pinging @elastic/kibana-esql (Team:ESQL)
Looked into this a bit. Monaco gathers tokens line-by-line, it does not look across lines by default. In other words, when it gathers tokens for line 6, it has "forgotten" that it saw the start of a comment on line 5.
The way to make it remember things between lines is to record them in the state.
In this case, we should be recording that the tokenizer has seen an opening /*
and no closing */
yet.
Maybe blocked on https://github.com/elastic/elasticsearch/issues/115483
I have a working PoC: https://github.com/elastic/kibana/pull/197545. But it currently relies on changes to the ANTLR lexer which would need to be submitted to the Elasticsearch repo. This seems like the correct way to do it. However, we might be able to hack something together on our side as well. I have added an agenda item to dev sync tomorrow to discuss.
We had a good discussion. @vadimkibana pointed out that it would be nice to have a more generic solution than I currently have in https://github.com/elastic/kibana/pull/197545 because right now highlighting can be broken for any lexical token that spans multiple lines, not just multi-line comments.
We discussed the running the lexer on the entire query while still providing tokens to Monaco on a line-by-line basis. This would remove the need to improve lexing for incomplete queries. We will do some investigation at some point to see if this is a possibility.
The ES|QL editor (as seen in version 9.0.0) does not properly display multi-line comments. The issue involves comment blocks (/ ... /) where the content is not rendered clearly, possibly leading to formatting or readability issues.
Steps to Reproduce:
Expected Behavior: The multi-line comment should be fully visible and displayed in a block format, without any truncation or rendering issues.
Actual Behavior: As seen in the attached screenshot, the multi-line comment appears misaligned or is not fully rendered, making it difficult to read the entire comment block.
Kibana version: 9.0.0