Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to implement syntax highlighting of source code in Cocoa? [closed]

I'm working on Cocoa Application that should be able to analyze and highlight a source code written in such languages as Objective-C, SQL, JavaScript, Python etc. The text should be editable too (by using NSTextView, for example).

Please advise what is the best way to implement such feature in Mac OS X 10.5.

There is no need to support auto-completion and other extra-features. Simple formatting by keywords, strings, #includes, and numbers but with cool performance is just OK.

Also, it would be great if configuration by languages were supported.

Thanks!

like image 308
Vadim Avatar asked Apr 16 '09 03:04

Vadim


1 Answers

In preparing a project that will require something similar, I’ve found the following (but not evaluated them in depth):

  • /Developer/Examples/OpenGL/Cocoa/GLSLEditorSample implements syntax highlighting.
  • IDEKit, “an open-source framework that provides programmer source code editing, including syntax coloring, popup functions, and split frames”. This hasn’t been updated for a while (it touts 10.2 and 10.3 compatibility, and comes with a Project Builder project – can be converted with Xcode 2.5).
  • UKSyntaxColoredTextDocument.
like image 142
Jens Ayton Avatar answered Oct 16 '22 20:10

Jens Ayton