Daniel Shahaf wrote on Sat, Dec 21, 2019 at 11:09:39 +0000:
>    * What was the outcome of this action?
> 
> When the file iota is viewed with «set filetype=foo», the words "lorem
> ipsum" on line 1 are not highlighted.
> 
>    * What outcome did you expect instead?
> 
> I expected those two words on line 1 to be highlighted (via the chain
> TOP -> fooBlock -> @bar -> barBlock -> barKeyword).
> 
> I note that if contains=TOP is either removed, or changed to
> contains=@bar, then the words on line 1 do get highlighted.  However,
> either of these changes would break the highlighting of ft=bar files.

Changing contains=TOP to contains=barKeyword also causes the words on
line 1 to be highlighted.  Since «:help syn-contains» defines "TOP" as
"all groups that aren't 'contained'", and barKeyword isn't 'contained',
I would have expected contains=TOP to imply contains=barKeyword.

> It seems to me that when «contains=TOP» is encountered in a
> :syn-include'd file, it's taken as a reference to the actual top-level,
> i.e., the top of foo.vim, rather than as a reference to the top of the
> included syntax's scope, i.e., the syntax match or region that did
> «contains=@bar».

According to syntax.c:in_id_list(), "TOP" is indeed supposed to only
accept groups that are defined in the same file (i.e., bar.vim).

Cheers,

Daniel

Reply via email to