Your message dated Sat, 20 Aug 2022 10:50:42 -0400
with message-id <20220820145042.pixrikwtqzvvnglq@localhost>
and subject line Re: Bug#947120: vim-nox: :syn contains=TOP inside a 
:syn-include'd file refers to the outer file
has caused the Debian Bug report #947120,
regarding vim-nox: :syn contains=TOP inside a :syn-include'd file refers to the 
outer file
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
947120: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=947120
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: vim-nox
Version: 2:8.1.2269-1
Severity: normal
Tags: upstream

Dear Maintainer,

   * What led up to the situation?

I wanted to write a custom syntax file that includes another syntax file.

(Specifically, I wanted to write a syntax filefor zsh's test suite, and
have it include the zsh syntax file shipped with Vim itself.  zsh's test
suite consists of test cases, that should be highlighted as zsh scripts,
plus metadata such as the expected exit code, which would be highlighted
by the custom syntax file I was writing.)

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

To cut a long story short, here's a minimal example:

        % head -999 .vim/syntax/foo.vim .vim/syntax/bar.vim iota
        ==> .vim/syntax/foo.vim <==
        if exists("b:current_syntax")
          finish
        endif

        syntax clear
        syntax include @bar <sfile>:p:h/bar.vim
        unlet b:current_syntax
        syntax region fooBlock start=/^\s/ end=/$/ contains=@bar

        let b:current_syntax = "foo"

        ==> .vim/syntax/bar.vim <==
        if exists("b:current_syntax")
          finish
        endif

        syntax clear
        syntax region barBlock matchgroup=barBraces start=+{+ end=+}+ 
transparent contains=TOP
        syntax keyword barKeyword lorem ipsum

        hi def link barBraces  Special
        hi def link barKeyword Keyword

        let b:current_syntax = "bar"

        ==> iota <==
          { lorem ipsum dolor sit amet }
          lorem ipsum dolor sit amet
        % 

(For orientation, in this example foo.vim stands for my custom syntax,
bar.vim stands for $VIMRUNTIME/syntax/zsh.vim, barBlock corresponds to
zshBrackets, and barKeyword corresponds to the zsh.vim syntax rules
responsible for highlighting, say, the «cd» and «$0» in «{ cd $0 }».)

   * 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.

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».

Cheers,

Daniel


-- Package-specific info:

(Freshly-created, up-to-date sid chroot with default settings.)

--- End Message ---
--- Begin Message ---
Version: 2:8.2.3455-1

On Sat, Dec 21, 2019 at 11:09:39AM +0000, Daniel Shahaf wrote:
> I wanted to write a custom syntax file that includes another syntax file.
> 
> (Specifically, I wanted to write a syntax filefor zsh's test suite, and
> have it include the zsh syntax file shipped with Vim itself.  zsh's test
> suite consists of test cases, that should be highlighted as zsh scripts,
> plus metadata such as the expected exit code, which would be highlighted
> by the custom syntax file I was writing.)

This was fixed by 8.2.2761.

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB

--- End Message ---

Reply via email to