Skip to content

Commit

Permalink
fix: sort modules/models/nodes alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
slisson committed Apr 30, 2024
1 parent 69a7d65 commit 7c077ce
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ class ModelixSSRServerForMPS : Disposable {
repository.getArea().executeRead {
body {
ul {
repository.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Repository.modules).forEach {
repository.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Repository.modules).sortedBy { it.name }.forEach {
li {
a {
href = "module/${URLEncoder.encode(it.reference.serialize(), StandardCharsets.UTF_8)}/"
+(it.getPropertyValue(BuiltinLanguages.jetbrains_mps_lang_core.INamedConcept.name) ?: "<no name>")
+(it.name ?: "<no name>")
}
}
}
Expand All @@ -188,11 +188,11 @@ class ModelixSSRServerForMPS : Disposable {
val module = repository.getArea().resolveNode(NodeReference(moduleRef))!!
body {
ul {
module.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Module.models).forEach {
module.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Module.models).sortedBy { it.name }.forEach {
li {
a {
href = "../../model/${URLEncoder.encode(it.reference.serialize(), StandardCharsets.UTF_8)}/"
+(it.getPropertyValue(BuiltinLanguages.jetbrains_mps_lang_core.INamedConcept.name) ?: "<no name>")
+(it.name ?: "<no name>")
}
}
}
Expand All @@ -209,11 +209,11 @@ class ModelixSSRServerForMPS : Disposable {
val model = repository.getArea().resolveNode(NodeReference(modelRef))!!
body {
ul {
model.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Model.rootNodes).forEach {
model.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Model.rootNodes).sortedBy { it.name }.forEach {
li {
a {
href = "../../editor/${URLEncoder.encode(it.reference.serialize(), StandardCharsets.UTF_8)}/"
+(it.getPropertyValue(BuiltinLanguages.jetbrains_mps_lang_core.INamedConcept.name) ?: "<no name>")
+(it.name ?: "<no name>")
}
}
}
Expand Down Expand Up @@ -343,4 +343,6 @@ fun IReferenceLink?.toMPS(): SReferenceLink? = if (this is MPSReferenceLink) thi
fun IProperty?.toMPS(): SProperty? = if (this is MPSProperty) this.property else null
fun IConcept?.toMPS(): SAbstractConcept? = if (this is MPSConcept) this.concept else null

val INode.name get() = getPropertyValue(BuiltinLanguages.jetbrains_mps_lang_core.INamedConcept.name)

class MPSConstraintViolation(val rule: Rule<*>) : IConstraintViolation

0 comments on commit 7c077ce

Please sign in to comment.