Disclamer: This is a pretty major feature request. So hold on.
The Problem
The Pythonista forums are riddled with feature requests. Many of these are relatively minor, and could be implemented by @omz with minimal effort.
It's not practical for many editors to include a massive codebase packed with functionality, it would make the application huge and much of the functionality would go unused by the majority of users. This is why popular editors like Atom and Sublime Text have libraries exposing methods by which third-party developers can extend the editor's functionality.
The solution
My proposal is that Pythonista implement such a system. A library called something like internals would do nicely. As I see it, this would be somewhere between the difficulties of objc_util and @omz having to implement things. The downsides of objc_util as I see them are:
- High level of technical Objective-C knowledge required. It's very unfriendly to native python-speakers.
- Users are kept too much in the dark. Trying to extend the editor with
objc_utilinvolves a large amount of guesswork about the completely undocumented inner workings of Pythonista.
These could be overcome with a native Python library. As I envision it, its goal would be to allow for easy and powerful extension of the editor by someone who only knows Python. It would be thoroughly documented. Ideally, this could tie into existing libraries. For example, it could provide ui.View classes for views inside the editor. Now, I know you can add subviews to editor views with objc_util but this has several issues:
- The facts of which editor views are where and how to access them are completely undocumented.
- This is very prone to crashes.
A magical library that wraps all this functionality would certainly be very useful.
However, internals wouldn't be a full plugin system with only the ability to add views. This module would also need much more functionality. A non-exhaustive list that names a few functions needed:
- Hooks and callbacks to common events (save, open file, swipe to console, open file browser to name a few)
- Easy methods for adding editor buttons
- Python methods wrapping many of the Pythonista's internal methods used to save files, present views, control the console, etc.
A plugin system could be modeled off of those found in Atom and Sublime Text, to provide a rough idea of the functionality needed to make a complete API.
With a full set of hooks and features, extending Pythonista could be trivial. This would take pressure off @omz to implement requested features, and would take Pythonista to the next level.