I have a bug and I can't figure out the solution. Perhaps you esteemed folk can be of aid.
I want to extend a syntax file (julia syntax in polyglot package). I want to include the following patterns
"\::\zs\w*\ze" "\^\s*function \zs\w*\ze\("
The first is intended to match words following ::. The second is intended to match the function name foo in an expression like
In my .vim/after/syntax/julia.vim, I write
syntax match juliaCustomType "\v::\zs\w*\ze" display syntax match juliaFunctionName "\v^\s*function \zs.*\ze\(" display highlight def link juliaCustomType Constant highlight def link juliaFunctionName Function
And this works if I disable vim-polyglot and the julia-vim packages, the ones providing julia syntax support. If I add either of them back, it no longer works.
I add both the custom groups to the relevant syntax cluster
juliaExpressions, which is the one that is allowed to be contained in other regions everywhere. I check this by making a mock syn match like this
syntax match juliaCustomType "foobar" and see that it highlights inside syntax regions.
Now if I remove
\ze from the
::matching, it works but highlights the :: which I don't want. The second expression, I believe has some problems because of how
function is handled in this line from the package syntax file:
let s:nodot = '\%(\.\)\@'.s:d(1).'1<!' exec 'syntax region juliaFunctionBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<function\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
But I can't for the life of me figure out what the problem is. Any help or suggestions are welcome!