Open gcarvalho opened 11 years ago
I already ported my SublimePySide plugin to ST3 and was really painful, port SublimeRope is going to be so hard, maybe is the moment of a rewrite idk
I'm sure I will switch to ST3, so the plugin will be ported at some point in time. I would even consider a rewrite, just to have a version with a unified, simple way of dealing with classpathes, caches, Rope's own project objects and refresh-mechanisms etc etc.
No exact timeframe on this though...
Well @JulianEberius you can count with me if you decide to rewrite it :+1:
Hi everyone,
I started working on a complete rewrite of SublimeRope for ST3 called SublimePython. Its still based on Rope and should have the same features at some point in the future. It should on the other hand also be simpler to use and much more performant.
I'll add some remarks here for people interested in contributing.
1.) The main problem with porting was that ST3 uses Python3.3 for its plugin API. This requires the use of Rope's Py3K branch, and this in turn leads to problems when working on Python2 source code, which most of us still do. A smaller variant of this problem already existed in the past, when SublimeRope would use for example Python 2.6 and mark dictionary comprehensions as syntax errors in Python 2.7 projects.
This became the reason for the new architecture of the plugin (and thus also the name change). SublimePython uses a client-server architecture, with the plugin just connecting ST3's API with calls to a server that runs Rope (and PyFlakes). This server is started by the plugin automatically and can be configured to use a different Python interpreter than the one compiled into ST3. It will by default use the system interpreter (the one on the PATH), but interpreters from virtualenvs can also be configured. This has many tremendous advantages: Rope will automatically have the right PYTHONPATH and see everything that is visible and usable in your project, as it will run using your projects interpreter. PyFlakes will give the correct warnings and errors, whether you are using Python2.x or 3.x Of course this complicates plugin architecture, but at the moment I like the start I have made ;-) The plugin manages different servers (one for each python version in use) and the servers manage different projects (based on open folders in ST3, no explicit rope project at the moment!).
2.) I spend some time with Rope and Python's profiler, as well as a tool that draws callgraphs from the profiling results. I identified some bottlenecks in Rope, mostly concerned with file system operations (it would do ten-thousands of, I believe, redundant calls to os.listdir os.path.join etc etc). I added a healthy amount of caching in several places, which improved completion performance by orders of magnitude (not exaggerating). ST's "as you type" completion style now finally works for me when using Rope, even for bigger projects, without slowing down typing. It feels really nice, but as always with caching, it might have introduced some semantic issues (displaying old data... ) but I have not encountered issues yet.
There are other changes and the plugin is not feature-complete when compared to SublimeRope, but I would like som other people to check it out, play around with it and maybe contribute. The only necessary (and possible ;-) ) configuration at the moment is setting "python_interpreter" in your projects settings (Project->Edit Project) to use another interpreter than your system interpreter for the server. Exampe: { "folders": [ { "path": "XYZ" }, { "path": "ABC" } ], "settings": { "python_interpreter": "/usr/local/bin/python2.7" } }
The plugin can be found at https://github.com/JulianEberius/SublimePython
Best Regards, Julian
Sublime 3 Alpha is out, and it uses Python 3.3 and has a new API. http://www.sublimetext.com/blog/