Syntax coloring for Cocoa app - objective-c

I'm planning to do a Cocoa app that requires code syntax to be colored (in all common languages). Instead of writing my own code highlighter/parser, are there any pre-made solutions available?
Thanks

You might be able to use something like Geshi, but there're also the resources listed here: http://www.cocoadev.com/index.pl?SyntaxHighlighting
Edit
More links:
Syntax Highlighting in Cocoa TextView? Experiences? Suggestions? Ideas?
http://parsekit.com/okudakit/

An excellent solution is Uli Kusterer's UKSyntaxColoredTextDocument. It is fast and has several built-in syntax parsers. It's easy to add new languages.
It's free for non-commercial use and very cheap if you want it for a commercial app.

You can also use the JavaScript library SyntaxHighlighter and embed it into a WebView into your app.

After quite a bit of research trying to solve a similar problem, the simplest approach I found by far is to use a JavaScript library for syntax highlighting combined with a WebView. Spending time writing a syntax highlighter, a fairly complex task, is probably not what you'd want to spend time on.
I settled on using the popular CodeMirror and wrote an open source wrapper for Cocoa: https://github.com/swisspol/CodeMirrorView. You can use similar approaches to wrap other JavaScript based code editors in Cocoa apps.

You can use highlight that is used in QLColorCode :) (however, it's not a Framework that you include in your code, but a command-line utility)
EDIT: Ah yeah, use Geshi, it's probably better :D

Related

How to create UI tags in Cocoa Objective-c?

I'm looking into building a tagging feature in my Mac app. I would like to do something like in the attached image. Is the UI portion offered natively in Cocoa? If so, what is the class name?
You can use NSTokenField to accomplish that. Start by reading Token Field Programming Guide.
I had to do exactly that a couple of weeks ago. I decided to use NSTokenField as well but ran into quite a number of problems. See my endeavours here. Hope you fare better with your implementation as it gave me a couple of really short nights....

Is there any Lucene wrapper in C / Objective-C?

I know there is the CLucene project, which is a port of Lucene from Java to C. But is there a Lucene wrapper in C/Objective-C similar to PyLucene that uses JNI and and embeds a JavaVM with Lucene in a separate process?
I explored this in some depth after asking this similar question a while back. The answer appears to be "no." I found CLucene as you did. It's got problems. I also found something called LuceneKit which was also mostly a mess. For my project I just mangled up the code from PyLucene just enough to get it working, and then moved on to another project. Unless something else has come along since then, I feel confident saying that No, there's not a pre-existing, serviceable Lucene wrapper out there. Sorry.
You can also look on Ferret - it is ruby wrapper and pure c library for full text searching. Ferret is similar to lucene but it uses own file format for indexing.
Since the answer seems to be 'No' I have been looking for different options.
There seems to be an alternative (free for non-commercial apps; $1000k per app for commercial projects).
http://www.locayta.com/iOS-search-engine/locayta-search-mobile/
I have not used it but I just run into it and saw some comments praising this solution.
You can take a look at Lucy, which seems to be exactly what you are looking for:
http://lucy.apache.org/

Xcode 4 built-in help for your own files

Xcode 4 has a very nice built-in help/documentation that you can access e.g. by alt-clicking an identifier in the code, or by opening the help panel in the right sidebar. However, this only works for classes and methods provided by Apple. Is there a way to write some kind of documentation comments (e.g. like the Javadoc comments in Java) in your own code to make Xcode display them in those documentation panels?
http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/HeaderDoc/intro/intro.html
It's maintained by Apple so it should be well supported. I never actually used it, may try it later.
Ok, it looks like there's no good tool really... there are a few different ones, but they're imperfect and difficult to configure. I couldn't get Doxygen or Appledoc to work, and the tool mentioned by Avizzv92 is referred to as "a pile of poo" elsewhere, so I'd rather not try it... :)
Info that I've found:
How do you document your source code in Xcode?
http://wangling.me/2010/07/documentation-set-generation-tool-in-xcode-is-wanted/
http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
http://www.gentlebytes.com/home/appledocapp/
http://lists.apple.com/archives/xcode-users/2011/Apr/msg00238.html

Objective-C and designing a plugin mechanism

I need to design a simple plugin system in Objective C. I would like some advice about how to go about this. Thanks!
Cocoa is your girlfriend: http://www.cimgf.com/2008/09/17/cocoa-tutorial-adding-plugins-to-a-cocoa-application/
Awesome tutorial.
There is always going to the Source. Here is the ADC reference to Plug-ins
There are dozens of ways you could do this, so you might need to elaborate a little on what exactly you're trying to achieve. As a starting point, I'd recommend you look into Cocoa delegates which are usually a great way to integrate new code into an existing framework.

Textmate Code Completion Question

I know the ESC key does code completion, but is there a way to get a pop-up(tool-tip I guess) that shows you all the possible choices for a piece of code? As an example, it would be nice when writing Javascript to get a list of available actions. Other apps I've used like Coda do this. I'd like to check out Textmate but I have a hard time getting past this missing feature which I find pretty valuable, particularly as a fairly new programmer who likes to see what options are there as it's a bit of a learning tool for me also. I thought I had found a plugin like what I'm looking for, Dialog2, but it seems to have disappeared as it was meant to be built-in to the never-released TM2.
I've looked around a fair bit for the answer to this question and figured this was my next best option. Thanks.
I don't have Textmate available to try it out, but I believe that option-Esc is supposed to show you the list of possible code completions.
Check out subtleGradient's tmbundle: https://github.com/subtleGradient/javascript.tmbundle
It knows how to auto-wrap for arrays, and objects. Documentation look-up too.