Saturday, September 3, 2011

Re: Syntax file contains/containedin not respected.

On Thu, Aug 25, 2011 at 4:29 AM, Christophe Eymard
<christophe.eymard@ravelsoft.com> wrote:
>>
>> I have tried your syntax file, and it behaves as expected.
>> Here is the one I made. It has the problem I described.
>
> The conflicting rule is coContext ; this is the one I want applied, yet the
> javaScriptDocTags, while being "contained" still wins over it.
>

I think the problem is here:

" Reserved words can be used as property keys.
syntax match coKey /\%(\.\@<!\.\s+\|[]})@]\|::\)\i\+/
\ transparent contains=ALLBUT,@coReserved
\ ,coReservedError

Note that coKey contains everything except for the coReserved cluster
and the coReservedError group. This means javaScriptDocTags is
contained in coKey.

coKey matches at the @return outside the comment in the test file.

I have the following in my .vimrc which helps me debug such things:

" show highlight groups under cursor with F10
if exists(':for')
nmap <F10>
\ :echo
'<'.synIDattr(synIDtrans(synID(line('.'),col('.'),1)),'name').'>
from:' <bar>
\ let indent = '' <bar>
\ for syn_id in synstack(line('.'), col('.')) <bar>
\ echo indent.'<'.synIDattr(syn_id,"name").'>' <bar>
\ let indent .= ' ' <bar>
\ endfor <bar>
\ unlet indent<CR>
else
" can't do for loop, at least display something
nmap <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name")
\ . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
endif

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment