Skip to content

Commit

Permalink
🎨 フォーマット
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenCMD committed Jan 6, 2024
1 parent b67e445 commit db36fba
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import typings.spgodingDatapackLanguageServer.spgodingDatapackLanguageServerStri
import typings.spgodingDatapackLanguageServer.anon.GetText
import typings.spgodingDatapackLanguageServer.libNodesIdentityNodeMod.IdentityNode

final class DatapackAnalyzer (
final class DatapackAnalyzer(
private val dls: DatapackLanguageService,
private val analyzerConfig: AnalyzerConfig,
private val analyzeCache: AnalysisCache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import com.github.chencmd.datapacklinter.dls.DLSHelper
import com.github.chencmd.datapacklinter.facade.DatapackLanguageService
import com.github.chencmd.datapacklinter.generic.MapExtra.*
import com.github.chencmd.datapacklinter.term.FileChecksums
import com.github.chencmd.datapacklinter.term.ResourcePath
import com.github.chencmd.datapacklinter.utils.Path

import cats.Align
import cats.data.Ior
import cats.implicits.*
import com.github.chencmd.datapacklinter.term.ResourcePath

enum FileUpdate private () {
case Created
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import com.github.chencmd.datapacklinter.term.RestoreCacheOrSkip

trait CIPlatformCacheRestorationInstr[F[_]] {
def shouldRestoreCache(): F[RestoreCacheOrSkip]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ object CIPlatformReadKeyedConfigInstr {
}
}

given ConfigValueType[String] with {
given ConfigValueType[String] with {
def tryCast(key: String, value: String): Either[String, String] = Right(value)
}
given ConfigValueType[Int] with {
given ConfigValueType[Int] with {
def tryCast(key: String, value: String): Either[String, Int] =
value.toIntOption.toRight(typeMismatchError(key, "Int"))
}
given ConfigValueType[Double] with {
given ConfigValueType[Double] with {
def tryCast(key: String, value: String): Either[String, Double] =
value.toDoubleOption.toRight(typeMismatchError(key, "Double"))
}
given ConfigValueType[Boolean] with {
given ConfigValueType[Boolean] with {
val trueValue = List("true", "True", "TRUE")
val falseValue = List("false", "False", "FALSE")
def tryCast(key: String, value: String): Either[String, Boolean] = {
Expand All @@ -64,7 +64,7 @@ object CIPlatformReadKeyedConfigInstr {
}
}

given [A](using A: ConfigValueType[A]): ConfigValueType[List[A]] with {
given [A](using A: ConfigValueType[A]): ConfigValueType[List[A]] with {
def tryCast(key: String, value: String): Either[String, List[A]] =
value.split("\n").toList.traverse(A.tryCast(key, _))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.github.chencmd.datapacklinter.generic.DLSConfigExtra.*
import com.github.chencmd.datapacklinter.generic.Instances.given
import com.github.chencmd.datapacklinter.generic.RaiseNec
import com.github.chencmd.datapacklinter.generic.UndefOrExtra.*
import com.github.chencmd.datapacklinter.term.ResourcePath
import com.github.chencmd.datapacklinter.utils.Datapack
import com.github.chencmd.datapacklinter.utils.FSAsync
import com.github.chencmd.datapacklinter.utils.JSObject
Expand Down Expand Up @@ -36,7 +37,6 @@ import typings.spgodingDatapackLanguageServer.libServicesDatapackLanguageService
import typings.spgodingDatapackLanguageServer.libTypesClientCacheMod.CacheFile
import typings.spgodingDatapackLanguageServer.libTypesDatapackDocumentMod.DatapackDocument
import typings.spgodingDatapackLanguageServer.libTypesVersionInformationMod.VersionInformation
import com.github.chencmd.datapacklinter.term.ResourcePath

object DLSHelper {
def parseDoc[F[_]: Async](dls: DatapackLanguageService)(doc: TextDocument): OptionT[F, DatapackDocument] = OptionT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import cats.implicits.*

import scala.util.chaining.*


object DatapackLinter {
def printFileUpdatesLog[F[_]: Async](
fileUpdates: FileUpdates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ object FSAsync {
.handleError(_ => false)
}

def writeFile[F[_]: Async](targetPath: Path, contents: String, encoding: BufferEncoding = BufferEncoding.utf8): F[Unit] = {
def writeFile[F[_]: Async](
targetPath: Path,
contents: String,
encoding: BufferEncoding = BufferEncoding.utf8
): F[Unit] = {
AsyncExtra.fromPromise(fsp.writeFile(targetPath, contents, encoding))
}

Expand Down

0 comments on commit db36fba

Please sign in to comment.