-
Notifications
You must be signed in to change notification settings - Fork 41
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
Several ViewEventListener handlers do not work for duplicate view via Goto Anything #2411
Comments
I did some more digging, and clones created with Goto Anything have problems with several
Also |
This is default behavior of a The following should register it for all views of a file. import sublime
import sublime_plugin
class Example(sublime_plugin.ViewEventListener):
@classmethod
def applies_to_primary_view_only(cls):
return False
def on_activated(self):
print('on_activated id=%r buffer_id=%r' % (self.view.id(), self.view.buffer_id())) |
@deathaxe I mentioned in the report that, at least for me, setting |
I'd consider this to be a duplicate of #289 (comment) (and #1253). |
@FichteFoll Very similar, but this is a very specific issue where the new |
Sorry, didn't read carefully enough. A closer look reveals ST does simply not create any Once Neither |
I'll consider it a sibling of #289, then. It's a related issue but with different symptoms and cause(s). Hopefully the devs find a way to clear this inconsistency. |
@ehuss: I am able to reproduce the issue. Here are some information I found so far: If a file is opened a second time via "Goto Anything" quick panel, the The As soon as the plugin, which implements the Running "Create new View into File" from Command Palette works correctly. By adding some Opening a clone via "Goto Anything" doesn't cause
class EventListener(sublime_plugin.EventListener):
def on_reload(self, view):
print(f"on_reload View {view.id()} : {view.file_name()}.")
def on_activated(self, view):
print(f"raw on_activated View({view.id()}) Buffer({view.buffer_id()}) File({view.file_name()})")
def on_pre_save(self, view):
print(f"raw on_pre_save View({view.id()}) Buffer({view.buffer_id()}) File({view.file_name()})")
class ViewEventListener(sublime_plugin.ViewEventListener):
@classmethod
def applies_to_primary_view_only(cls):
return False
def on_activated(self):
print(f"on_activated View({self.view.id()}) Buffer({self.view.buffer_id()}) File({self.view.file_name()})")
def on_pre_save(self):
print(f"on_pre_save View({self.view.id()}) Buffer({self.view.buffer_id()}) File({self.view.file_name()})")
def on_selection_modified(self):
print(f"on_selection_modified View({self.view.id()}) Buffer({self.view.buffer_id()}) File({self.view.file_name()})") Here's the console output. Each time a new file is selected in the Goto Anything panel, Once
|
Seems this isn't fixed? I'll remove the milestone. |
This also causes a problem for LSP. LSP relies on |
I can't reproduce this in build 4183. |
It does seem like it works. Also when testing with the plugin from sublimelsp/LSP#2251 (comment) |
Going to close this then, given no one else has reproduces this. |
Summary
on_activated
inViewEventListener
will not trigger for a view that is opened in a separate layout group via Goto Anything.Expected behavior
on_activated
should trigger whenever activating the view regardless of how it is opened.Actual behavior
on_activated
is not called.Steps to reproduce
on_activated
is not printed. Switching between views,on_activated
is never printed for the new view.Notes
on_activated_async
.EventListener
.applies_to_primary_view_only
does not affect it.Environment
The text was updated successfully, but these errors were encountered: