rosshemsley / iOpener

Open files from path, with completion, listings and history. Similar to Emacs find file.
GNU General Public License v2.0
55 stars 19 forks source link

Sublime Text 2 support? #16

Open mattst opened 8 years ago

mattst commented 8 years ago

Hi,

iOpener is very useful, thanks very much for writing it, I use it a lot.

I was just wondering what the reason was for the lack of Sublime Text 2 support? Is there something used from the ST3 API which is unavailable in the ST2 API? I was thinking about cloning and seeing if I could get it running on ST2 but won't bother if there's a major technical barrier.

Although I use ST3 for all my programming, I use ST2 for some other text editing, it is my default text editor in fact. I find it useful to have both ST2 and ST3 installed so that I can have a much smaller window size with ST2 and a new ST2 window created for each file I edit (useful if you use lots of workspaces in use and don't want to change workspace just to quickly edit a file). So it would be nice if iOpener worked with ST2 as well.

Thanks.

rosshemsley commented 8 years ago

Hey, there's no reason apart from that I don't use ST2! I believe it's not too difficult.

Feel free to open a PR - I'm happy to add people wish to contribute as collaborators!

mattst commented 8 years ago

Hi Ross,

I've forked and cloned and had a play with iOpener on ST2 this afternoon. There are some issues.

The window class method project_data() is not in the ST2 API at all. However the ST2 and ST3 API both have a method called folders() (window class) which returns a list of the project's folders. In fact I was wondering why you didn't use that instead of project_data()? folders() gives full paths so the code you wrote to build a full path when necessary wouldn't be needed. I suspect you just didn't know about it because I can't see you using project_data() for anything other than getting a list of the project's folders. Anyway with the code altered to use folders() I can open files with iOpener in ST2.

What may be a problem is getting the (all important) tab completion to work. It certainly does not like it at all at the moment. I've never used, or indeed seen, an input panel handled in the way you've implemented. I'm only familiar with show_input_panel(). Clearly the design you've used is so that tab key presses in the input panel can be captured and used for tab completion - but at the moment all I get is a tab inserted into the input panel and no helpful console Python errors to point me in the right direction. I'll investigate further and see if I can establish what the problem is.

One thing that won't be possible is to open a folder in a new window with that folder being set as the project folder. As far as I can tell there is no way to set a project folder with the ST2 API, certainly not a documented way. However that's not a feature of iOpener that I've ever used and suspect that it's not used by the majority of users either.

Was it intentional that the iOpener settings can not be used from within the user's Preferences.sublime-settings file? At the moment the only way to change the default settings is to create an i_opener.sublime-settings file in the User directory to override the package's version. However making the settings compatible with the user's Preferences.sublime-settings file would be easy but the settings would need to be prefixed by iOpener to avoid potential conflicts with other plugins and for user clarity, e.g. use_project_dir --> iopener_use_project_dir.

I hope this is of interest. I'll get back to you with an update on the tab completion situation.