Opinions Wanted On Changing Vim Syntax Highlighting

Hello fellow Perl (and potentially Vim) users!

There's an open issue on the vim-perl issue tracker about how the current syntax highlighting is inconsistent in how it highlights chained method calls, which currently looks like this:

 1 use strict;
 2 use warnings;
 3 use feature qw(say);
 4 
 5 $foo->bar;
 6 
 7 $foo->bar();
 8 
 9 $foo->bar->baz;
10 
11 $foo->bar()->baz;

My proposal is to remove method highlighting altogether, and per the user y's suggestion, I'm announcing it here to take the pulse of the community and see where others stand. Removing method highlighting would make the Perl syntax file easier to work with as well as potentially improve highlighting performance.

The resulting highlighting would look like this:

 1 use strict;
 2 use warnings;
 3 
 4 $foo->bar;
 5 
 6 $foo->bar();
 7 
 8 $foo->bar->baz;
 9 
10 $foo->bar()->baz;

For comparison, here's how a "fixed" highlighting would look - I don't know how long it would take to actually make this highlighting happen, let alone how it would affect highlighting performance.

 1 use strict;
 2 use warnings;
 3 
 4 $foo->bar;
 5 
 6 $foo->bar();
 7 
 8 $foo->bar->baz;
 9 
10 $foo->bar()->baz;

If you have an opinion on this, please leave a response to this comment on the GitHub issue. I'll proceed after collecting votes over the next week or so.

-Rob

2 Comments

Personally what I'd like to see (but it's probably not practical or sane to anyone else), is -> being highlighted in a different color than the methods themselves, and then something like the third option. This would also make it a bit more clear when doing $foo->method->{hashkey}->method or other strange nests.

I agree with the way you state the problem.
Of the 3 examples, I prefer the second option without method highlighting - the absence of highlighting becomes a highlight in itself.
I also like Ryan Voots suggestion.

Leave a comment

About Rob Hoelz

user-pic I'm a Perl programmer from Wisconsin. https://hoelz.ro