rodjek / vim-puppet

Puppet niceties for your Vim setup
Apache License 2.0
501 stars 137 forks source link

Pattern type breaking highlighting #94

Closed alex-harvey-z3q closed 5 years ago

alex-harvey-z3q commented 6 years ago

I found the following code example breaks the vim syntax highlighter:

class foo (
  Pattern[/(\d+[\.$]){4}/] $ipaddr,
) {
  notice($ipaddr)
}

class { 'foo': ipaddr => '1.1.1.1.' } 

It appears in vim as:

screen shot 2018-07-02 at 7 05 43 pm
alex-harvey-z3q commented 6 years ago

I worked around it using:

class foo (
  Pattern[/(\d+[\.$]){4}/] $ipaddr, #/ # comment is to trick vim syntax highlighter.
) {
  notice($ipaddr)
}

class { 'foo': ipaddr => '1.1.1.1.' }
lelutin commented 6 years ago

I can confirm that this is happening on current master.

we probably need to add a new zone type for regular expressions

lelutin commented 6 years ago

reading the current syntax hilighting code, I somehow think that this might be the issue: the puppetInstance syntax match zone stops matching at the opening curly brace or bracket. e.g. : https://github.com/rodjek/vim-puppet/blob/master/syntax/puppet.vim#L36

so I don,t know how to fix this currently since possibly we can't have puppetInstance "contain" the syntax match puppetRegex since that would not make any sense. should we have a higher-level zone that actually contains puppetInstance and then whatever is valid for values inside brackets?

lelutin commented 5 years ago

@alexharv074 I've re-tested your case on the current master and I believe that the recent merger of the new syntax highlighting has fixed this issue!