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

Micro doesn't see registered commands after reload #3044

Closed
dustdfg opened this issue Nov 27, 2023 · 4 comments · Fixed by #3062
Closed

Micro doesn't see registered commands after reload #3044

dustdfg opened this issue Nov 27, 2023 · 4 comments · Fixed by #3062

Comments

@dustdfg
Copy link
Contributor

dustdfg commented Nov 27, 2023

Description of the problem or steps to reproduce

I try to develop a plugin and it is annoying to close and reopen micro to see the new behavior. I know about reload but it doesn't work for me. I have a registered command and I can call it and it works but after reload when I try to call it, micro tells me that Unknown command <...>. If I close and reopen micro after reload, everything works as expected

Specifications

Commit hash: Version: 2.0.11 (it doesn't show commit hash)
OS: Debian 12
Terminal: foot

@dustdfg
Copy link
Contributor Author

dustdfg commented Nov 29, 2023

Bug is also present in v2.0.13 68d88b5

@dustdfg
Copy link
Contributor Author

dustdfg commented Nov 30, 2023

It is really strange especially because reload "reloads" at least colorschemes #3059

@JoeKar
Copy link
Collaborator

JoeKar commented Nov 30, 2023

That happens because of InitCommands() at command.go#L348 which resets the registered commands to the builtin defaults.
Since reload is documented with...

reloads all runtime files.

...it would be plausible to reload the plugins too, but I think that...

  • RunPluginFn("preinit")
  • RunPluginFn("init")
  • RunPluginFn("postinit")

...should already do the trick in the reload scenario, because I assume, that your custom plugin command is registered somewhere within these functions (via MakeCommand()). Right?

@dustdfg
Copy link
Contributor Author

dustdfg commented Nov 30, 2023

Yes via MakeCommand(). I also checked filemanager and linter (both custom user redefined and embedded version) plugins code. They have the same issue.

Your comment gave me association with AddRuntimeFile() function that isn't used in any plugins I mentioned above. So I have just tried to add the lua file as RTPlugin but it doesn't have any effect 😕

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

Successfully merging a pull request may close this issue.

2 participants