Handling Multiple Publicodes Models per Workspace #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #24
Currently the server assumes that all
.publicodesfiles belong to the same model. In monorepos and multi folder workspaces this causes rules from unrelated packages to be mixed, so references can resolve across projects that should be isolated. By introducing explicit model boundaries and routing requests per model, the language server better matches real workspace layouts, avoids confusing cross model resolutions, and scales to monorepos without forcing users to split their workspace.This change teaches the Publicodes language server to handle multiple independent models in a single workspace. Instead of merging every
.publicodes*file into one global engine, the server now groups files by a model boundary, closest.publicodes.config.{ts,js}orpackage.json, and builds separate rule indexes and engines per model. All language features then resolve through the model that owns the current file, so rules from different packages no longer bleed into each other.Implementation wise, the server now tracks a small registry of models keyed by their root, maps each file to its model, and updates parsing, validation, hover, completion and definition flows to always look up rules through the owning model. Boundary detection walks up from a file to find the nearest
.publicodes.config.{ts,js}orpackage.json, and file add, change and delete events keep each model's rule index and diagnostics in sync with the workspace.