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

Error rewriting command X. Encountered infinite loop gives false positive #5978

Closed
rchl opened this issue May 19, 2023 · 3 comments
Closed

Comments

@rchl
Copy link

rchl commented May 19, 2023

Description of the bug

The Error rewriting command X. Encountered infinite loop warning triggers when a WindowCommand is triggered directly from plugin_loaded hook. It's not actually an infinite loop case so the warning should be more relevant in this case.

Also would be good to mention this "limitation" in the docs.

Steps to reproduce

  1. Create plugin:
import sublime

def plugin_loaded():
	sublime.active_window().run_command('select_color_scheme')
  1. Restart ST
  2. Look in the console

Expected behavior

No warning or a more relevant warning

Actual behavior

Error rewriting command select_color_scheme. Encountered infinite loop

Sublime Text build number

4150

Operating system & version

macOS

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information

No response

@deathaxe
Copy link
Collaborator

Various API calls fail or behave odd, when called dirctly from plugin_loaded().

So does sublime.load_resource() fail to find any resource, especially ones, from loaded package.

@rchl
Copy link
Author

rchl commented May 19, 2023

Yeah, some note about that in the docs would be good. I suppose many current packages assume that it's fine to just use the whole API from plugin_loaded as even the name of the event implies that things are ready.

There's also the matter of fact that the plugin_loaded is triggered sequentially for each plugin so there can be issues if one plugin synchronously relies on another that loads later.

@BenjaminSchaaf
Copy link
Member

Fixed in build 4153.

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

No branches or pull requests

3 participants