Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EasyMotion doesn't work in Sublime Text 3 #26

Closed
hilko opened this issue Feb 6, 2013 · 19 comments
Closed

EasyMotion doesn't work in Sublime Text 3 #26

hilko opened this issue Feb 6, 2013 · 19 comments

Comments

@hilko
Copy link

hilko commented Feb 6, 2013

It appears that this plugin doesn't work in Sublime Text 3. I've tried a bunch of things, but sadly my knowledge doesn't go far enough to properly fix this...

@tednaleid
Copy link
Owner

It likely won't work in ST3 until the API gets much better documentation. One of the main APIs that EasyMotion relies on in ST2 is the ability to create and close an edit object programatically. I need this so that the changes that I make to the view with EasyMotion can be reverted without leaving the save state dirty.

For some reason, this has been removed from the ST3 API, "API: begin_edit() / end_edit() are no longer accessible" from Selected Changes.

If there is no substitute for this, it's likely that I won't be able to migrate the plugin to ST3.

@highend
Copy link

highend commented Feb 10, 2013

Removed isn't probably the right word.

Will
http://www.sublimetext.com/docs/3/porting_guide.html
Excerpt:
Restricted begin_edit() and end_edit()

begin_end() and end_edit() are no longer directory accessible, except in some special circumstances. The only way to get a valid instance of an Edit object is to place your code in a TextCommand subclass. In general, most code can be refactored by placing the code between begin_edit() and end_edit() in a TextCommand, and then calling run_command on that TextCommand.

This approach removes the issue of dangling Edit objects, and ensures the repeat command and macros work as they should.

or
http://www.sublimetext.com/forum/viewtopic.php?f=6&t=10823&p=43496&hilit=begin_edit#p43496

be of any help?

ST3 without EasyMotion? I wouldn't switch...

@tednaleid
Copy link
Owner

Thanks, but I've looked at both of those. They suggest using a TextCommand as it automatically opens and closes an edit object for you. Unfortunately, I need an edit object to live beyond the life of what a TextCommand does. This type of auto open/closed edit also exists on ST2 and I attempted to implement it that way when I first made the plugin. But then I found it wouldn't work because the edit object gets closed and I can't control that.

This API change makes sense for most plugins, but as far as I've seen will make EasyMotion unportable unless there's something hidden in the API...I'm hoping things get better documentation in the next few months and I'll keep monitoring to see if some new way pops up to implement things.

@tednaleid
Copy link
Owner

I've given this a shot using just TextCommand and trying to get the undo to work (you can see what I'm trying on the st3_upgrade_attempt branch. It works sometimes, but about 30% of the time, if I move to a second capture group with enter and wait a little bit, the jump group targets aren't cleaned up and are left in the A-Z state, which is really bad...

I haven't tried it in ST3, just in ST2.

I'm hoping that there will be something else in the ST3 API that I can use or try once it's better documented. It could also be that ST3 handles the callbacks a little differently and is more consistent in how window.run_command works.

@tednaleid tednaleid mentioned this issue Mar 15, 2013
@evantravers
Copy link

Has there been any update to this recently?

@tednaleid
Copy link
Owner

Not from what I've seen from the API of ST3.

There is a dev branch that I have where I'm trying a technique that could work on ST3 (it pops up a new buffer and fills it in with all of the content on the view screen that you were looking at for character selection, then makes the buffer go away), but it needs a lot more work before it's feature compatible with the currently released version (or really even working). I likely won't focus much on it till ST3 is actually released and the API is pretty much locked down at that point.

@jklaiho
Copy link

jklaiho commented Jun 4, 2013

But what if the API is locked down to a point where the current functionality of EasyMotion is no longer possible to implement? One might consider that an acceptable risk, shrug if it happens and just try to build some equivalent functionality using the ST3 API, but based on the descriptions here, the current ST2 implementation seems nicer than the proposed (and incomplete) ST3 implementation.

If there is a need for advocacy for the necessary APIs to be included in ST3, just point me to the relevant tickets or communication channels and I'll try to contribute my two cents there, and I suggest others do the same.

@tednaleid
Copy link
Owner

I'm not currently using ST3 and likely won't till it's final and there is some compelling reason to upgrade (haven't seen one yet to use the beta over ST2).

The API that's available for ST3 now is very limiting. I've got a couple of ideas on how it could be implemented, but the experience would not be as good as the ST2 experience and would take a lot of additional work (it likely would involve popping up a new tab that's a copy of the existing window and then closing that when the user makes the selection).

The vast majority of people who use sublime are still on ST2, so switching the plugin over to using that style with the degraded experience while the ST2 stuff still works doesn't make sense to me (there's no way that I know of to say that changes are only to be for ST3 but not installed on ST2 without making a brand new plugin).

When ST3 is released and most people have converted over, I'll look at upgrading the plugin, but there isn't much incentive for me to do it till then.

@lunixbochs
Copy link

I made this to make handling edit groups easier in ST3: http://www.sublimetext.com/forum/viewtopic.php?f=6&t=12551

@tednaleid
Copy link
Owner

Thanks @lunixbochs that looks interesting. I'll take a closer look at it and see if I can repurpose it and make it work with EasyMotion for ST3.

@geddski
Copy link

geddski commented Jul 16, 2013

How about now that there's a public release? Many devs and plugins (like Emmet) have already made the jump. Love this plugin, can't wait to use it again.

@lmartins
Copy link

Really interested on the ST3 version also. Thanks for the effort.

@tednaleid
Copy link
Owner

There is now support on the st3 branch for Sublime Text 3. Because of the different version of python in ST3, I can't publish this to master as it'll be broken in ST2.

For now, you'd need to check the code out to your ST3/Packages directory and git checkout st3 to switch over to the st3 branch.

I'll update the main docs and close this issue once I get some confirmation from others that the st3 branch is working for some other people.

@tednaleid
Copy link
Owner

I'm not using ST3 in my daily work currently, but I haven't heard of any issues with ST3 support since releasing it, so I'm guessing it's working for everyone. I'm closing this issue as fixed, if there are further issues just open another one up.

@Hexor
Copy link

Hexor commented Nov 12, 2013

Hi tednaleid,

I just did as you said,
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
git clone git://github.com/tednaleid/sublime-EasyMotion.git EasyMotion
cd EasyMotion
git checkout st3

everything is good. But when I type cmd+; in the st3, nothing happened.

Maybe caused by the st3's update?

@democ
Copy link

democ commented Dec 7, 2013

@Hexor, before I encountered exactly the same problem like you. I solved it now.

Reinstall ST3 (NOTICE! DO NOT install any other package)
Get the EasyMotion package for st3 like you do

Then EasyMotion works! I think the packages I installed before are in conflict with EsayMotion.

@Hexor
Copy link

Hexor commented Dec 9, 2013

Thanks @democ, It's really works!

But it takes lots of my time to reinstall every other package. Anyway, worth it.

@KristerV
Copy link

oh man.. really want this for st3, but the keyboard shortcut only works a few times out of a dozen tries. Reinstalling is not really an option, especially if it may break anyway...

@hkic
Copy link

hkic commented Jul 3, 2015

After issuing the git checkout st3 command, a restart of Sublime Text 3 is needed for EasyMotion to function properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests