Skip to content

Support bounded version ranges in mod dependencies#403

Draft
Goober5000 wants to merge 2 commits into
KnossosNET:mainfrom
Goober5000:feature/version_ranges
Draft

Support bounded version ranges in mod dependencies#403
Goober5000 wants to merge 2 commits into
KnossosNET:mainfrom
Goober5000:feature/version_ranges

Conversation

@Goober5000
Copy link
Copy Markdown
Contributor

@Goober5000 Goober5000 commented May 10, 2026

Adds NuGet interval notation ("[1.0,2.0)", "(1.0,]", etc.) and npm-style space-separated AND (">=1.0 <2.0") to SemanticVersion.SastifiesDependency. The dependency string is normalized into a list of single-operator constraints that are ANDed together. Existing dependency strings take a one-element fast path through the unchanged per-operator logic (extracted into SatisfiesSingleOp), so behavior is identical for every previously-supported form.

Depends on #404; in draft until that is merged.

@Goober5000 Goober5000 force-pushed the feature/version_ranges branch from bc98bb0 to d716afc Compare May 10, 2026 00:17
In the package manager dev UI, opening a mod whose dependency targets
a version that isn't currently installed showed the operator as '=='
and the version as 'Any', regardless of what the JSON specified.

The operator-detection block in EditorDependencyItem's constructor was
nested inside `if (currentVersion != null)`, so when the requested
version wasn't found in the installed list, the version dropdown
correctly fell back to 'Any' but the operator type incorrectly stayed
at its default 0 ('==').

Move the operator detection out of that conditional so it always runs,
and surface the requested version as its own dropdown entry when it
isn't installed -- mirroring what the missing-mod branch already does.
Extract the operator detection and operator stripping into two private
static helpers shared by both branches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Goober5000 Goober5000 force-pushed the feature/version_ranges branch from d716afc to 41f761c Compare May 10, 2026 22:28
Adds NuGet interval notation ("[1.0,2.0)", "(1.0,]", etc.) and npm-style space-separated AND (">=1.0 <2.0") to SemanticVersion.SastifiesDependency. The dependency string is normalized into a list of single-operator constraints that are ANDed together. Existing dependency strings take a one-element fast path through the unchanged per-operator logic (extracted into SatisfiesSingleOp), so behavior is identical for every previously-supported form.
@Goober5000 Goober5000 force-pushed the feature/version_ranges branch from 41f761c to c9542cd Compare May 11, 2026 00:32
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 this pull request may close these issues.

1 participant