-
Notifications
You must be signed in to change notification settings - Fork 240
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
Make mod-version follow semver #1036
Conversation
to echo what i said on discord in a single comment: mod version would work if lite xl wasn't configured in lua and instead a text config or something similar; that's when you'd have a separate plugin api version and program version, since the user side doesn't change when the plugin version does. you @Guldoman specifically said that browsers do have a separate program version and extension version, but they satisfies the fact that chrome (as an example) is not configured with js and its api and instead a settings page :) same thing for sublime text (which i'm not even sure has this in the first place) |
You've been doing this on Discord too. Don't.
Most users don't add complex API-dependent things to their user module, but just configure plugin settings and editor settings directly (which we avoid breaking). Even if we end up having to change something users usually touch, we'll support the old way for a few versions and alert the user that what they're touching has been deprecated.
The problem with this approach can be seen for example with big UX changes: the GUI could get a complete overhaul, but the API could change very little or not at all (so it would require a simple patch version bump). Having the versions separated, avoids useless mod-version bumps and avoids locking the editor version when a big change occurs. For example let's say we add a new tokenizer (fully compatible with the old one), HiDPI scaling support, file open dialogs and redesign the interface.
A combined version approach wouldn't help in this case. We did breaking changes and we didn't keep compatibility with the old version (a major version bump is needed), so your plugin would still be rejected on load.
Chrome extensions can absolutely change browser settings https://support.google.com/chrome_webstore/answer/6029416?hl=en
That's the approach they decided to take. We decided on a different approach. This PR simply extends how the mod-version works and formally forces us to keep compatibility with minor and patch bumps. |
:^(
statusview is a very good example of a simple thing which has changed in 2.1
that would bump the minor version in semver, because it is indeed not a breaking api change, and adds new features. this is the only actual good argument to me that the separate versions would be wanted, but i guess that means apps shouldnt use semver at all?
that wasnt the point. the point was that users change the settings via just a simple page and not in a scripting language
simple plugins that barely use the api, or use it in a simple way and wouldnt need to be rejected (litepresence should be one of them) since the api it uses didnt change at all
/shrug i think you should take the same approach since that's how yall usually gauge if to change behaviour or add features, and this is something that actually matters for users |
Do users usually touch the
Apps can use whatever versioning scheme they prefer. What benefits from semver are libraries (and APIs).
That requires versioned APIs which require a lot more effort.
And that's ok, but please stop bringing that up time after time when I already told you why that approach doesn't suit us.
What do you mean? |
it shows a deprecation message and doesn't do anything, that's not keeping compatibility
guess what we have
yeah i give up already lol, that's how you have half reinvented and broken stuff in lite xl land |
It literally keeps compatibility with the old way? What else is it supposed to do?
Guess what's getting semver with this PR? Oh the API!
You're free to use anything else. |
ah yes, the perfect comment to anyone who says a piece of criticism and suggests something you dont like as for the pr itself, this would only be major and minor and doesnt include patch, so you dont update on bugfixes and only api additions/breaking changes |
so anyway is this going to be merged or not |
At this point I would wait until we refactor everything that needs a refactor first (tab bar, path management, project files/dirs management, ...) to have a mostly static base, otherwise we'd need many bumps in a short amount of time. |
So this change is currently high priority, now much more that we have a plugin manager. With the work done by Adam on lite-xl/lite-xl-plugins#211, ephemeral_tabs is going to be one of the first consumers that will need checking if the minor version matches the required target in order to properly load. This way we can allow plugins targeting mod api v3 to still work without any changes, and at the same time permit other plugins to explicitly request support for the newer non-breaking features. To expand on what Guldo already described above and make sure of having a clear vision where this is heading, are these points right when the following numbers are increased?
Here is a patch to make this PR work against latest core diff --git a/data/core/init.lua b/data/core/init.lua
index 731cb4b7..9cfe2a87 100644
--- a/data/core/init.lua
+++ b/data/core/init.lua
@@ -937,21 +937,17 @@ local function get_plugin_details(filename)
for line in f:lines() do
if not version_match then
- local _, _,
- major_a, major_b,
- minor_a, minor_b,
- patch_a, patch_b = mod_version_regex:match(line)
- local major, minor, patch
- if major_a then
- major = tonumber(line:sub(major_a, major_b))
+ local major, minor, patch = mod_version_regex:match(line)
+ if major then
+ major = tonumber(major)
version_match = major == MOD_VERSION_MAJOR
end
- if version_match and minor_a then
- minor = tonumber(line:sub(minor_a, minor_b))
+ if version_match and minor then
+ minor = tonumber(minor)
version_match = (minor or 0) <= MOD_VERSION_MINOR
end
- if version_match and patch_a then
- patch = tonumber(line:sub(patch_a, patch_b))
+ if version_match and patch then
+ patch = tonumber(patch)
version_match = (patch or 0) <= MOD_VERSION_PATCH
end
end Also Guldo, I will take the liberty of marking this as ready for review since we should work on this rather sooner than later now. |
Now plugins can optionally specify the minor and patch version they support. If no minor or patch version is specified, it's considered 0. Plugins are only loaded if they have the same major version and a smaller or equal minor+patch version.
b54b2a6
to
06790ce
Compare
Should we leave a warning in the logs if we load a plugin with lower minor version? |
that could be a good way of easily debugging possible future issues/mistakes on our part, so feel free to do so, we should squash merge afterwards 😃 |
Mmm but thinking about it, all plugins that are 1 digit modversion eg: |
Unspecified minor means |
I wonder if this might pollute the logs too much tho. |
that is my point |
We should then at least add the mod-version in the "Loaded plugin" log. |
that makes more sense, just adding to the info that is already logged |
Now plugins can optionally specify the minor and patch mod-version they support.
If no minor or patch version is specified, it's considered 0.
Plugins are only loaded if they have the same major version and a smaller or equal minor+patch version.
When we make an API bugfix we will bump our patch mod-version.
When we change the API we will bump the minor mod-version.
We'll have to keep compatibility with older minor+patch versions. If the compatibility can't be ensured, the major version needs to be bumped.