-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
command: Fix reload
command to correctly initialize and reload all runtime files
#3062
Conversation
Do I correctly understand that if my plugin has variable, after reload it will go to it is default state? If yes, it is only guess and should be checked but it will break Does micro have hook like In general I am against of giving plugins ability to call
I just thought, it seems that reload for everything can be unexpected for plugins and especially for user that decided to make reload with opened plugins. Did you meant it? That plugins are built with idea that user will shoot his foot with just reload? You are right. I can propose to add parameters for |
It uses the
Maybe we can have both. In the moment the user calls the command This then wouldn't even violate the documentation:
|
be6401a
to
e7b1859
Compare
With this modification the InitRuntimeFiles() and InitPlugins() (if needed) must be called first, otherwise uninitialized runtime file variables are most likely.
Adding InitRuntimeFiles() and InitPlugins() to buffer_test.go in PR zyedidia#3062 (instead of just initializing runtime vars with empty values, as it was before) seems to cause sporadic failures of MacOS build tests on github, with crashes in various places but all beginning with lots of plugin failures: 2024/03/26 00:16:23 Plugin does not exist: autoclose at autoclose : &{autoclose autoclose <nil> [runtime/plugins/autoclose/autoclose.lua] false true} 2024/03/26 00:16:23 Plugin does not exist: comment at comment : &{comment comment <nil> [runtime/plugins/comment/comment.lua] false true} 2024/03/26 00:16:23 Plugin does not exist: diff at diff : &{diff diff <nil> [runtime/plugins/diff/diff.lua] false true} 2024/03/26 00:16:23 Plugin does not exist: ftoptions at ftoptions : &{ftoptions ftoptions <nil> [runtime/plugins/ftoptions/ftoptions.lua] false true} ... I suppose tests should not rely on plugins, and more importantly, should not be affected by the contents of ~/.config/micro/ on the host.
This fix will prevent duplicating runtime files in the moment
reload
and it will now reload the plugins as well.Now it needs to be discussed if it's really a good idea to export
reload
to the Lua plugins, because this could lead to unexpected behavior within the plugins.Fixes #2795
Fixes #3044
Fixes #3059