Method definition highlighting

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Method definition highlighting

Doug Kearns
One of the reasons I'd temporarily forgotten that the current CVS wasn't
highlighting method names specially in method definitions is because
I've never liked it and have a local customization to prevent it.

I much prefer the "self" in:

def self.bar: end

and the "Foo" in:

def Foo::bar; end

to be highlighted normally as rubyPseudoVariable, rubyConstant and
rubyLocalVariableOrMethod respectively rather than all of them being
highlighted as part of the artificial rubyFunction.

Does anyone else have any thoughts on this?

Regards,
Doug
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: Method definition highlighting

Nikolai Weibull-11
On 2/20/07, Doug Kearns <[hidden email]> wrote:

> One of the reasons I'd temporarily forgotten that the current CVS wasn't
> highlighting method names specially in method definitions is because
> I've never liked it and have a local customization to prevent it.
>
> I much prefer the "self" in:
>
> def self.bar: end
>
> and the "Foo" in:
>
> def Foo::bar; end
>
> to be highlighted normally as rubyPseudoVariable, rubyConstant and
> rubyLocalVariableOrMethod respectively rather than all of them being
> highlighted as part of the artificial rubyFunction.
>
> Does anyone else have any thoughts on this?

Can't remember if I have this disable as well, but highlighting self
does make sense, I think.

  nikolai
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: Method definition highlighting

Tim Pope-2
On Tue, Feb 20, 2007 at 02:37:14PM +0100, Nikolai Weibull wrote:
> Can't remember if I have this disable as well, but highlighting self
> does make sense, I think.

As you're no doubt aware, this is easy enough to accomplish by adding
a contains=rubyPseudoVariable to the appropriate line.

Cheers,

Tim
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: Method definition highlighting

Tim Pope-2
In reply to this post by Doug Kearns
On Tue, Feb 20, 2007 at 10:02:36PM +1100, Doug Kearns wrote:
> One of the reasons I'd temporarily forgotten that the current CVS wasn't
> highlighting method names specially in method definitions is because
> I've never liked it and have a local customization to prevent it.

Well, I can't say I ever particularly cared for it either, although it
is a common practice in Vim syntax highlighting.  Recently, I was
working on cloning "vibrant ink," a TextMate theme popular with Rails
users.  I added the rubyRegexp group in pursuit of this goal, which is
when I discovered the method name highlighting problem.  The theme in
question definitely looks better with such method name highlighting in
place.  So I'd at least like to keep it as a possibility.

> I much prefer the "self" in:
>
> def self.bar: end
>
> and the "Foo" in:
>
> def Foo::bar; end
>
> to be highlighted normally as rubyPseudoVariable, rubyConstant and
> rubyLocalVariableOrMethod respectively rather than all of them being
> highlighted as part of the artificial rubyFunction.

Certainly a possibility.  To get the original effect, you'd have to
highlight all rubyLocalVariableOrMethod objects as Identifier, at
which point it'd probably be easier to highlight all the things that
aren't identifiers, as the screen is going to be saturated with it.

The amount of Identifier highlighting has always bothered me with the
current syntax file, actually.  I've tried disabling various things to
reduce it,  I'm happy to hack around it, but if while we're discussing
the subject, I figure I may as well throw my two cents into the pot.

One possible alternative is to move symbols into the Constant group
with numbers and strings.  This is more logical, in a way, and my
understanding is this is how TextMate works.  I do like having symbols
highlighted differently from strings, but from a theoretical
perspective it might make more sense to change String highlighting in
the color scheme instead.  Of course, this is not the default, so that
should be taken into account as well.

One group that doesn't get much play is Type.  Might it make more
sense to highlight constants (the capitalized kind) using this group.
This makes sense in cases where constants are classes.  In the cases
where they're not, well, keep in mind method declarations aren't
exactly PreProc either.  Making this change would basically allow us
to drop all the fanciness for module/class declarations as well.  The
colons would be different, but I don't think that's a bad thing.

Going on a real tangent now, it just occured to me a different use for
the Type group.  I find the variations of highlighting of "end" to be
extrordinarily useful.  Perhaps it would make sense to use the Type
group as a third color?  This strikes me as potentially very useful
for keeping things matched up.  You could also drop the module/class
fanciness in this case, as you'd want the class/module name to be
distinct from the introducing keyword.  I'm committing changes that
make this possible, but I am leaving the default highlighting for it
as PreProc until I have spent some time playing with it.

Cheers,

Tim
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: Method definition highlighting

Doug Kearns
On Tue, Feb 20, 2007 at 09:47:49AM -0600, Tim Pope wrote:

<snip>
 
> The amount of Identifier highlighting has always bothered me with the
> current syntax file, actually.  I've tried disabling various things to
> reduce it,  I'm happy to hack around it, but if while we're discussing
> the subject, I figure I may as well throw my two cents into the pot.

I take it you've noticed ruby_no_identifiers?
 
<snip>

Regards,
Doug
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: Method definition highlighting

Tim Pope-2
On Wed, Feb 21, 2007 at 05:29:53PM +1100, Doug Kearns wrote:

> On Tue, Feb 20, 2007 at 09:47:49AM -0600, Tim Pope wrote:
>
> <snip>
>  
> > The amount of Identifier highlighting has always bothered me with the
> > current syntax file, actually.  I've tried disabling various things to
> > reduce it,  I'm happy to hack around it, but if while we're discussing
> > the subject, I figure I may as well throw my two cents into the pot.
>
> I take it you've noticed ruby_no_identifiers?

Sure.  It's rather all or nothing though.  Basically the only thing
left is method declaration highlighting then (and talk is of
eliminating that too).  Nonetheless, I can hack up just about anything
with enough :highlight rules, I'm just after the most sensible
possible defaults.  If I could only define sensible.
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: Method definition highlighting

boss
In reply to this post by Tim Pope-2

On 20 Feb 2007, at 15:47, Tim Pope wrote:
> Recently, I was
> working on cloning "vibrant ink," a TextMate theme popular with Rails
> users.

Any chance you could post your vibrant ink somewhere?

(Or should that be vimbrant ink?)

Thanks and regards,
Andy Stewart

_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: Method definition highlighting

Tim Pope-2
On Wed, Feb 21, 2007 at 11:19:44AM +0000, Andrew Stewart wrote:
> Any chance you could post your vibrant ink somewhere?
>
> (Or should that be vimbrant ink?)

I'm calling it vividchalk :).  I'm attaching what is still a work in
process.  I've decided not to go for an exact clone, after seeing how
the HTML highlighting in TextMate is rather ugly, in my opinion.
Feedback welcome; I'm still deciding how to do a lot of the Vim
specific stuff like the statusline and completion menu.

Cheers,

Tim

_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel

vividchalk.vim (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Method definition highlighting

boss

On 21 Feb 2007, at 15:08, Tim Pope wrote:

> On Wed, Feb 21, 2007 at 11:19:44AM +0000, Andrew Stewart wrote:
>> Any chance you could post your vibrant ink somewhere?
>>
>> (Or should that be vimbrant ink?)
>
> I'm calling it vividchalk :).  I'm attaching what is still a work in
> process.  I've decided not to go for an exact clone, after seeing how
> the HTML highlighting in TextMate is rather ugly, in my opinion.
> Feedback welcome; I'm still deciding how to do a lot of the Vim
> specific stuff like the statusline and completion menu.

Nice name.

Thanks for posting vividchalk.  It looks pretty good.

The only colour I changed was the one used for visual selections.  I  
found that the grey was sufficiently light to make the text  
underneath, for most colours, hard to read.  So I darkened it and  
that helped a lot.

Regards,
Andy Stewart
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel