Repository navigation
fix(daemon): give a new model the devkits and used languages MPS gives it - #230
Open
sergej-koscejev wants to merge 2 commits into
Open
sergej-koscejev wants to merge 2 commits into
sergej-koscejev wants to merge 2 commits into
Conversation
…s it mops create model and Code Mode's SModule.createModel now run MPS's ModelsAutoImportsManager on the new model, as the MPS New Model dialog does. An aspect model of a language gets its aspect devkit, for example jetbrains.mps.devkit.aspect.structure, so the language makes. Fixes #225
…aspect model example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
mops create modeland Code Mode'sSModule.createModelnow give a new model the devkits and used languages that MPS gives it. Both go throughModelCreator, which now calls MPS'sModelsAutoImportsManager.performImports, the same step the MPS New Model dialog and the "new aspect" actions run after creating a model.ModelCreator.create(preparation) modelRoot.createModel(name, …) + ModelsAutoImportsManager.performImports(module, model) model.save()What a new model gets now (from the MPS core contributors, observed on MPS 2024.1.6):
structure,constraints,typesystem,dataFlow,textGen,migration, …)jetbrains.mps.devkit.aspect.structureeditor,behavior,intentions, …) or non-aspect modeljetbrains.mps.devkit.general-purposeplus the aspect's main languages, e.g.jetbrains.mps.lang.editorandjetbrains.mps.lang.actionsforeditorjetbrains.mps.devkit.templates, plus an import of the source language's structure model for a template modelThe
create modelhelp, theSModule.createModelCode Mode catalog entry, and the bundled creation examples say so. The MPS behavior was checked in the 2024.1 and 2026.1 sources (ModelsAutoImportsManager,Language.LanguageModelsAutoImports,Generator.GeneratorModelsAutoImports,ModelCreateHelper,LanguageAspectDescriptorBase.create).Left for later:
LanguageAspect.<ASPECT>.createNew(language)is MPS's own API and still gives a plain model. mops cannot change it;module.createModel('.structure')is the path that gets the devkit.MissingDependenciesFixer, which adds module dependencies for imported models. mops does not. Only the generator template-model import of the source language's structure model is affected; aspect models get no model imports.create modeloutput and--dry-rundo not list the devkits and used languages that were added (docs/VISION.mdprinciple 3).Fixes #225
Evidence
Before: the issue's steps on a copy of the MPS 2024.1.6 sample
_theSimplestLanguage:After: the same steps:
New tests, each seen failing before the fix:
ModelCreationSemanticsTest:create model example.lang.structurein a new language getsjetbrains.mps.devkit.aspect.structure; Code ModecreateModel('.dataFlow')getsjetbrains.mps.devkit.aspect.dataflow. Pass on MPS 2024.1.6, 2025.1.4, 2026.1.1.MakeIntegrationTest: create language → create structure model → add a concept →make modulesucceeds (wasFAILEDwith theLanguage.javacompile errors). Passes on MPS 2024.1.6../gradlew checkon ec10323: exit 0; daemon tests (456 each on 2024.1.6, 2025.1.4, 2026.1.1, prerelease) and CLI integration tests (82 each, 6 skipped) have no failures. After the review fix-up commit:ModelCreationSemanticsTeston 2024.1.6 and 2026.1.1,:cli:test,detektMain,checkReferencepass.Merge Danger
Blast Radius: Model creation
Every model that mops creates in a language or generator now starts with devkits and used languages, where it used to start empty. Solution models are unchanged.