mirror of
https://github.com/apple/pkl.git
synced 2026-05-25 16:19:20 +02:00
Reformat Kotlin code (#1560)
ktfmt has much improved how it formats Kotlin code. Unfortunately, this means that whenever we touch a single line in a Kotlin file, we get a _lot_ more changes thanks to ratcheting now picking up this file for formatting. This PR just reformats every single Kotlin file so we don't have to deal with this churn in future PRs that touch Kotlin code.
This commit is contained in:
@@ -69,13 +69,12 @@ internal class MainPageGenerator(
|
||||
private fun HtmlBlockTag.renderPackages() {
|
||||
if (packagesData.isEmpty()) return
|
||||
|
||||
val sortedPackages =
|
||||
packagesData.sortedWith { pkg1, pkg2 ->
|
||||
when {
|
||||
pkg1.ref.pkg == "pkl" -> -1 // always sort the stdlib first
|
||||
else -> pkg1.ref.pkg.compareTo(pkg2.ref.pkg)
|
||||
}
|
||||
val sortedPackages = packagesData.sortedWith { pkg1, pkg2 ->
|
||||
when {
|
||||
pkg1.ref.pkg == "pkl" -> -1 // always sort the stdlib first
|
||||
else -> pkg1.ref.pkg.compareTo(pkg2.ref.pkg)
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
classes = setOf("member-group")
|
||||
|
||||
@@ -723,11 +723,13 @@ internal abstract class PageGenerator<out S>(
|
||||
?.let { markdownRenderer.render(markdownParser.parse(it)).trim().ifEmpty { null } }
|
||||
}
|
||||
|
||||
private val deprecatedAnnotation: PObject? =
|
||||
annotations.find { it.classInfo == PClassInfo.Deprecated }
|
||||
private val deprecatedAnnotation: PObject? = annotations.find {
|
||||
it.classInfo == PClassInfo.Deprecated
|
||||
}
|
||||
|
||||
private val alsoKnownAsAnnotation: PObject? =
|
||||
annotations.find { it.classInfo == PClassInfo.AlsoKnownAs }
|
||||
private val alsoKnownAsAnnotation: PObject? = annotations.find {
|
||||
it.classInfo == PClassInfo.AlsoKnownAs
|
||||
}
|
||||
|
||||
val isDeprecatedMember: Boolean = deprecatedAnnotation != null
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2025-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -96,10 +96,10 @@ class DocMigratorTest {
|
||||
tempDir.resolve("index.js").also { f ->
|
||||
f.writeText(
|
||||
"""
|
||||
runtimeData.links('known-versions','[{"text":"1.2.3","classes":"current-version"}]');
|
||||
runtimeData.links('known-usages','[{"text":"Foo","href":"../moduleTypes2/Foo.html"},{"text":"moduleTypes2","href":"../moduleTypes2/index.html"}]');
|
||||
runtimeData.links('known-subtypes','[{"text":"Foo","href":"../moduleTypes2/Foo.html"}]');
|
||||
"""
|
||||
runtimeData.links('known-versions','[{"text":"1.2.3","classes":"current-version"}]');
|
||||
runtimeData.links('known-usages','[{"text":"Foo","href":"../moduleTypes2/Foo.html"},{"text":"moduleTypes2","href":"../moduleTypes2/index.html"}]');
|
||||
runtimeData.links('known-subtypes','[{"text":"Foo","href":"../moduleTypes2/Foo.html"}]');
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user