[TxMt] TM2 tighter scripting integration (MacRuby, Lua?)

Adam Strzelecki ono at java.pl
Mon Jan 9 10:58:22 UTC 2012


I do not know if anyone asked you about that already, but was tighter scripting integration via MacRuby (or Lua) ever considered for TM2?

Since I can see half of the bundle scripts (these doing heavier work) are Ruby already, I can see that integrating with MacRuby could bring potential benefits:
(1) persistent memory structures, each bundle could possible create some class storage variables, i.e. keep there autocompletion information
(2) TM2 could expose more dynamic API to the scripts: hooks, callbacks
(3) direct access to the editor buffer & GUI elements, exposing scope tree to the scripts
(3) scripts running via MacRuby could use all Cocoa API, making life easier for other apps integration, i.e. via AppleScript
(4) many (most?) of the work now done by TM2 core could be offloaded to the bundles and its developers, so TM2 itself could be just set of classes driven by MacRuby scripts
(5) possible to make more advanced autocompletion for various languages, thanks to (1) (2) (3)

But also I can see potential problems:
(1) no compatibility with TM1 (but anyway TM2 is about to be free upgrade to TM1, and also superior to its predecessor)
(2) bundle script can hog TM memory, and also hang TM, more discipline is needed for such scripts, but TM2 could supervise such scripts and kill them if necessary (similar way the browsers do with JavaScript)
(3) potential class namespace collisions, but then each bundle could possibly run inside its own MacRuby environment
(4) TM2 would need to bundle some version of MacRuby.framework

Regards,
-- 
Adam Strzelecki



More information about the textmate mailing list