[TxMt] Re: Included shell grammar until EOF

Allan Odgaard mailinglist at textmate.org
Mon Jul 14 16:01:37 UTC 2014


On 11 Jul 2014, at 11:01, Stefan Daschek wrote:

> […] have a block like:
>
> ```shell
> dd bs=1m if=foo.img of=/dev/disk1
> ```
>
> Here, “if” starts the scope “meta.scope.if-block.shell”, and 
> this scope extends beyond the ``` the end of the fenced code block, 
> resulting in incorrect highlighting for the rest of the markdown file.
>
> Is there a way to include grammars in a way making sure the included 
> grammar does not extend beyond the “end marker” in any case?

This is not possible. There are probably enough use-cases to justify 
adding new syntax for this, so I’ll add it to the list of potential 
future improvements.

> And: Could the rule for if-blocks in the shellscript bundle be more 
> strict (matching only '^\s*if\b' for example)? Is this rule needed at 
> all? (I haven’t found any other references to the scope 
> “if-block” in the shellscript bundle.)

I think it could, best way to figure out is to make the change, test it, 
and submit a PR if you do not see any issues :)

Be sure not to assign any scope beyond meta.* to potentially matched 
leading whitespace.


More information about the textmate mailing list