OSAScriptView is specifically for writing AppleScript editors [1].
I would suggest studying some existing open source Cocoa-based editors (e.g. Smultron) to see how they do it.
[1] Technically OSAScriptView can be used to edit scripts written in any OSA language, but AppleScript is the only OSA-enabled language of any note so QED.