Skip to content

Feature Request: Syntax Highlight 'script:' and 'shell:' blocks as scripts #7

Open
@MillironX

Description

@MillironX

It would be extremely helpful to have script and shell blocks syntax highlighted in the proper language rather than as string literals.

Expected Behavior

Multi-line strings at the end of a process, those within an if block, and those marked as script: or shell: should have syntax highlighting matching their language. Without any label, these should be highlighted as a shell script, but a shebang would change the highlighting of that block to match the indicated language (e.g. a block starting with #!/usr/bin/env perl would receive Perl syntax highlighting). In the case of a shell block, the ! variable placeholder should receive variable highlighting distinct from the target language.

Current Behavior

End-process strings, script blocks and shell blocks are all highlighted as string literals. The only highlighting that takes place within these blocks occurs when using curly bracket variable syntax (i.e. ${var}). No distinction is made at all for the ! variable placeholder regardless of curly brackets.

Possible Implementation

A short-term fix would be to replace multi-line strings with shellscript as an embedded language. This would impede the use of multi-line strings elsewhere, but IMHO this tradeoff is worth it. This wouldn't allow for changing the language based on shebang, though.

In the longer-term, semantic highlighting might be able to highlight blocks according to shebang, and parse which are simple multi-line strings and which are code.

I don't know how/if DSL2 affects this behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions