Open darylrobbins opened 9 years ago
Hrmmm.. Did it work after a restart?
Yes, it appears to work fine after a restart. It seems to be a timing issue. I tried reproducing it a few times and it doesn't happen every time. Basically, the vim-mode install has to be part way complete when vim-surround tries to install. I'd say it's probably not worth fixing. It's more likely an Atom bug that a dependent plugin can be installed at the same time as its dependency.
Well, that's kind of the weird thing. vim-surround USES vim-mode's provider, but it isn't strictly a dependency. It's the difference between accessing the vim-mode object that controls your session, and just depending on vim-mode as an installed library (which is kind of unnecessary overhead.)
I'd prefer to fix this, and I bet there's a way to! I'll leave this ticket open for now. Vim-surround should be as smooth as possible.
If you want to try and reproduce, click install on vim-mode and then click on vim-surround immediately after -- like you are quickly reinstalling your favourite plugins.
Just happened to me too
So this is weird... When I have vim-mode
disabled and vim-mode-next
enabled, everything works perfectly (as it should).
So I uninstall vim-mode
and restart Atom. This should not change anything, right? It's disabled!
Now vim-surround
throws this Cannot find module 'undefined/lib/text-objects'
error 100% of the time.
I reinstall vim-mode
, immediately disable it, and restart Atom. The error is gone. 100% reproducible.
So why does having vim-mode installed but disabled on my machine make this error go away? I don't know but I hope an additional datapoint might help.
I would guess that disabling a plugin leaves the plugin in tact in the filesystem but just no longer calls its initializer to make it 'active'. So, when the vim-mode plugin is present but disabled, vim-surround is successfully able to find modules within it, even though the vim-mode plugin is not running per se.
Agreed. That would be unfortunate if true... that doesn't sound very disabled. :)
If you think of it in terms of the average plugin that isn't really depended upon by anything, disabled would mean disabled. When it is depended on though, all sort of havoc could potentially ensue from the dependent plugin assuming that its dependency is live. In this particular case though, since vim-surround is depending on vim-mode to call it, the havoc should be minimal.
True, but that goes against Atom's any plugin can implement any functionality design goal... In this case, only vim-mode can supply the functionality that vim-surround needs. If you run an alternative vim, even if it provides everything that vim-surround needs, it won't work.
As you say, this problem is mostly theoretical for now.
Agreed. I'm not saying it's the best long-term choice. I'm merely engaging in informed speculation as to why you might be seeing the behaviour you describe. :)
Interesting! Yeah, I'd agree with daryirobbins here. We need to use the active vim-mode object in order to do some of our text selections. Since it isn't truly a dependency, we resolve the (presumably) installed vim-mode path with:
vimModePath = atom.packages.resolvePackagePath('vim-mode')
{SelectInsideQuotes, SelectInsideBrackets} = require "#{vimModePath}/lib/text-objects"
As you can tell, this isn't going to work with vim-mode-next unless we explicitly decide to fall back to it. There might be a way to get around this using "services" (which could be a sort of trait-based description of a package) to access the methods instead.
Definitely something to look at! I might create a new ticket to track this pan-vim-modes compatability.
@gepoch I'm still getting this error when atom starts up. Any workaround?
Thanks.
Hey @eyaleizenberg the vim-mode package was officially deprecated in favor of the much better vim-mode-plus plugin! Vim-mode-plus implements its own surround functionality, so my vim-surround plugin is obsolete. See https://github.com/gepoch/vim-surround/issues/40 for some more info on vim-mode-plus, and how to set up its surround keybindings.
[Enter steps to reproduce below:]
Atom Version: 0.210.0 System: Mac OS X 10.10.3 Thrown From: vim-surround package, v0.7.2
Stack Trace
Failed to load the vim-surround package
Commands
Config
Installed Packages