Sublime Forum

How to update a ST2 package to ST3

#1

Could someone please point me at the tricks necessary to update the ST2 package to ST3?
I’m trying to get SuperCollider package https://github.com/thormagnusson/Sublime-Supercollider to work.

Thanks.

0 Likes

Bug in new_file?
#2

Do you need more information than is available in the porting guide?

0 Likes

#3

Thanks for the link. It was a necessary first step. Now I’m trying to migrate from the figure out how to get the ‘edit’ object inside of a WindowCommand-derived class. Would you have any ideas where to look for this kind of info?

Thanks!

0 Likes

#4

If you are trying to using an edit object you will need to invoke a TextCommand to get access. ST3 no longer allows you to create edit objects through the view.

If you are manipulating text, I would recommend using the TextCommand instead of the window command as it will generate the edit object for you and you should still have access to everything the window command provided. If you must use the window command, you can invoke a TextCommand to make the textual changes by “view.run_command(‘your_command’)” but be aware I believe these will run on separate threads!

0 Likes

#5

Or just use my edit.py anywhere in any plugin in both ST2 and ST3, and pretend the ST3 edit transition never happened.

github.com/lunixbochs/actualvim … er/edit.py

[code]from edit import Edit

with Edit(view) as edit:
edit.insert(0, “text”)[/code]

0 Likes

#6

Thanks a bunch, lunixbochs! This is really helpful. I’ve already forked your repo.

0 Likes