method name syntax highlighting
method name syntax highlighting
- Subject: method name syntax highlighting
- From: Darcy Brockbank <email@hidden>
- Date: Sat, 07 Feb 2009 15:04:26 -0500
New to the list and thought I would contribute something I poked around
with for a couple of days.
I added to the default grammars to allow for method declaration and
definition highlighting. If you
don't care about this kind of thing you can hit delete now.
For the last 15 years in emacs I've been highlighting method and
function names, and the default
behavior of Xcode is a bit different... in that I use the method
declarations and definitions for
highlighting, so I can quickly scan through code and pick out the method
names from among the
noise. Xcode isn't capable of this with the default grammars, but
instead highlights the method names
inside the functions which is the opposite of what I like for myself.
Obviously everyone has their
own preference.
I've made some modifications to the grammar and the built-ins that will
allow Xcode to pick up
method definitions and declarations for additional highlighting now. The
features supported are:
1. separate colors for class methods and instance methods
2. separate colors for the "selector" portion of the declaraton (i.e. -
someMethod: andThis: and: )
3. separate colors for the "type" portion (i.e. method return type and
parameter types)
4. separate colors for the method parameters
These are picked up by the modified Built-in file and show up in Xcode's
preferences.
Example is here from my preferred color scheme (cyanomatic) which is
included in the set of files.
The colors are not coded into the grammar changes, it should just show
up for people as additional
highlighting options.
http://www.nihonto.ca/xcode/sample1.png
http://www.nihonto.ca/xcode/sample2.png
Notes:
1. I put in an ObjectiveC++ grammar in there... it is *not* embracing
the cpp part yet, it's just there
because Xcode seems to want to handle .h files by default as objc++ and
I didn't want to get into
fiddling around trying to change the default behavior. You may not want
this file if you are actually
using objc++. You will have to specifically select ObjectiveC for syntax
highlighting in that case most
likely.
2. The README says where to install stuff.
3. The zip file is everything, can just download it instead of the
individual files
4. There are some areas still for work... multi-line declarations don't
work so well, and something I
did might have affected indenting of switch statements. Xcode has not
been stable in my experience so could be something else.
5. I probably coded more than I needed to, I'm not cognizant of all the
features that these grammars
are using or their limitations, so at times the easiest route to getting
the functionality going would
be to create my own path in the grammar. Someone who knows better might
have a laugh, then
again maybe this is the only way of doing it.
6. They seem to perform just fine, but no idea if they will cause issues
for you. Consider that this is
a work in progress.
7. I'm out of time for continuing to work on it and have to get back to
my project. I am happy if people
who were interested in the functionality are to use this and get utility
out of it. If anyone wants to
extend the features or add new ones or improve what is there, I am very
happy and would request
copies emailed to me so I can use going forward.
Files:
http://www.nihonto.ca/xcode/
Enjoy. Hopefully.
- darcy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden