Describe the issue
In the flow code editor, the content of a multi-line string (a block starting with | or >) should be shown as plain text, because Kestra cannot know which language it contains.
Today this is inconsistent. The content stays plain as long as all its lines have the same indentation. As soon as one line is indented more than the first line of the block, that line and the following ones are highlighted as YAML.
The file name and the task type make no difference. An Ansible playbook, a .txt file or a Python script with the same content are highlighted the same way.
Steps to reproduce
- Create this flow and open it in the flow code editor:
id: block_highlighting
namespace: company.team
tasks:
- id: same_indent
type: io.kestra.plugin.scripts.shell.Commands
commands:
- echo hi
inputFiles:
other.yml: |
hosts: localhost
gather_facts: false
- id: deeper_indent
type: io.kestra.plugin.scripts.shell.Commands
commands:
- echo hi
inputFiles:
playbook.yml: |
- name: Output JSON to logs
hosts: localhost
gather_facts: false
- id: python
type: io.kestra.plugin.scripts.python.Script
script: |
for i in range(3):
print(i)
config: 1
- Look at the three blocks.
Actual behaviour
same_indent: the block is plain text. This is correct.
deeper_indent: hosts and gather_facts are highlighted as YAML keys, and false as a boolean.
python: the lines after print(i) are highlighted as YAML.
Expected behaviour
- The whole content of a
| or > block is shown as plain text, whatever its indentation, until the block ends.
- The block ends where YAML says it ends: at the first non-empty line indented less than the first line of the block. From there, normal YAML highlighting continues.
- Everything outside the block keeps its current highlighting.
Environment
Kestra Version: develop (2.1.0-SNAPSHOT)
Edition: OSS
Describe the issue
In the flow code editor, the content of a multi-line string (a block starting with
|or>) should be shown as plain text, because Kestra cannot know which language it contains.Today this is inconsistent. The content stays plain as long as all its lines have the same indentation. As soon as one line is indented more than the first line of the block, that line and the following ones are highlighted as YAML.
The file name and the task type make no difference. An Ansible playbook, a
.txtfile or a Python script with the same content are highlighted the same way.Steps to reproduce
Actual behaviour
same_indent: the block is plain text. This is correct.deeper_indent:hostsandgather_factsare highlighted as YAML keys, andfalseas a boolean.python: the lines afterprint(i)are highlighted as YAML.Expected behaviour
|or>block is shown as plain text, whatever its indentation, until the block ends.Environment
Kestra Version: develop (2.1.0-SNAPSHOT)
Edition: OSS