plugin: Add new onBufferOptionChanged callback#2962
plugin: Add new onBufferOptionChanged callback#2962JoeKar merged 5 commits intomicro-editor:masterfrom
onBufferOptionChanged callback#2962Conversation
runtime/plugins/linter/linter.lua
Outdated
|
|
||
| makeLinter("gcc", "c", "gcc", {"-fsyntax-only", "-Wall", "-Wextra", "%f"}, "%f:%l:%c:.+: %m") | ||
| makeLinter("g++", "c++", "gcc", {"-fsyntax-only","-std=c++14", "-Wall", "-Wextra", "%f"}, "%f:%l:%c:.+: %m") | ||
| makeLinter("g++", "c++", "g++", {"-fsyntax-only","-std=c++14", "-Wall", "-Wextra", "%f"}, "%f:%l:%c:.+: %m") |
There was a problem hiding this comment.
Just a note: this change might be unnecessary (though will not hurt either), since it's basically the same compiler.
BTW... it might be a good idea to remove the -std=c++14 param, to support newer versions of the standard.
There was a problem hiding this comment.
Removing the forced standard is a good idea, to go with the actual GCC defined defaults.
Regarding the invoked checker/compiler I had different experiences, due to the different defaults applied by gcc vs g++. Exactly this was the reason why we receive unexpected linter messages when saving a C++ file. So I really recommend to go with the explicit GNU C++ compiler for C++ files.
feeda28 to
85bb039
Compare
85bb039 to
33244e4
Compare
33244e4 to
85e2db0
Compare
85e2db0 to
11dfbf9
Compare
internal/buffer/settings.go
Outdated
| b.OptionCallback(option, nativeValue) | ||
| } | ||
|
|
||
| _, err := config.RunPluginFnBool(b.Settings, "onBufferOptionChanged", |
There was a problem hiding this comment.
Since the boolean result is ignored it doesn't seem to be necessary, except the other small difference that RunPluginFnBool() checks for buffer local settings[p.Name] being unset, which RunPluginFn() doesn't. Therefore with RunPluginFnBool() the callback isn't called in plugins which are disabled after loading, while with RunPluginFn() it is...which is an inconsistency on his own.
11dfbf9 to
dcf064a
Compare
This can become handy in the moment a plugin needs to react on e.g. changed file type.
dcf064a to
d1f54ea
Compare
With the introduction of the new callback it's possible for plugins to react upon changed buffer settings.
Especially the
linterplugin will benefit by this change, since it can the properly unregister messages created with a different linter type.Fixes #2961
Fixes #3587