diff --git a/plugin/core/sessions.py b/plugin/core/sessions.py index 5f765004e..5925c2550 100644 --- a/plugin/core/sessions.py +++ b/plugin/core/sessions.py @@ -939,9 +939,9 @@ def on_post_start(cls, window: sublime.Window, initiating_view: sublime.View, @classmethod def should_ignore(cls, view: sublime.View) -> bool: """ - Allows to exclude a view from being handled by the language server, even if it matches the URI scheme(s) and - selector from the configuration. This can be used to, for example, ignore certain file patterns which are listed - in a configuration file (e.g. .gitignore). + Exclude a view from being handled by the language server, even if it matches the URI scheme(s) and selector from + the configuration. This can be used to, for example, ignore certain file patterns which are listed in a + configuration file (e.g. .gitignore). """ return False diff --git a/plugin/core/windows.py b/plugin/core/windows.py index f1de0e5d0..083f9c1c8 100644 --- a/plugin/core/windows.py +++ b/plugin/core/windows.py @@ -128,12 +128,6 @@ def disable_config_async(self, config_name: str) -> None: self._config_manager.disable_config(config_name) def register_listener_async(self, listener: AbstractViewListener) -> None: - config = self._needed_config(listener.view) - if config: - plugin = get_plugin(config.name) - if plugin and plugin.should_ignore(listener.view): - debug(listener.view, "ignored by plugin", plugin.__name__) - return set_diagnostics_count(listener.view, self.total_error_count, self.total_warning_count) # Update workspace folders in case the user have changed those since window was created. # There is no currently no notification in ST that would notify about folder changes. @@ -183,12 +177,16 @@ def _dequeue_listener_async(self) -> None: config = self._needed_config(listener.view) if config: # debug("found new config for listener", listener) - self._new_listener = listener - self.start_async(config, listener.view) - else: - # debug("no new config found for listener", listener) - self._new_listener = None - self._dequeue_listener_async() + plugin = get_plugin(config.name) + if plugin and plugin.should_ignore(listener.view): + debug(listener.view, "ignored by plugin", plugin.__name__) + else: + self._new_listener = listener + self.start_async(config, listener.view) + return + # debug("no new config found for listener", listener) + self._new_listener = None + self._dequeue_listener_async() def _publish_sessions_to_listener_async(self, listener: AbstractViewListener) -> None: inside_workspace = self._workspace.contains(listener.view)